Skip to content

Commit e5b9c53

Browse files
committed
Merge remote-tracking branch 'origin/main' into chore/no-export-load-in-svelte-module-in-kit-pages
2 parents 9baed6b + 568ef52 commit e5b9c53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+217
-85
lines changed

.changeset/hip-avocados-call.md

+5
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

+5
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/pre.json

+7-1
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

+5
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

.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`

.gitignore

+2
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

+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 | |
@@ -329,6 +328,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
329328
| [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-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: |
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: |
332332
| [svelte/no-reactive-reassign](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-reassign/) | disallow reassigning reactive values | |
333333
| [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: |
334334
| [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 | |
@@ -26,6 +25,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
2625
| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | disallow dynamic slot name | :star::wrench: |
2726
| [svelte/no-not-function-handler](./rules/no-not-function-handler.md) | disallow use of not function in event handler | :star: |
2827
| [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: |
2929
| [svelte/no-reactive-reassign](./rules/no-reactive-reassign.md) | disallow reassigning reactive values | |
3030
| [svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: |
3131
| [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/html-self-closing.md

+35-21
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

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)

package.json

+2-2
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": "[email protected].3",
7+
"packageManager": "[email protected].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",

packages/eslint-plugin-svelte/CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# eslint-plugin-svelte
22

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
26+
327
## 3.0.0-next.12
428

529
### Patch Changes

packages/eslint-plugin-svelte/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-svelte",
3-
"version": "3.0.0-next.12",
3+
"version": "3.0.0-next.14",
44
"description": "ESLint plugin for Svelte using AST",
55
"repository": "git+https://github.com/sveltejs/eslint-plugin-svelte.git",
66
"homepage": "https://sveltejs.github.io/eslint-plugin-svelte",
@@ -65,7 +65,7 @@
6565
"postcss-load-config": "^3.1.4",
6666
"postcss-safe-parser": "^7.0.0",
6767
"semver": "^7.6.3",
68-
"svelte-eslint-parser": "^1.0.0-next.8"
68+
"svelte-eslint-parser": "^1.0.0-next.10"
6969
},
7070
"devDependencies": {
7171
"@babel/core": "^7.26.0",

packages/eslint-plugin-svelte/src/meta.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// This file has been automatically generated,
33
// in order to update its content execute "pnpm run update"
44
export const name = 'eslint-plugin-svelte';
5-
export const version = '3.0.0-next.12';
5+
export const version = '3.0.0-next.14';

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

+7-6
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/
@@ -419,7 +419,8 @@ type SvelteHtmlQuotes = []|[{
419419
type SvelteHtmlSelfClosing = []|[({
420420
void?: ("never" | "always" | "ignore")
421421
normal?: ("never" | "always" | "ignore")
422-
foreign?: ("never" | "always" | "ignore")
422+
svg?: ("never" | "always" | "ignore")
423+
math?: ("never" | "always" | "ignore")
423424
component?: ("never" | "always" | "ignore")
424425
svelte?: ("never" | "always" | "ignore")
425426
} | ("all" | "html" | "none"))]

0 commit comments

Comments
 (0)