Skip to content

Commit 2f5b83c

Browse files
authored
Merge branch 'main' into consistent-selector-style-dynamic-values
2 parents 2ea7ba7 + 73f23ae commit 2f5b83c

File tree

132 files changed

+2427
-405
lines changed

Some content is hidden

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

132 files changed

+2427
-405
lines changed

.changeset/rich-dogs-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': minor
3+
---
4+
5+
feat: added the `require-event-prefix` rule

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
indent_size = 2
6+
indent_style = tab
7+
trim_trailing_whitespace = true

.github/workflows/GHPages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- name: Checkout
2828
uses: actions/checkout@v4
29-
- uses: pnpm/action-setup@v2
29+
- uses: pnpm/action-setup@v4
3030
- uses: actions/setup-node@v4
3131
- name: Install And Build
3232
run: |

.github/workflows/NodeCI.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
17-
- uses: pnpm/action-setup@v2
17+
- uses: pnpm/action-setup@v4
1818
- uses: actions/setup-node@v4
1919
- name: Install Packages
2020
run: pnpm install
@@ -36,7 +36,7 @@ jobs:
3636
runs-on: ubuntu-latest
3737
steps:
3838
- uses: actions/checkout@v4
39-
- uses: pnpm/action-setup@v2
39+
- uses: pnpm/action-setup@v4
4040
- uses: actions/setup-node@v4
4141
- name: Install Packages
4242
run: pnpm install
@@ -57,7 +57,7 @@ jobs:
5757
steps:
5858
- name: Checkout
5959
uses: actions/checkout@v4
60-
- uses: pnpm/action-setup@v2
60+
- uses: pnpm/action-setup@v4
6161
- name: Setup Node.js ${{ matrix.node }}
6262
uses: actions/setup-node@v4
6363
with:
@@ -90,7 +90,7 @@ jobs:
9090
steps:
9191
- name: Checkout
9292
uses: actions/checkout@v4
93-
- uses: pnpm/action-setup@v2
93+
- uses: pnpm/action-setup@v4
9494
- name: Setup Node.js ${{ matrix.node }}
9595
uses: actions/setup-node@v4
9696
with:
@@ -120,7 +120,7 @@ jobs:
120120
steps:
121121
- name: Checkout
122122
uses: actions/checkout@v4
123-
- uses: pnpm/action-setup@v2
123+
- uses: pnpm/action-setup@v4
124124
- name: Setup Node.js ${{ matrix.node }}
125125
uses: actions/setup-node@v4
126126
with:
@@ -143,7 +143,7 @@ jobs:
143143
runs-on: ubuntu-latest
144144
steps:
145145
- uses: actions/checkout@v4
146-
- uses: pnpm/action-setup@v2
146+
- uses: pnpm/action-setup@v4
147147
- uses: actions/setup-node@v4
148148
- name: Install Packages
149149
run: pnpm install

.github/workflows/Release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fetch-depth: 0
2323

2424
- name: Setup pnpm
25-
uses: pnpm/action-setup@v2
25+
uses: pnpm/action-setup@v4
2626

2727
- name: Setup Node.js
2828
uses: actions/setup-node@v4

