Skip to content

Commit 8369eaf

Browse files
authored
fix!: rename no-deprecated-raw-special-elements to no-raw-special-elements (#1015)
1 parent a003664 commit 8369eaf

File tree

12 files changed

+27
-22
lines changed

12 files changed

+27
-22
lines changed

.changeset/thin-dryers-know.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': minor
3+
---
4+
5+
fix!: rename `no-deprecated-raw-special-elements` to `no-raw-special-elements`

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ These rules relate to possible syntax or logic errors in Svelte code:
320320
| Rule ID | Description | |
321321
|:--------|:------------|:---|
322322
| [svelte/infinite-reactive-loop](https://sveltejs.github.io/eslint-plugin-svelte/rules/infinite-reactive-loop/) | Svelte runtime prevents calling the same reactive statement twice in a microtask. But between different microtask, it doesn't prevent. | |
323-
| [svelte/no-deprecated-raw-special-elements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-deprecated-raw-special-elements/) | Recommends not using raw special elements in Svelte versions previous to 5. | :wrench: |
324323
| [svelte/no-dom-manipulating](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dom-manipulating/) | disallow DOM manipulating | |
325324
| [svelte/no-dupe-else-if-blocks](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-else-if-blocks/) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
326325
| [svelte/no-dupe-on-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-on-directives/) | disallow duplicate `on:` directives | |
@@ -330,6 +329,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
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: |
332+
| [svelte/no-raw-special-elements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-raw-special-elements/) | Checks for invalid raw HTML elements | :wrench: |
333333
| [svelte/no-reactive-reassign](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-reassign/) | disallow reassigning reactive values | |
334334
| [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: |
335335
| [svelte/no-store-async](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-store-async/) | disallow using async/await inside svelte stores because it causes issues with the auto-unsubscribing features | |

docs/rules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ These rules relate to possible syntax or logic errors in Svelte code:
1717
| Rule ID | Description | |
1818
| :------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | :------------- |
1919
| [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: |
2120
| [svelte/no-dom-manipulating](./rules/no-dom-manipulating.md) | disallow DOM manipulating | |
2221
| [svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
2322
| [svelte/no-dupe-on-directives](./rules/no-dupe-on-directives.md) | disallow duplicate `on:` directives | |
@@ -27,6 +26,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
2726
| [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. | |
2827
| [svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | :star: |
2928
| [svelte/no-object-in-text-mustaches](./rules/no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: |
29+
| [svelte/no-raw-special-elements](./rules/no-raw-special-elements.md) | Checks for invalid raw HTML elements | :wrench: |
3030
| [svelte/no-reactive-reassign](./rules/no-reactive-reassign.md) | disallow reassigning reactive values | |
3131
| [svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: |
3232
| [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 | |

docs/rules/no-deprecated-raw-special-elements.md renamed to docs/rules/no-raw-special-elements.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
---
22
pageClass: 'rule-details'
33
sidebarDepth: 0
4-
title: 'svelte/no-deprecated-raw-special-elements'
5-
description: 'Recommends not using raw special elements in Svelte versions previous to 5.'
4+
title: 'svelte/no-raw-special-elements'
5+
description: 'Checks for invalid raw HTML elements'
66
since: 'v3.0.0-next.1'
77
---
88

9-
# svelte/no-deprecated-raw-special-elements
9+
# svelte/no-raw-special-elements
1010

11-
> Recommends not using raw special elements in Svelte versions previous to 5.
11+
> Checks for invalid raw HTML elements
1212
1313
- :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.
1414

1515
## :book: Rule Details
1616

17-
This rule reports the usage of `head`, `body`, `window`, `document`, `element` and `options` HTML elements. These elements were valid in in versions proior to 5, but since Svelte 5 they must be used with `svelte:`.
17+
This rule reports the usage of `head`, `body`, `window`, `document`, `element` and `options` HTML elements. These elements are not valid in Svelte, despite them working in versions previous to v5. Such elements must be prefixed with `svelte:`.
1818

1919
<!--eslint-skip-->
2020

2121
```svelte
2222
<script>
23-
/* eslint svelte/no-deprecated-raw-special-elements: "error" */
23+
/* eslint svelte/no-raw-special-elements: "error" */
2424
</script>
2525
2626
<!-- ✓ GOOD -->
@@ -48,5 +48,5 @@ This rule was introduced in eslint-plugin-svelte v3.0.0-next.1
4848

4949
## :mag: Implementation
5050

51-
- [Rule source](https://github.com/sveltejs/eslint-plugin-svelte/blob/main/packages/eslint-plugin-svelte/src/rules/no-deprecated-raw-special-elements.ts)
52-
- [Test source](https://github.com/sveltejs/eslint-plugin-svelte/blob/main/packages/eslint-plugin-svelte/tests/src/rules/no-deprecated-raw-special-elements.ts)
51+
- [Rule source](https://github.com/sveltejs/eslint-plugin-svelte/blob/main/packages/eslint-plugin-svelte/src/rules/no-raw-special-elements.ts)
52+
- [Test source](https://github.com/sveltejs/eslint-plugin-svelte/blob/main/packages/eslint-plugin-svelte/tests/src/rules/no-raw-special-elements.ts)

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ export interface RuleOptions {
104104
* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-at-html-tags/
105105
*/
106106
'svelte/no-at-html-tags'?: Linter.RuleEntry<[]>
107-
/**
108-
* Recommends not using raw special elements in Svelte versions previous to 5.
109-
* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-deprecated-raw-special-elements/
110-
*/
111-
'svelte/no-deprecated-raw-special-elements'?: Linter.RuleEntry<[]>
112107
/**
113108
* disallow DOM manipulating
114109
* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dom-manipulating/
@@ -195,6 +190,11 @@ export interface RuleOptions {
195190
* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches/
196191
*/
197192
'svelte/no-object-in-text-mustaches'?: Linter.RuleEntry<[]>
193+
/**
194+
* Checks for invalid raw HTML elements
195+
* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-raw-special-elements/
196+
*/
197+
'svelte/no-raw-special-elements'?: Linter.RuleEntry<[]>
198198
/**
199199
* it's not necessary to define functions in reactive statements
200200
* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-functions/

packages/eslint-plugin-svelte/src/rules/no-deprecated-raw-special-elements.ts renamed to packages/eslint-plugin-svelte/src/rules/no-raw-special-elements.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { createRule } from '../utils/index.js';
44
const INVALID_HTML_ELEMENTS = ['head', 'body', 'window', 'document', 'element', 'options'];
55
const VALID_PREFIX = 'svelte:';
66

7-
export default createRule('no-deprecated-raw-special-elements', {
7+
export default createRule('no-raw-special-elements', {
88
meta: {
99
docs: {
10-
description: 'Recommends not using raw special elements in Svelte versions previous to 5.',
10+
description: 'Checks for invalid raw HTML elements',
1111
category: 'Possible Errors',
1212
// TODO: Switch to recommended in the major version
1313
recommended: false

packages/eslint-plugin-svelte/src/utils/rules.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import maxAttributesPerLine from '../rules/max-attributes-per-line.js';
2020
import mustacheSpacing from '../rules/mustache-spacing.js';
2121
import noAtDebugTags from '../rules/no-at-debug-tags.js';
2222
import noAtHtmlTags from '../rules/no-at-html-tags.js';
23-
import noDeprecatedRawSpecialElements from '../rules/no-deprecated-raw-special-elements.js';
2423
import noDomManipulating from '../rules/no-dom-manipulating.js';
2524
import noDupeElseIfBlocks from '../rules/no-dupe-else-if-blocks.js';
2625
import noDupeOnDirectives from '../rules/no-dupe-on-directives.js';
@@ -38,6 +37,7 @@ import noInspect from '../rules/no-inspect.js';
3837
import noNavigationWithoutBase from '../rules/no-navigation-without-base.js';
3938
import noNotFunctionHandler from '../rules/no-not-function-handler.js';
4039
import noObjectInTextMustaches from '../rules/no-object-in-text-mustaches.js';
40+
import noRawSpecialElements from '../rules/no-raw-special-elements.js';
4141
import noReactiveFunctions from '../rules/no-reactive-functions.js';
4242
import noReactiveLiterals from '../rules/no-reactive-literals.js';
4343
import noReactiveReassign from '../rules/no-reactive-reassign.js';
@@ -91,7 +91,6 @@ export const rules = [
9191
mustacheSpacing,
9292
noAtDebugTags,
9393
noAtHtmlTags,
94-
noDeprecatedRawSpecialElements,
9594
noDomManipulating,
9695
noDupeElseIfBlocks,
9796
noDupeOnDirectives,
@@ -109,6 +108,7 @@ export const rules = [
109108
noNavigationWithoutBase,
110109
noNotFunctionHandler,
111110
noObjectInTextMustaches,
111+
noRawSpecialElements,
112112
noReactiveFunctions,
113113
noReactiveLiterals,
114114
noReactiveReassign,
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RuleTester } from '../../utils/eslint-compat.js';
2-
import rule from '../../../src/rules/no-deprecated-raw-special-elements.js';
2+
import rule from '../../../src/rules/no-raw-special-elements.js';
33
import { loadTestCases } from '../../utils/utils.js';
44

55
const tester = new RuleTester({
@@ -10,7 +10,7 @@ const tester = new RuleTester({
1010
});
1111

1212
tester.run(
13-
'no-deprecated-raw-special-elements',
13+
'no-raw-special-elements',
1414
rule as any,
15-
loadTestCases('no-deprecated-raw-special-elements')
15+
loadTestCases('no-raw-special-elements')
1616
);

0 commit comments

Comments
 (0)