You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -320,7 +320,6 @@ These rules relate to possible syntax or logic errors in Svelte code:
320
320
| Rule ID | Description ||
321
321
|:--------|:------------|:---|
322
322
|[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:|
324
323
|[svelte/no-dom-manipulating](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dom-manipulating/)| disallow DOM manipulating ||
@@ -329,6 +328,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
329
328
|[svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/)| disallow dynamic slot name |:star::wrench:|
330
329
|[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:|
331
330
|[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:|
331
+
|[svelte/no-raw-special-elements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-raw-special-elements/)| Checks for invalid raw HTML elements |:wrench:|
|[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:|
334
334
|[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 ||
|[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
20
|[svelte/no-dom-manipulating](./rules/no-dom-manipulating.md)| disallow DOM manipulating ||
|[svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md)| disallow shorthand style properties that override related longhand properties |:star:|
31
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 ||
Copy file name to clipboardExpand all lines: docs/rules/html-self-closing.md
+35-21
Original file line number
Diff line number
Diff line change
@@ -14,10 +14,10 @@ since: 'v2.5.0'
14
14
15
15
## :book: Rule Details
16
16
17
-
You can choose either two styles for elements without content
17
+
You can choose either two styles for elements without content.
18
18
19
-
- always: `<div />`
20
-
- never: `<div></div>`
19
+
- always: `<SomeComponent />`
20
+
- never: `<SomeComponent></SomeComponent>`
21
21
22
22
<!-- prettier-ignore-start -->
23
23
<!--eslint-skip-->
@@ -28,18 +28,21 @@ You can choose either two styles for elements without content
28
28
</script>
29
29
30
30
<!-- ✓ GOOD -->
31
-
<div />
32
31
<p>Hello</p>
33
-
<div><div /></div>
32
+
<div></div>
34
33
<img />
35
34
<svelte:head />
35
+
<svg><path /></svg>
36
+
<math><msup></msup></math>
37
+
<SomeComponent />
36
38
37
39
<!-- ✗ BAD -->
38
-
<div></div>
39
-
<p> </p>
40
-
<div><div></div></div>
41
-
<img>
40
+
<div />
41
+
<div><div /></div>
42
42
<svelte:body></svelte:body>
43
+
<svg><path></path></svg>
44
+
<math><msup /></math>
45
+
<SomeComponent></SomeComponent>
43
46
```
44
47
45
48
<!-- prettier-ignore-end -->
@@ -52,7 +55,7 @@ presets:
52
55
{
53
56
"svelte/html-self-closing": [
54
57
"error",
55
-
"all"// or "html" or "none"
58
+
"default"// or "all" or "html" or "none"
56
59
]
57
60
}
58
61
```
@@ -65,8 +68,9 @@ config object:
65
68
"error",
66
69
{
67
70
"void":"always", // or "never" or "ignore"
68
-
"normal":"always", // or "never" or "ignore"
69
-
"foreign":"always", // or "never" or "ignore"
71
+
"normal":"never", // or "always" or "ignore"
72
+
"svg":"always", // or "never" or "ignore"
73
+
"never":"never", // or "always" or "ignore"
70
74
"component":"always", // or "never" or "ignore"
71
75
"svelte":"always"// or "never" or "ignore"
72
76
}
@@ -76,23 +80,33 @@ config object:
76
80
77
81
presets:
78
82
79
-
-`all` - all elements should be self closing (unless they have children)
80
-
-`html` - html-compliant - only void elements and svelte special elements should be self closing
81
-
-`none` - no elements should be self closing
83
+
-`default` - MathML and non-void HTML elements should have a closing tag; otherwise, they should be self-closing.
84
+
-`all` - all elements should be self-closing (unless they have children)
85
+
-`html` - html-compliant - only void elements and svelte special elements should be self-closing
86
+
-`none` - no elements should be self-closing
87
+
88
+
::: warning Note
89
+
We recommend selecting `default` as the preset. Choosing any other option may result in settings that are inconsistent with the compiler when using Svelte5.
90
+
:::
82
91
83
92
config object:
84
93
85
94
-`void` (`"always"` in default preset)... Style of HTML void elements
86
-
-`foreign` (`"always"` in default preset)... Style of foreign elements (SVG and MathML)
95
+
-`normal` (`"never"` in default preset)... Style of other elements
96
+
-`svg` (`"always"` in default preset)... Style of SVG
97
+
-`math` (`never` in default preset)... Style of MathML
87
98
-`component` (`"always"` in default preset)... Style of svelte components
88
99
-`svelte` (`"always"` in default preset)... Style of svelte special elements (`<svelte:head>`, `<svelte:self>`)
89
-
-`normal` (`"always"` in default preset)... Style of other elements
90
100
91
-
Every config oject option can be set to
101
+
::: warning
102
+
`foreign` is removed in `eslint-plugin-svelte` v3.
103
+
:::
104
+
105
+
Every config object option can be set to
92
106
93
-
- "always" (`<div />`)
94
-
- "never" (`<div></div>`)
95
-
- "ignore" (either `<div />` or `<div></div>`)
107
+
- "always" (`<SomeComponent />`)
108
+
- "never" (`<SomeComponent></SomeComponent>`)
109
+
- "ignore" (either `<SomeComponent />` or `<SomeComponent></SomeComponent>`)
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'
6
6
since: 'v3.0.0-next.1'
7
7
---
8
8
9
-
# svelte/no-deprecated-raw-special-elements
9
+
# svelte/no-raw-special-elements
10
10
11
-
> Recommends not using raw special elements in Svelte versions previous to 5.
11
+
> Checks for invalid raw HTML elements
12
12
13
13
-: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.
14
14
15
15
## :book: Rule Details
16
16
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:`.
Copy file name to clipboardExpand all lines: packages/eslint-plugin-svelte/CHANGELOG.md
+24
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,29 @@
1
1
# eslint-plugin-svelte
2
2
3
+
## 3.0.0-next.14
4
+
5
+
### Patch Changes
6
+
7
+
-[#1021](https://github.com/sveltejs/eslint-plugin-svelte/pull/1021)[`6557c69`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6557c69d7f3595cdf226e681cadf3d0df4c5d972) Thanks [@baseballyama](https://github.com/baseballyama)! - chore: update `svelte-eslint-parser` to `1.0.0-next.10`
8
+
9
+
## 3.0.0-next.13
10
+
11
+
### Major Changes
12
+
13
+
-[#982](https://github.com/sveltejs/eslint-plugin-svelte/pull/982)[`04fc429`](https://github.com/sveltejs/eslint-plugin-svelte/commit/04fc4292ef68134691ac1808fd92688bd9982d37) Thanks [@baseballyama](https://github.com/baseballyama)! - feat!: Updated the `html-self-closing` rule to follow Svelte5
14
+
15
+
### Minor Changes
16
+
17
+
-[#1015](https://github.com/sveltejs/eslint-plugin-svelte/pull/1015)[`8369eaf`](https://github.com/sveltejs/eslint-plugin-svelte/commit/8369eaf5d2e77fccf0ac9fb3f663d94a2b323a4f) Thanks [@mikededo](https://github.com/mikededo)! - fix!: rename `no-deprecated-raw-special-elements` to `no-raw-special-elements`
18
+
19
+
### Patch Changes
20
+
21
+
-[#1009](https://github.com/sveltejs/eslint-plugin-svelte/pull/1009)[`a003664`](https://github.com/sveltejs/eslint-plugin-svelte/commit/a0036643b5451f0423cd61dafd092c39bd6f4bcb) Thanks [@baseballyama](https://github.com/baseballyama)! - chore: upgrade `svelte-eslint-parser` to `1.0.0-next.8`
22
+
23
+
-[#1020](https://github.com/sveltejs/eslint-plugin-svelte/pull/1020)[`eae0e2e`](https://github.com/sveltejs/eslint-plugin-svelte/commit/eae0e2e52c2812ea630eea45e5be4f439191c806) Thanks [@baseballyama](https://github.com/baseballyama)! - chore: update `svelte-eslint-parser` to `1.0.0-next.9`
24
+
25
+
-[#1007](https://github.com/sveltejs/eslint-plugin-svelte/pull/1007)[`8e9199a`](https://github.com/sveltejs/eslint-plugin-svelte/commit/8e9199ae326110778e4b0557616d394c6ac5e847) Thanks [@baseballyama](https://github.com/baseballyama)! - fix: update method for extracting major version
0 commit comments