diff --git a/.changeset/green-cherries-fail.md b/.changeset/green-cherries-fail.md new file mode 100644 index 000000000..69874489d --- /dev/null +++ b/.changeset/green-cherries-fail.md @@ -0,0 +1,5 @@ +--- +'eslint-plugin-svelte': major +--- + +chore: removed Svelte 4 specific rules from recommended set diff --git a/README.md b/README.md index 35c16c8e8..e9528e179 100644 --- a/README.md +++ b/README.md @@ -326,9 +326,9 @@ These rules relate to possible syntax or logic errors in Svelte code: | [svelte/no-dupe-on-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-on-directives/) | disallow duplicate `on:` directives | | | [svelte/no-dupe-style-properties](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-style-properties/) | disallow duplicate style properties | :star: | | [svelte/no-dupe-use-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-use-directives/) | disallow duplicate `use:` directives | | -| [svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | disallow dynamic slot name | :star::wrench: | +| [svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | disallow dynamic slot name | :wrench: | | [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. | | -| [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: | +| [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 | | | [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: | | [svelte/no-reactive-reassign](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-reassign/) | disallow reassigning reactive values | | | [svelte/no-shorthand-style-property-overrides](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-shorthand-style-property-overrides/) | disallow shorthand style properties that override related longhand properties | :star: | diff --git a/docs/rules.md b/docs/rules.md index 047b2ab29..f1bf71edb 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -14,27 +14,27 @@ sidebarDepth: 0 These rules relate to possible syntax or logic errors in Svelte code: -| Rule ID | Description | | -| :------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | :------------- | -| [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. | | -| [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: | -| [svelte/no-dom-manipulating](./rules/no-dom-manipulating.md) | disallow DOM manipulating | | -| [svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: | -| [svelte/no-dupe-on-directives](./rules/no-dupe-on-directives.md) | disallow duplicate `on:` directives | | -| [svelte/no-dupe-style-properties](./rules/no-dupe-style-properties.md) | disallow duplicate style properties | :star: | -| [svelte/no-dupe-use-directives](./rules/no-dupe-use-directives.md) | disallow duplicate `use:` directives | | -| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | disallow dynamic slot name | :star::wrench: | -| [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. | | -| [svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | :star: | -| [svelte/no-object-in-text-mustaches](./rules/no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: | -| [svelte/no-reactive-reassign](./rules/no-reactive-reassign.md) | disallow reassigning reactive values | | -| [svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: | -| [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 | | -| [svelte/no-unknown-style-directive-property](./rules/no-unknown-style-directive-property.md) | disallow unknown `style:property` | :star: | -| [svelte/require-store-callbacks-use-set-param](./rules/require-store-callbacks-use-set-param.md) | store callbacks must use `set` param | | -| [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: | -| [svelte/valid-compile](./rules/valid-compile.md) | disallow warnings when compiling. | :star: | -| [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. | | +| Rule ID | Description | | +| :------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | :------- | +| [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. | | +| [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: | +| [svelte/no-dom-manipulating](./rules/no-dom-manipulating.md) | disallow DOM manipulating | | +| [svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: | +| [svelte/no-dupe-on-directives](./rules/no-dupe-on-directives.md) | disallow duplicate `on:` directives | | +| [svelte/no-dupe-style-properties](./rules/no-dupe-style-properties.md) | disallow duplicate style properties | :star: | +| [svelte/no-dupe-use-directives](./rules/no-dupe-use-directives.md) | disallow duplicate `use:` directives | | +| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | disallow dynamic slot name | :wrench: | +| [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. | | +| [svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | | +| [svelte/no-object-in-text-mustaches](./rules/no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: | +| [svelte/no-reactive-reassign](./rules/no-reactive-reassign.md) | disallow reassigning reactive values | | +| [svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: | +| [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 | | +| [svelte/no-unknown-style-directive-property](./rules/no-unknown-style-directive-property.md) | disallow unknown `style:property` | :star: | +| [svelte/require-store-callbacks-use-set-param](./rules/require-store-callbacks-use-set-param.md) | store callbacks must use `set` param | | +| [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: | +| [svelte/valid-compile](./rules/valid-compile.md) | disallow warnings when compiling. | :star: | +| [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. | | ## Security Vulnerability diff --git a/docs/rules/no-dynamic-slot-name.md b/docs/rules/no-dynamic-slot-name.md index f9a84df2f..da4ed4573 100644 --- a/docs/rules/no-dynamic-slot-name.md +++ b/docs/rules/no-dynamic-slot-name.md @@ -10,7 +10,6 @@ since: 'v0.14.0' > disallow dynamic slot name -- :gear: This rule is included in `"plugin:svelte/recommended"`. - :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. ## :book: Rule Details diff --git a/docs/rules/no-not-function-handler.md b/docs/rules/no-not-function-handler.md index 3162a4254..22c77a626 100644 --- a/docs/rules/no-not-function-handler.md +++ b/docs/rules/no-not-function-handler.md @@ -10,8 +10,6 @@ since: 'v0.5.0' > disallow use of not function in event handler -- :gear: This rule is included in `"plugin:svelte/recommended"`. - ## :book: Rule Details This rule reports where you used not function value in event handlers. diff --git a/packages/eslint-plugin-svelte/src/configs/flat/recommended.ts b/packages/eslint-plugin-svelte/src/configs/flat/recommended.ts index 5e3110e24..9c8006fb0 100644 --- a/packages/eslint-plugin-svelte/src/configs/flat/recommended.ts +++ b/packages/eslint-plugin-svelte/src/configs/flat/recommended.ts @@ -14,9 +14,7 @@ const config: Linter.Config[] = [ 'svelte/no-at-html-tags': 'error', 'svelte/no-dupe-else-if-blocks': 'error', 'svelte/no-dupe-style-properties': 'error', - 'svelte/no-dynamic-slot-name': 'error', 'svelte/no-inner-declarations': 'error', - 'svelte/no-not-function-handler': 'error', 'svelte/no-object-in-text-mustaches': 'error', 'svelte/no-shorthand-style-property-overrides': 'error', 'svelte/no-unknown-style-directive-property': 'error', diff --git a/packages/eslint-plugin-svelte/src/rules/infinite-reactive-loop.ts b/packages/eslint-plugin-svelte/src/rules/infinite-reactive-loop.ts index 7f777a9e6..504270a01 100644 --- a/packages/eslint-plugin-svelte/src/rules/infinite-reactive-loop.ts +++ b/packages/eslint-plugin-svelte/src/rules/infinite-reactive-loop.ts @@ -369,7 +369,6 @@ export default createRule('infinite-reactive-loop', { description: "Svelte runtime prevents calling the same reactive statement twice in a microtask. But between different microtask, it doesn't prevent.", category: 'Possible Errors', - // TODO Switch to recommended in the major version. recommended: false }, schema: [], diff --git a/packages/eslint-plugin-svelte/src/rules/no-dynamic-slot-name.ts b/packages/eslint-plugin-svelte/src/rules/no-dynamic-slot-name.ts index 7b266bef9..9ec9cee30 100644 --- a/packages/eslint-plugin-svelte/src/rules/no-dynamic-slot-name.ts +++ b/packages/eslint-plugin-svelte/src/rules/no-dynamic-slot-name.ts @@ -13,7 +13,7 @@ export default createRule('no-dynamic-slot-name', { docs: { description: 'disallow dynamic slot name', category: 'Possible Errors', - recommended: true + recommended: false }, fixable: 'code', schema: [], diff --git a/packages/eslint-plugin-svelte/src/rules/no-immutable-reactive-statements.ts b/packages/eslint-plugin-svelte/src/rules/no-immutable-reactive-statements.ts index d6cba520f..3c89bc8fb 100644 --- a/packages/eslint-plugin-svelte/src/rules/no-immutable-reactive-statements.ts +++ b/packages/eslint-plugin-svelte/src/rules/no-immutable-reactive-statements.ts @@ -10,7 +10,6 @@ export default createRule('no-immutable-reactive-statements', { docs: { description: "disallow reactive statements that don't reference reactive values.", category: 'Best Practices', - // TODO Switch to recommended in the major version. recommended: false }, schema: [], diff --git a/packages/eslint-plugin-svelte/src/rules/no-not-function-handler.ts b/packages/eslint-plugin-svelte/src/rules/no-not-function-handler.ts index 7b46c3d80..439863389 100644 --- a/packages/eslint-plugin-svelte/src/rules/no-not-function-handler.ts +++ b/packages/eslint-plugin-svelte/src/rules/no-not-function-handler.ts @@ -26,7 +26,7 @@ export default createRule('no-not-function-handler', { docs: { description: 'disallow use of not function in event handler', category: 'Possible Errors', - recommended: true + recommended: false }, schema: [], messages: { diff --git a/packages/eslint-plugin-svelte/src/rules/no-reactive-reassign.ts b/packages/eslint-plugin-svelte/src/rules/no-reactive-reassign.ts index f1da8a2ea..5049dd83a 100644 --- a/packages/eslint-plugin-svelte/src/rules/no-reactive-reassign.ts +++ b/packages/eslint-plugin-svelte/src/rules/no-reactive-reassign.ts @@ -9,7 +9,6 @@ export default createRule('no-reactive-reassign', { docs: { description: 'disallow reassigning reactive values', category: 'Possible Errors', - // TODO Switch to recommended in the major version. recommended: false }, schema: [