Skip to content

Commit 42ecafc

Browse files
committed
breaking: deprecate the svelte/no-dynamic-slot-name rule
1 parent a003664 commit 42ecafc

File tree

7 files changed

+35
-26
lines changed

7 files changed

+35
-26
lines changed

.changeset/real-birds-move.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': major
3+
---
4+
5+
breaking: deprecate the `svelte/no-dynamic-slot-name` rule

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ These rules relate to possible syntax or logic errors in Svelte code:
326326
| [svelte/no-dupe-on-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-on-directives/) | disallow duplicate `on:` directives | |
327327
| [svelte/no-dupe-style-properties](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-style-properties/) | disallow duplicate style properties | :star: |
328328
| [svelte/no-dupe-use-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-use-directives/) | disallow duplicate `use:` directives | |
329-
| [svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | disallow dynamic slot name | :star::wrench: |
330329
| [svelte/no-export-load-in-svelte-module-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-export-load-in-svelte-module-in-kit-pages/) | disallow exporting load functions in `*.svelte` module in SvelteKit page components. | |
331330
| [svelte/no-not-function-handler](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-not-function-handler/) | disallow use of not function in event handler | :star: |
332331
| [svelte/no-object-in-text-mustaches](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches/) | disallow objects in text mustache interpolation | :star: |
@@ -444,6 +443,7 @@ These rules relate to this plugin works:
444443
| Rule ID | Replaced by |
445444
|:--------|:------------|
446445
| [svelte/@typescript-eslint/no-unnecessary-condition](https://sveltejs.github.io/eslint-plugin-svelte/rules/@typescript-eslint/no-unnecessary-condition/) | This rule is no longer needed when using svelte-eslint-parser>=v0.19.0. |
446+
| [svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | Now Svelte compiler itself throws an compile error. |
447447
| [svelte/no-goto-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-goto-without-base/) | [svelte/no-navigation-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-base/) |
448448

449449
<!--RULES_TABLE_END-->

docs/rules.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,26 @@ sidebarDepth: 0
1414

1515
These rules relate to possible syntax or logic errors in Svelte code:
1616

17-
| Rule ID | Description | |
18-
| :------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | :------------- |
19-
| [svelte/infinite-reactive-loop](./rules/infinite-reactive-loop.md) | Svelte runtime prevents calling the same reactive statement twice in a microtask. But between different microtask, it doesn't prevent. | |
20-
| [svelte/no-deprecated-raw-special-elements](./rules/no-deprecated-raw-special-elements.md) | Recommends not using raw special elements in Svelte versions previous to 5. | :wrench: |
21-
| [svelte/no-dom-manipulating](./rules/no-dom-manipulating.md) | disallow DOM manipulating | |
22-
| [svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
23-
| [svelte/no-dupe-on-directives](./rules/no-dupe-on-directives.md) | disallow duplicate `on:` directives | |
24-
| [svelte/no-dupe-style-properties](./rules/no-dupe-style-properties.md) | disallow duplicate style properties | :star: |
25-
| [svelte/no-dupe-use-directives](./rules/no-dupe-use-directives.md) | disallow duplicate `use:` directives | |
26-
| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | disallow dynamic slot name | :star::wrench: |
27-
| [svelte/no-export-load-in-svelte-module-in-kit-pages](./rules/no-export-load-in-svelte-module-in-kit-pages.md) | disallow exporting load functions in `*.svelte` module in SvelteKit page components. | |
28-
| [svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | :star: |
29-
| [svelte/no-object-in-text-mustaches](./rules/no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: |
30-
| [svelte/no-reactive-reassign](./rules/no-reactive-reassign.md) | disallow reassigning reactive values | |
31-
| [svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: |
32-
| [svelte/no-store-async](./rules/no-store-async.md) | disallow using async/await inside svelte stores because it causes issues with the auto-unsubscribing features | |
33-
| [svelte/no-unknown-style-directive-property](./rules/no-unknown-style-directive-property.md) | disallow unknown `style:property` | :star: |
34-
| [svelte/require-store-callbacks-use-set-param](./rules/require-store-callbacks-use-set-param.md) | store callbacks must use `set` param | |
35-
| [svelte/require-store-reactive-access](./rules/require-store-reactive-access.md) | disallow to use of the store itself as an operand. Need to use $ prefix or get function. | :wrench: |
36-
| [svelte/valid-compile](./rules/valid-compile.md) | disallow warnings when compiling. | :star: |
37-
| [svelte/valid-prop-names-in-kit-pages](./rules/valid-prop-names-in-kit-pages.md) | disallow props other than data or errors in SvelteKit page components. | |
17+
| Rule ID | Description | |
18+
| :------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | :------- |
19+
| [svelte/infinite-reactive-loop](./rules/infinite-reactive-loop.md) | Svelte runtime prevents calling the same reactive statement twice in a microtask. But between different microtask, it doesn't prevent. | |
20+
| [svelte/no-deprecated-raw-special-elements](./rules/no-deprecated-raw-special-elements.md) | Recommends not using raw special elements in Svelte versions previous to 5. | :wrench: |
21+
| [svelte/no-dom-manipulating](./rules/no-dom-manipulating.md) | disallow DOM manipulating | |
22+
| [svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
23+
| [svelte/no-dupe-on-directives](./rules/no-dupe-on-directives.md) | disallow duplicate `on:` directives | |
24+
| [svelte/no-dupe-style-properties](./rules/no-dupe-style-properties.md) | disallow duplicate style properties | :star: |
25+
| [svelte/no-dupe-use-directives](./rules/no-dupe-use-directives.md) | disallow duplicate `use:` directives | |
26+
| [svelte/no-export-load-in-svelte-module-in-kit-pages](./rules/no-export-load-in-svelte-module-in-kit-pages.md) | disallow exporting load functions in `*.svelte` module in SvelteKit page components. | |
27+
| [svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | :star: |
28+
| [svelte/no-object-in-text-mustaches](./rules/no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: |
29+
| [svelte/no-reactive-reassign](./rules/no-reactive-reassign.md) | disallow reassigning reactive values | |
30+
| [svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: |
31+
| [svelte/no-store-async](./rules/no-store-async.md) | disallow using async/await inside svelte stores because it causes issues with the auto-unsubscribing features | |
32+
| [svelte/no-unknown-style-directive-property](./rules/no-unknown-style-directive-property.md) | disallow unknown `style:property` | :star: |
33+
| [svelte/require-store-callbacks-use-set-param](./rules/require-store-callbacks-use-set-param.md) | store callbacks must use `set` param | |
34+
| [svelte/require-store-reactive-access](./rules/require-store-reactive-access.md) | disallow to use of the store itself as an operand. Need to use $ prefix or get function. | :wrench: |
35+
| [svelte/valid-compile](./rules/valid-compile.md) | disallow warnings when compiling. | :star: |
36+
| [svelte/valid-prop-names-in-kit-pages](./rules/valid-prop-names-in-kit-pages.md) | disallow props other than data or errors in SvelteKit page components. | |
3837

3938
## Security Vulnerability
4039

@@ -141,4 +140,5 @@ These rules relate to this plugin works:
141140
| Rule ID | Replaced by |
142141
| :----------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------- |
143142
| [svelte/@typescript-eslint/no-unnecessary-condition](./rules/@typescript-eslint/no-unnecessary-condition.md) | This rule is no longer needed when using svelte-eslint-parser>=v0.19.0. |
143+
| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | Now Svelte compiler itself throws an compile error. |
144144
| [svelte/no-goto-without-base](./rules/no-goto-without-base.md) | [svelte/no-navigation-without-base](./rules/no-navigation-without-base.md) |

docs/rules/no-dynamic-slot-name.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ since: 'v0.14.0'
1010

1111
> disallow dynamic slot name
1212
13-
- :gear: This rule is included in `"plugin:svelte/recommended"`.
13+
- :warning: This rule was **deprecated**. Now Svelte compiler itself throws an compile error.
1414
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
1515

1616
## :book: Rule Details

packages/eslint-plugin-svelte/src/configs/flat/recommended.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const config: Linter.Config[] = [
1414
'svelte/no-at-html-tags': 'error',
1515
'svelte/no-dupe-else-if-blocks': 'error',
1616
'svelte/no-dupe-style-properties': 'error',
17-
'svelte/no-dynamic-slot-name': 'error',
1817
'svelte/no-inner-declarations': 'error',
1918
'svelte/no-not-function-handler': 'error',
2019
'svelte/no-object-in-text-mustaches': 'error',

packages/eslint-plugin-svelte/src/rule-types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export interface RuleOptions {
137137
/**
138138
* disallow dynamic slot name
139139
* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/
140+
* @deprecated
140141
*/
141142
'svelte/no-dynamic-slot-name'?: Linter.RuleEntry<[]>
142143
/**

packages/eslint-plugin-svelte/src/rules/no-dynamic-slot-name.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ export default createRule('no-dynamic-slot-name', {
1313
docs: {
1414
description: 'disallow dynamic slot name',
1515
category: 'Possible Errors',
16-
recommended: true
16+
recommended: false
1717
},
1818
fixable: 'code',
19+
deprecated: true,
1920
schema: [],
2021
messages: {
2122
unexpected: '`<slot>` name cannot be dynamic.',
2223
requireValue: '`<slot>` name requires a value.'
2324
},
24-
type: 'problem'
25+
type: 'problem',
26+
replacedBy: {
27+
note: 'Now Svelte compiler itself throws an compile error.'
28+
}
2529
},
2630
create(context) {
2731
const sourceCode = getSourceCode(context);

0 commit comments

Comments
 (0)