.github/workflows/pkg.pr.new.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: pnpm/action-setup@v2
16+
- uses: pnpm/action-setup@v4
1717
- uses: actions/setup-node@v4
1818
- name: Install Packages
1919
run: pnpm install

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
272272
| [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: |
273273
| [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 | :star: |
274274
| [svelte/no-unknown-style-directive-property](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-unknown-style-directive-property/) | disallow unknown `style:property` | :star: |
275-
| [svelte/require-store-callbacks-use-set-param](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-store-callbacks-use-set-param/) | store callbacks must use `set` param | |
275+
| [svelte/require-store-callbacks-use-set-param](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-store-callbacks-use-set-param/) | store callbacks must use `set` param | :bulb: |
276276
| [svelte/require-store-reactive-access](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-store-reactive-access/) | disallow to use of the store itself as an operand. Need to use $ prefix or get function. | :star::wrench: |
277277
| [svelte/valid-compile](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-compile/) | disallow warnings when compiling. | |
278278
| [svelte/valid-style-parse](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-style-parse/) | require valid style element parsing | |
@@ -294,7 +294,7 @@ These rules relate to better ways of doing things to help you avoid problems:
294294
|:--------|:------------|:---|
295295
| [svelte/block-lang](https://sveltejs.github.io/eslint-plugin-svelte/rules/block-lang/) | disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks. | :bulb: |
296296
| [svelte/button-has-type](https://sveltejs.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute | |
297-
| [svelte/no-at-debug-tags](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: |
297+
| [svelte/no-at-debug-tags](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star::bulb: |
298298
| [svelte/no-ignored-unsubscribe](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-ignored-unsubscribe/) | disallow ignoring the unsubscribe method returned by the `subscribe()` on Svelte stores. | |
299299
| [svelte/no-immutable-reactive-statements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-immutable-reactive-statements/) | disallow reactive statements that don't reference reactive values. | :star: |
300300
| [svelte/no-inline-styles](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-inline-styles/) | disallow attributes and directives that produce inline styles | |
@@ -323,7 +323,7 @@ These rules relate to style guidelines, and are therefore quite subjective:
323323
| Rule ID | Description | |
324324
|:--------|:------------|:---|
325325
| [svelte/consistent-selector-style](https://sveltejs.github.io/eslint-plugin-svelte/rules/consistent-selector-style/) | enforce a consistent style for CSS selectors | |
326-
| [svelte/derived-has-same-inputs-outputs](https://sveltejs.github.io/eslint-plugin-svelte/rules/derived-has-same-inputs-outputs/) | derived store should use same variable names between values and callback | |
326+
| [svelte/derived-has-same-inputs-outputs](https://sveltejs.github.io/eslint-plugin-svelte/rules/derived-has-same-inputs-outputs/) | derived store should use same variable names between values and callback | :bulb: |
327327
| [svelte/first-attribute-linebreak](https://sveltejs.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak/) | enforce the location of first attribute | :wrench: |
328328
| [svelte/html-closing-bracket-new-line](https://sveltejs.github.io/eslint-plugin-svelte/rules/html-closing-bracket-new-line/) | Require or disallow a line break before tag's closing brackets | :wrench: |
329329
| [svelte/html-closing-bracket-spacing](https://sveltejs.github.io/eslint-plugin-svelte/rules/html-closing-bracket-spacing/) | require or disallow a space before tag's closing brackets | :wrench: |
@@ -337,6 +337,7 @@ These rules relate to style guidelines, and are therefore quite subjective:
337337
| [svelte/no-spaces-around-equal-signs-in-attribute](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-spaces-around-equal-signs-in-attribute/) | disallow spaces around equal signs in attribute | :wrench: |
338338
| [svelte/prefer-class-directive](https://sveltejs.github.io/eslint-plugin-svelte/rules/prefer-class-directive/) | require class directives instead of ternary expressions | :wrench: |
339339
| [svelte/prefer-style-directive](https://sveltejs.github.io/eslint-plugin-svelte/rules/prefer-style-directive/) | require style directives instead of style attribute | :wrench: |
340+
| [svelte/require-event-prefix](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-event-prefix/) | require component event names to start with "on" | |
340341
| [svelte/shorthand-attribute](https://sveltejs.github.io/eslint-plugin-svelte/rules/shorthand-attribute/) | enforce use of shorthand syntax in attribute | :wrench: |
341342
| [svelte/shorthand-directive](https://sveltejs.github.io/eslint-plugin-svelte/rules/shorthand-directive/) | enforce use of shorthand syntax in directives | :wrench: |
342343
| [svelte/sort-attributes](https://sveltejs.github.io/eslint-plugin-svelte/rules/sort-attributes/) | enforce order of attributes | :wrench: |

docs/rules.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
2929
| [svelte/no-shorthand-style-property-overrides](./rules/no-shorthand-style-property-overrides.md) | disallow shorthand style properties that override related longhand properties | :star: |
3030
| [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 | :star: |
3131
| [svelte/no-unknown-style-directive-property](./rules/no-unknown-style-directive-property.md) | disallow unknown `style:property` | :star: |
32-
| [svelte/require-store-callbacks-use-set-param](./rules/require-store-callbacks-use-set-param.md) | store callbacks must use `set` param | |
32+
| [svelte/require-store-callbacks-use-set-param](./rules/require-store-callbacks-use-set-param.md) | store callbacks must use `set` param | :bulb: |
3333
| [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. | :star::wrench: |
3434
| [svelte/valid-compile](./rules/valid-compile.md) | disallow warnings when compiling. | |
3535
| [svelte/valid-style-parse](./rules/valid-style-parse.md) | require valid style element parsing | |
@@ -51,7 +51,7 @@ These rules relate to better ways of doing things to help you avoid problems:
5151
| :--------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :------------- |
5252
| [svelte/block-lang](./rules/block-lang.md) | disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks. | :bulb: |
5353
| [svelte/button-has-type](./rules/button-has-type.md) | disallow usage of button without an explicit type attribute | |
54-
| [svelte/no-at-debug-tags](./rules/no-at-debug-tags.md) | disallow the use of `{@debug}` | :star: |
54+
| [svelte/no-at-debug-tags](./rules/no-at-debug-tags.md) | disallow the use of `{@debug}` | :star::bulb: |
5555
| [svelte/no-ignored-unsubscribe](./rules/no-ignored-unsubscribe.md) | disallow ignoring the unsubscribe method returned by the `subscribe()` on Svelte stores. | |
5656
| [svelte/no-immutable-reactive-statements](./rules/no-immutable-reactive-statements.md) | disallow reactive statements that don't reference reactive values. | :star: |
5757
| [svelte/no-inline-styles](./rules/no-inline-styles.md) | disallow attributes and directives that produce inline styles | |
@@ -80,7 +80,7 @@ These rules relate to style guidelines, and are therefore quite subjective:
8080
| Rule ID | Description | |
8181
| :------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | :------- |
8282
| [svelte/consistent-selector-style](./rules/consistent-selector-style.md) | enforce a consistent style for CSS selectors | |
83-
| [svelte/derived-has-same-inputs-outputs](./rules/derived-has-same-inputs-outputs.md) | derived store should use same variable names between values and callback | |
83+
| [svelte/derived-has-same-inputs-outputs](./rules/derived-has-same-inputs-outputs.md) | derived store should use same variable names between values and callback | :bulb: |
8484
| [svelte/first-attribute-linebreak](./rules/first-attribute-linebreak.md) | enforce the location of first attribute | :wrench: |
8585
| [svelte/html-closing-bracket-new-line](./rules/html-closing-bracket-new-line.md) | Require or disallow a line break before tag's closing brackets | :wrench: |
8686
| [svelte/html-closing-bracket-spacing](./rules/html-closing-bracket-spacing.md) | require or disallow a space before tag's closing brackets | :wrench: |
@@ -94,6 +94,7 @@ These rules relate to style guidelines, and are therefore quite subjective:
9494
| [svelte/no-spaces-around-equal-signs-in-attribute](./rules/no-spaces-around-equal-signs-in-attribute.md) | disallow spaces around equal signs in attribute | :wrench: |
9595
| [svelte/prefer-class-directive](./rules/prefer-class-directive.md) | require class directives instead of ternary expressions | :wrench: |
9696
| [svelte/prefer-style-directive](./rules/prefer-style-directive.md) | require style directives instead of style attribute | :wrench: |
97+
| [svelte/require-event-prefix](./rules/require-event-prefix.md) | require component event names to start with "on" | |
9798
| [svelte/shorthand-attribute](./rules/shorthand-attribute.md) | enforce use of shorthand syntax in attribute | :wrench: |
9899
| [svelte/shorthand-directive](./rules/shorthand-directive.md) | enforce use of shorthand syntax in directives | :wrench: |
99100
| [svelte/sort-attributes](./rules/sort-attributes.md) | enforce order of attributes | :wrench: |

docs/rules/derived-has-same-inputs-outputs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ since: 'v2.8.0'
1010

1111
> derived store should use same variable names between values and callback
1212
13+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
14+
1315
## :book: Rule Details
1416

1517
This rule reports where variable names and callback function's argument names are different.

docs/rules/no-at-debug-tags.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ since: 'v0.0.1'
1111
> disallow the use of `{@debug}`
1212
1313
- :gear: This rule is included in `"plugin:svelte/recommended"`.
14+
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
1415

1516
## :book: Rule Details
1617

docs/rules/no-at-html-tags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ If you are certain the content passed to `{@html}` is sanitized HTML you can dis
4040

4141
## :books: Further Reading
4242

43-
- [Svelte - Tutorial > 1. Introduction / HTML tags](https://svelte.dev/tutorial/html-tags)
43+
- [Svelte - Tutorial > Basic Svelte / Introduction / HTML tags](https://svelte.dev/tutorial/svelte/html-tags)
4444

4545
## :rocket: Version
4646

docs/rules/no-unused-props.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,16 @@ Note: Properties of class types are not checked for usage, as they might be used
163163
"ignoreTypePatterns": [],
164164
// Patterns to ignore when checking for unused props
165165
"ignorePropertyPatterns": [],
166+
// Whether to allow unused nested properties
167+
"allowUnusedNestedProperties": false
166168
}]
167169
}
168170
```
169171

170172
- `checkImportedTypes` ... Controls whether to check properties from types defined in external files. Default is `false`, meaning the rule only checks types defined within the component file itself. When set to `true`, the rule will also check properties from imported and extended types.
171173
- `ignoreTypePatterns` ... Regular expression patterns for type names to exclude from checks. Default is `[]` (no exclusions). Most useful when `checkImportedTypes` is `true`, allowing you to exclude specific imported types (like utility types or third-party types) from being checked.
172174
- `ignorePropertyPatterns` ... Regular expression patterns for property names to exclude from unused checks. Default is `[]` (no exclusions). Most useful when `checkImportedTypes` is `true`, allowing you to ignore specific properties from external types that shouldn't trigger warnings.
175+
- `allowUnusedNestedProperties` ... Controls whether to allow unused nested properties. Default is `false`, meaning the rule will report unused properties from nested objects.
173176

174177
Examples:
175178

@@ -219,6 +222,21 @@ Examples:
219222
</script>
220223
```
221224

225+
```svelte
226+
<!-- ✓ Good Example with allowUnusedNestedProperties: true -->
227+
<script lang="ts">
228+
/* eslint svelte/no-unused-props: ["error", { "allowUnusedNestedProperties": true }] */
229+
interface Props {
230+
user: {
231+
name: string;
232+
age: number; // Won't be reported as unused
233+
};
234+
}
235+
let { user }: Props = $props();
236+
console.log(user.name);
237+
</script>
238+
```
239+
222240
## :gear: Required Configuration
223241

224242
This rule requires `@typescript-eslint/parser` to work. Please refer to the [User Guide](../user-guide.md) for more information.

docs/rules/prefer-class-directive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ You cannot enforce this style by using [prettier-plugin-svelte]. That is, this r
6262

6363
## :books: Further Reading
6464

65-
- [Svelte - Tutorial > 13. Classes / The class directive](https://svelte.dev/tutorial/classes)
65+
- [Svelte - Tutorial > Basic Svelte / Classes and styles / The class atribute](https://svelte.dev/tutorial/svelte/classes)
6666

6767
## :rocket: Version
6868

docs/rules/require-each-key.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Nothing.
4444

4545
## :books: Further Reading
4646

47-
- [Svelte - Tutorial > 4. Logic / Keyed each blocks](https://svelte.dev/tutorial/svelte/keyed-each-blocks)
47+
- [Svelte - Tutorial > Basic Svelte / Logic / Keyed each blocks](https://svelte.dev/tutorial/svelte/keyed-each-blocks)
4848

4949
## :rocket: Version
5050

0 commit comments

Comments
 (0)