Skip to content

Commit 8fbcdaf

Browse files
committed
Merge remote-tracking branch 'origin/main' into chore/valid-prop-names-in-kit-pages
2 parents 284eb75 + 74373ec commit 8fbcdaf

40 files changed

+236
-90
lines changed

.changeset/grumpy-deers-film.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
chore: change the rule category of `no-export-load-in-svelte-module-in-kit-pages` to `SvelteKit`

.changeset/hip-avocados-call.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
chore: update `svelte-eslint-parser` to `1.0.0-next.10`

.changeset/olive-spiders-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
chore: update `svelte-eslint-parser` to `1.0.0-next.9`

.changeset/perfect-mirrors-doubt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
chore: do not run `no-reactive-reassign` rule on Svelte 5 with runes

.changeset/pre.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@
1010
"blue-swans-give",
1111
"cold-starfishes-doubt",
1212
"cool-rockets-allow",
13+
"cool-steaks-happen",
1314
"eighty-trainers-push",
1415
"fast-coins-fly",
1516
"fifty-parents-itch",
1617
"green-squids-compete",
18+
"hip-avocados-call",
1719
"hungry-grapes-shave",
1820
"itchy-dragons-boil",
1921
"lazy-eyes-wait",
2022
"loud-zoos-kiss",
2123
"nice-clocks-buy",
2224
"olive-melons-explain",
25+
"olive-spiders-type",
2326
"olive-wolves-travel",
2427
"quiet-toys-burn",
2528
"sixty-news-look",
2629
"small-days-agree",
2730
"small-donuts-end",
31+
"soft-bears-hear",
2832
"thick-items-retire",
29-
"twenty-nails-end"
33+
"thin-dryers-know",
34+
"twenty-nails-end",
35+
"two-students-pump"
3036
]
3137
}

.changeset/soft-bears-hear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': major
3+
---
4+
5+
feat!: Updated the `html-self-closing` rule to follow Svelte5

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,5 @@ docs-svelte-kit/build
113113
/docs-svelte-kit/src/routes/*.md
114114
/docs-svelte-kit/src/routes/**/*.md
115115
packages/eslint-plugin-svelte/README.md
116+
117+
**/.DS_Store

README.md

