sveltejs/svelte

Intercept and suppress specific errors

Kansuler opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
I'm using a library named three-elements that creates custom elements with directives, one of those directives are ref:xxx. However this creates an unnecessary complication as Svelte emits a deprecation error with no way of suppressing it.

The ref directive is no longer supported — use `bind:this={xxx}` instead
ParseError: The ref directive is no longer supported — use `bind:this={xxx}` instead
    at error (file:///home/xxx/workspace/node_modules/svelte/compiler.mjs:16746:19)
    at Parser$1.error (file:///home/xxx/workspace/node_modules/svelte/compiler.mjs:16822:9)
    at read_attribute (file:///home/xxx/workspace/node_modules/svelte/compiler.mjs:16037:20)
    at tag (file:///home/xxx/workspace/node_modules/svelte/compiler.mjs:15856:25)
    at new Parser$1 (file:///home/xxx/workspace/node_modules/svelte/compiler.mjs:16781:21)
    at parse$3 (file:///home/xxx/workspace/node_modules/svelte/compiler.mjs:16913:20)
    at compile (file:///home/xxx/workspace/node_modules/svelte/compiler.mjs:30006:17)
    at compileSvelte (file:///home/xxx/workspace/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:264:20)
    at async TransformContext.transform (file:///home/xxx/workspace/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:873:27)
    at async Object.transform (/home/xxx/workspace/node_modules/vite/dist/node/chunks/dep-bc228bbb.js:44765:30)

Describe the solution you'd like
A way to access and suppress individual error types. The purpose for this error is to give deprecation notice, but it does needlessly occupy a directive that might collide with other libraries. ref is not uncommon as a directive.

Describe alternatives you've considered
I've put forward a suggestion to three-elements of prefixing their directive to avoid collisions with frameworks/libraries.

How important is this feature to you?
As it stands right now, I cannot use this library to create declarative 3d scenes.

Additional context
The error in svelte code base: https://github.com/sveltejs/svelte/blob/master/src/compiler/parse/state/tag.ts#L394-L399

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.