chore: change name of the error

const-rune-usage-error
paoloricciuti 7 months ago
parent 79be365d29
commit b9e4a86a14

@ -190,12 +190,6 @@ Cyclical dependency detected: %cycle%
`{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>`, `<svelte:boundary` or `<Component>`
```
### const_tag_invalid_rune_usage
```
Can't use %name% as initialization of a `{@const}` tag
```
### constant_assignment
```
@ -654,6 +648,12 @@ Cannot access a computed property of a rune
`%name%` is not a valid rune
```
### rune_invalid_placement
```
Can't use `%name%` rune here
```
### rune_invalid_usage
```

@ -120,10 +120,6 @@
> `{@const}` must be the immediate child of `{#snippet}`, `{#if}`, `{:else if}`, `{:else}`, `{#each}`, `{:then}`, `{:catch}`, `<svelte:fragment>`, `<svelte:boundary` or `<Component>`
## const_tag_invalid_rune_usage
> Can't use %name% as initialization of a `{@const}` tag
## debug_tag_invalid_arguments
> {@debug ...} arguments must be identifiers, not arbitrary expressions
@ -222,6 +218,10 @@ HTML restricts where certain elements can appear. In case of a violation the bro
> cannot use spread arguments in `{@render ...}` tags
## rune_invalid_placement
> Can't use `%name%` rune here
## script_duplicate
> A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element

@ -896,16 +896,6 @@ export function const_tag_invalid_placement(node) {
e(node, 'const_tag_invalid_placement', `\`{@const}\` must be the immediate child of \`{#snippet}\`, \`{#if}\`, \`{:else if}\`, \`{:else}\`, \`{#each}\`, \`{:then}\`, \`{:catch}\`, \`<svelte:fragment>\`, \`<svelte:boundary\` or \`<Component>\`\nhttps://svelte.dev/e/const_tag_invalid_placement`);
}
/**
* Can't use %name% as initialization of a `{@const}` tag
* @param {null | number | NodeLike} node
* @param {string} name
* @returns {never}
*/
export function const_tag_invalid_rune_usage(node, name) {
e(node, 'const_tag_invalid_rune_usage', `Can't use ${name} as initialization of a \`{@const}\` tag\nhttps://svelte.dev/e/const_tag_invalid_rune_usage`);
}
/**
* {@debug ...} arguments must be identifiers, not arbitrary expressions
* @param {null | number | NodeLike} node
@ -1126,6 +1116,16 @@ export function render_tag_invalid_spread_argument(node) {
e(node, 'render_tag_invalid_spread_argument', `cannot use spread arguments in \`{@render ...}\` tags\nhttps://svelte.dev/e/render_tag_invalid_spread_argument`);
}
/**
* Can't use `%name%` rune here
* @param {null | number | NodeLike} node
* @param {string} name
* @returns {never}
*/
export function rune_invalid_placement(node, name) {
e(node, 'rune_invalid_placement', `Can't use \`${name}\` rune here\nhttps://svelte.dev/e/rune_invalid_placement`);
}
/**
* A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element
* @param {null | number | NodeLike} node

@ -16,7 +16,7 @@ export function ConstTag(node, context) {
for (let declaration of node.declaration.declarations) {
const rune = get_rune(declaration.init, context.state.scope);
if (rune) {
e.const_tag_invalid_rune_usage(declaration.init, rune);
e.rune_invalid_placement(declaration.init, rune);
}
}

@ -1,7 +1,7 @@
[
{
"code": "const_tag_invalid_rune_usage",
"message": "Can't use $derived as initialization of a `{@const}` tag",
"code": "rune_invalid_placement",
"message": "Can't use `$derived` here",
"start": {
"line": 2,
"column": 15

Loading…
Cancel
Save