Lines changed: 1 addition & 1 deletion
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-style-properties](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-style-properties/) | disallow duplicate style properties | :star: |
327327
| [svelte/no-dupe-use-directives](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dupe-use-directives/) | disallow duplicate `use:` directives | |
328328
| [svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | disallow dynamic slot name | :star::wrench: |
329-
| [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. | |
330329
| [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: |
331330
| [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: |
332331
| [svelte/no-raw-special-elements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-raw-special-elements/) | Checks for invalid raw HTML elements | :wrench: |
@@ -415,6 +414,7 @@ These rules relate to SvelteKit and its best Practices.
415414

416415
| Rule ID | Description | |
417416
|:--------|:------------|:---|
417+
| [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. | |
418418
| [svelte/no-navigation-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-base/) | disallow using navigation (links, goto, pushState, replaceState) without the base path | |
419419
| [svelte/valid-prop-names-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-prop-names-in-kit-pages/) | disallow props other than data or errors in SvelteKit page components. | |
420420

docs/rules.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,25 @@ 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-dom-manipulating](./rules/no-dom-manipulating.md) | disallow DOM manipulating | |
21-
| [svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
22-
| [svelte/no-dupe-on-directives](./rules/no-dupe-on-directives.md) | disallow duplicate `on:` directives | |
23-
| [svelte/no-dupe-style-properties](./rules/no-dupe-style-properties.md) | disallow duplicate style properties | :star: |
24-
| [svelte/no-dupe-use-directives](./rules/no-dupe-use-directives.md) | disallow duplicate `use:` directives | |
25-
| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | disallow dynamic slot name | :star::wrench: |
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-raw-special-elements](./rules/no-raw-special-elements.md) | Checks for invalid raw HTML elements | :wrench: |
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: |
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-dom-manipulating](./rules/no-dom-manipulating.md) | disallow DOM manipulating | |
21+
| [svelte/no-dupe-else-if-blocks](./rules/no-dupe-else-if-blocks.md) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: |
22+
| [svelte/no-dupe-on-directives](./rules/no-dupe-on-directives.md) | disallow duplicate `on:` directives | |
23+
| [svelte/no-dupe-style-properties](./rules/no-dupe-style-properties.md) | disallow duplicate style properties | :star: |
24+
| [svelte/no-dupe-use-directives](./rules/no-dupe-use-directives.md) | disallow duplicate `use:` directives | |
25+
| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | disallow dynamic slot name | :star::wrench: |
26+
| [svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | :star: |
27+
| [svelte/no-object-in-text-mustaches](./rules/no-object-in-text-mustaches.md) | disallow objects in text mustache interpolation | :star: |
28+
| [svelte/no-raw-special-elements](./rules/no-raw-special-elements.md) | Checks for invalid raw HTML elements | :wrench: |
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: |
3736

3837
## Security Vulnerability
3938

@@ -110,10 +109,11 @@ These rules extend the rules provided by ESLint itself, or other plugins to work
110109

111110
These rules relate to SvelteKit and its best Practices.
112111

113-
| Rule ID | Description | |
114-
| :------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------- | :-- |
115-
| [svelte/no-navigation-without-base](./rules/no-navigation-without-base.md) | disallow using navigation (links, goto, pushState, replaceState) without the base path | |
116-
| [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. | |
112+
| Rule ID | Description | |
113+
| :------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------- | :-- |
114+
| [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. | |
115+
| [svelte/no-navigation-without-base](./rules/no-navigation-without-base.md) | disallow using navigation (links, goto, pushState, replaceState) without the base path | |
116+
| [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. | |
117117

118118
## Experimental
119119

docs/rules/html-self-closing.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ since: 'v2.5.0'
1414

1515
## :book: Rule Details
1616

17-
You can choose either two styles for elements without content
17+
You can choose either two styles for elements without content.
1818

19-
- always: `<div />`
20-
- never: `<div></div>`
19+
- always: `<SomeComponent />`
20+
- never: `<SomeComponent></SomeComponent>`
2121

2222
<!-- prettier-ignore-start -->
2323
<!--eslint-skip-->
@@ -28,18 +28,21 @@ You can choose either two styles for elements without content
2828
</script>
2929
3030
<!-- ✓ GOOD -->
31-
<div />
3231
<p>Hello</p>
33-
<div><div /></div>
32+
<div></div>
3433
<img />
3534
<svelte:head />
35+
<svg><path /></svg>
36+
<math><msup></msup></math>
37+
<SomeComponent />
3638
3739
<!-- ✗ BAD -->
38-
<div></div>
39-
<p> </p>
40-
<div><div></div></div>
41-
<img>
40+
<div />
41+
<div><div /></div>
4242
<svelte:body></svelte:body>
43+
<svg><path></path></svg>
44+
<math><msup /></math>
45+
<SomeComponent></SomeComponent>
4346
```
4447

4548
<!-- prettier-ignore-end -->
@@ -52,7 +55,7 @@ presets:
5255
{
5356
"svelte/html-self-closing": [
5457
"error",
55-
"all" // or "html" or "none"
58+
"default" // or "all" or "html" or "none"
5659
]
5760
}
5861
```
@@ -65,8 +68,9 @@ config object:
6568
"error",
6669
{
6770
"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"
7074
"component": "always", // or "never" or "ignore"
7175
"svelte": "always" // or "never" or "ignore"
7276
}
@@ -76,23 +80,33 @@ config object:
7680

7781
presets:
7882

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+
:::
8291

8392
config object:
8493

8594
- `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
8798
- `component` (`"always"` in default preset)... Style of svelte components
8899
- `svelte` (`"always"` in default preset)... Style of svelte special elements (`<svelte:head>`, `<svelte:self>`)
89-
- `normal` (`"always"` in default preset)... Style of other elements
90100

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
92106

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>`)
96110

97111
## :rocket: Version
98112

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"license": "MIT",
66
"funding": "https://github.com/sponsors/ota-meshi",
7-
"packageManager": "pnpm@9.15.3",
7+
"packageManager": "pnpm@9.15.4",
88
"scripts": {
99
"prerelease": "cd packages/eslint-plugin-svelte && pnpm clean && pnpm run build && cd ../.. && cp README.md packages/eslint-plugin-svelte",
1010
"release": "changeset publish",
@@ -25,7 +25,7 @@
2525
"c8": "^10.1.2",
2626
"env-cmd": "^10.1.0",
2727
"eslint": "~9.18.0",
28-
"eslint-config-prettier": "^9.1.0",
28+
"eslint-config-prettier": "^10.0.0",
2929
"eslint-formatter-friendly": "^7.0.0",
3030
"eslint-plugin-eslint-plugin": "^6.3.2",
3131
"eslint-plugin-jsdoc": "^50.6.0",

0 commit comments

Comments
 (0)