Skip to content

Commit d3a5fd0

Browse files
committed
Merge branch 'main' into no-unused-class-name
2 parents e0334b5 + cd709fe commit d3a5fd0

File tree

124 files changed

+9531
-224
lines changed

Some content is hidden

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

124 files changed

+9531
-224
lines changed

.codesandbox/ci.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

.commitlintrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// "forwardPorts": [],
2727

2828
// Use 'postCreateCommand' to run commands after the container is created.
29-
"postCreateCommand": "yarn install",
29+
"postCreateCommand": "pnpm install",
3030

3131
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
3232
"remoteUser": "node"

.eslintrc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,24 @@ module.exports = {
113113
"@typescript-eslint/no-non-null-assertion": "off",
114114
},
115115
},
116+
{
117+
files: ["src/**"],
118+
rules: {
119+
"@typescript-eslint/no-restricted-imports": [
120+
"error",
121+
{
122+
patterns: [
123+
{
124+
group: ["@typescript-eslint/*"],
125+
message:
126+
"@typescript-eslint is not included in dependencies. Only type-import is allowed.",
127+
allowTypeImports: true,
128+
},
129+
],
130+
},
131+
],
132+
},
133+
},
116134
{
117135
files: ["src/rules/**"],
118136
rules: {},

.github/workflows/GHPages.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ jobs:
2525
steps:
2626
- name: Checkout
2727
uses: actions/checkout@v3
28+
- uses: pnpm/action-setup@v2
2829
- uses: actions/setup-node@v3
2930
- name: Install And Build
3031
run: |+
31-
yarn install
32-
yarn update
33-
yarn build
32+
pnpm install
33+
pnpm run update
34+
pnpm run build
3435
export NODE_OPTIONS="--max-old-space-size=8192"
35-
yarn docs:build
36+
pnpm run docs:build
3637
- name: Setup Pages
3738
uses: actions/configure-pages@v3
3839
- name: Upload artifact

.github/workflows/NodeCI.yml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,52 +11,71 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14+
- uses: pnpm/action-setup@v2
1415
- uses: actions/setup-node@v3
1516
- name: Install Packages
16-
run: yarn install
17+
run: pnpm install
1718
- name: Lint
1819
run: |+
19-
yarn build
20-
yarn lint
20+
pnpm run build
21+
pnpm run lint
2122
build:
2223
runs-on: ubuntu-latest
2324
steps:
2425
- uses: actions/checkout@v3
26+
- uses: pnpm/action-setup@v2
2527
- uses: actions/setup-node@v3
2628
- name: Install Packages
27-
run: yarn install
29+
run: pnpm install
2830
- name: Build
2931
run: |+
30-
yarn update
31-
yarn build
32+
pnpm run update
33+
pnpm run build
3234
test:
3335
name: "Test for ESLint ${{ matrix.eslint }} on ${{ matrix.node }} OS: ${{matrix.os}}"
3436
runs-on: ${{ matrix.os }}
3537
strategy:
3638
matrix:
3739
os: [ubuntu-latest]
3840
eslint: [7, 8]
39-
node: [14, 16, 17, 18]
41+
node: [14, 16, 17, 18, 20]
4042
steps:
4143
- name: Checkout
4244
uses: actions/checkout@v3
45+
- uses: pnpm/action-setup@v2
4346
- name: Setup Node.js ${{ matrix.node }}
4447
uses: actions/setup-node@v3
4548
with:
4649
node-version: ${{ matrix.node }}
4750
- name: Remove @sveltejs/kit # Remove @sveltejs/kit because postinstall fails on old node.
48-
# Use npm because yarn remove needs the lock file.
4951
run: |+
50-
npm uninstall @sveltejs/kit --legacy-peer-deps
52+
pnpm rm @sveltejs/kit
5153
rm -rf node_modules
5254
- name: Install ESLint ${{ matrix.eslint }}
5355
run: |+
54-
yarn add -D eslint@${{ matrix.eslint }} --ignore-engines
56+
pnpm install -D eslint@${{ matrix.eslint }}
5557
rm -rf node_modules
58+
rm -rf pnpm-lock.yaml
5659
if: matrix.eslint != 8
5760
- name: Install Packages
58-
run: yarn install --ignore-engines
61+
run: pnpm install
5962
- name: Test
60-
run: yarn test
63+
run: pnpm run test
6164
- name: Type Coverage
62-
run: yarn typecov
65+
run: pnpm run typecov
66+
update-resources:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v3
70+
- uses: pnpm/action-setup@v2
71+
- uses: actions/setup-node@v3
72+
with:
73+
node-version: 18
74+
- name: Install Packages
75+
run: pnpm install
76+
- name: Update resources
77+
run: pnpm run update
78+
- name: Check changes
79+
run: |
80+
git add --all && \
81+
git diff-index --cached HEAD --stat --exit-code

.github/workflows/Release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,25 @@ jobs:
2121
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
2222
fetch-depth: 0
2323

24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v2
26+
2427
- name: Setup Node.js 16
2528
uses: actions/setup-node@v3
2629
with:
2730
node-version: 16
2831

2932
- name: Install Dependencies
30-
run: yarn
33+
run: pnpm install
3134

3235
- name: Create Release Pull Request or Publish to npm
3336
id: changesets
3437
uses: changesets/action@v1
3538
with:
3639
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
37-
version: yarn version:ci
40+
version: pnpm run version:ci
3841
# This expects you to have a script called release which does a build for your packages and calls changeset publish
39-
publish: yarn release
42+
publish: pnpm run release
4043
commit: "chore: release eslint-plugin-svelte"
4144
title: "chore: release eslint-plugin-svelte"
4245
env:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ dist
101101
.tern-port
102102

103103
## repo
104-
/yarn.lock
104+
/pnpm-lock.yaml
105105
/lib
106106
/.svelte-kit
107107
/.type-coverage

.npmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
package-lock=false
1+
package-lock=false
2+
enable-pre-post-scripts=true

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.type-coverage
33
build
44
/lib
5+
.npmrc

.remarkrc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

.stylelintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
LICENSE
44
*.png
55
*.json
6+
*.js
7+
*.mjs
8+
*.ts
9+
*.mts
10+
*.tsx
611
*.lock
712
*.log
813
*.svg

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
# eslint-plugin-svelte
22

3+
## 2.29.0
4+
5+
### Minor Changes
6+
7+
- [#486](https://github.com/sveltejs/eslint-plugin-svelte/pull/486) [`011de46`](https://github.com/sveltejs/eslint-plugin-svelte/commit/011de46248d13425ed6a1afc45f8102d32505b4c) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency svelte-eslint-parser to ^0.29.0
8+
9+
## 2.28.0
10+
11+
### Minor Changes
12+
13+
- [#470](https://github.com/sveltejs/eslint-plugin-svelte/pull/470) [`6290345`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6290345134d6cc5ef7a0bbe4b437918e61794150) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency svelte-eslint-parser to ^0.28.0
14+
15+
- [#473](https://github.com/sveltejs/eslint-plugin-svelte/pull/473) [`6b71add`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6b71addc4a6963afcb6c861fc9190562a8ccbaf7) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/require-each-key` rule
16+
17+
- [#475](https://github.com/sveltejs/eslint-plugin-svelte/pull/475) [`abac19f`](https://github.com/sveltejs/eslint-plugin-svelte/commit/abac19f16c1a5c245034cad1d1e616905962f91f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/valid-each-key` rule
18+
19+
- [#467](https://github.com/sveltejs/eslint-plugin-svelte/pull/467) [`170f816`](https://github.com/sveltejs/eslint-plugin-svelte/commit/170f816bd733a45103bdc8e82cc8e4768498dd4b) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: export meta object
20+
21+
## 2.27.4
22+
23+
### Patch Changes
24+
25+
- [#465](https://github.com/sveltejs/eslint-plugin-svelte/pull/465) [`c8c98d4`](https://github.com/sveltejs/eslint-plugin-svelte/commit/c8c98d4dceca3a7bff56f6ea9558579bbc26be27) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for builtin `$$` vars in `svelte/no-immutable-reactive-statements`
26+
27+
- [#464](https://github.com/sveltejs/eslint-plugin-svelte/pull/464) [`fcb7226`](https://github.com/sveltejs/eslint-plugin-svelte/commit/fcb722663535a7d8b6b39ff438e48a5e850a6bc9) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for builtin `$$` vars in `svelte/prefer-destructured-store-props`
28+
29+
## 2.27.3
30+
31+
### Patch Changes
32+
33+
- [#461](https://github.com/sveltejs/eslint-plugin-svelte/pull/461) [`295091b`](https://github.com/sveltejs/eslint-plugin-svelte/commit/295091ba5808a4d2828d4cb4a6d6aaff36515b66) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: disable no-self-assign rule (take2)
34+
35+
## 2.27.2
36+
37+
### Patch Changes
38+
39+
- [#455](https://github.com/sveltejs/eslint-plugin-svelte/pull/455) [`bfd8a29`](https://github.com/sveltejs/eslint-plugin-svelte/commit/bfd8a296ff852b58ba11a4854e7815f8fc7d7443) Thanks [@baseballyama](https://github.com/baseballyama)! - disable `no-self-assign` rule in Svelte files
40+
41+
## 2.27.1
42+
43+
### Patch Changes
44+
45+
- [#451](https://github.com/sveltejs/eslint-plugin-svelte/pull/451) [`df9ed9e`](https://github.com/sveltejs/eslint-plugin-svelte/commit/df9ed9e98011a42275b143920b1dbdc500cb3fec) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: broken import when not using typescript-eslint
46+
47+
## 2.27.0
48+
49+
### Minor Changes
50+
51+
- [#439](https://github.com/sveltejs/eslint-plugin-svelte/pull/439) [`f810b69`](https://github.com/sveltejs/eslint-plugin-svelte/commit/f810b694e2b3bc1bad0daba8227bcd672a8cb454) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/no-immutable-reactive-statements` rule
52+
53+
- [#447](https://github.com/sveltejs/eslint-plugin-svelte/pull/447) [`9b5198c`](https://github.com/sveltejs/eslint-plugin-svelte/commit/9b5198c8c9606e50867c95a6bc2b5ae4fe948c8d) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency svelte-eslint-parser to ^0.27.0
54+
55+
- [#440](https://github.com/sveltejs/eslint-plugin-svelte/pull/440) [`ed68b20`](https://github.com/sveltejs/eslint-plugin-svelte/commit/ed68b205c2ff9c80237c06b453e9de3957a4f090) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/no-reactive-reassign` rule
56+
357
## 2.26.0
458

559
### Minor Changes

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Introduction
22

3-
`eslint-plugin-svelte` is [ESLint] plugin for [Svelte].
3+
`eslint-plugin-svelte` is the official [ESLint] plugin for [Svelte].
44
It provides many unique check rules by using the template AST.
55
You can check on the [Online DEMO](https://sveltejs.github.io/eslint-plugin-svelte/playground/).
66

@@ -23,12 +23,6 @@ You can check on the [Online DEMO](https://sveltejs.github.io/eslint-plugin-svel
2323
[ESLint] plugin for [Svelte].
2424
It provides many unique check rules using the AST generated by [svelte-eslint-parser].
2525

26-
### ❓ Why?
27-
28-
[Svelte] has the official [ESLint] plugin the [eslint-plugin-svelte3]. The [eslint-plugin-svelte3] works well enough to check scripts. However, it does not handle the AST of the template, which makes it very difficult for third parties to create their own the [ESLint] rules for the [Svelte].
29-
30-
The [svelte-eslint-parser] aims to make it easy to create your own rules for the [Svelte] by allowing the template AST to be used in the rules.
31-
3226
### ❗ Attention
3327

3428
The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3].
@@ -319,6 +313,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
319313
| [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 Svelte Kit page components. | |
320314
| [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: |
321315
| [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: |
316+
| [svelte/no-reactive-reassign](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-reassign/) | disallow reassigning reactive values | |
322317
| [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: |
323318
| [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 | |
324319
| [svelte/no-unknown-style-directive-property](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-unknown-style-directive-property/) | disallow unknown `style:property` | :star: |
@@ -345,15 +340,18 @@ These rules relate to better ways of doing things to help you avoid problems:
345340
| [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. | |
346341
| [svelte/button-has-type](https://sveltejs.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute | |
347342
| [svelte/no-at-debug-tags](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: |
343+
| [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. | |
348344
| [svelte/no-reactive-functions](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-functions/) | it's not necessary to define functions in reactive statements | :bulb: |
349345
| [svelte/no-reactive-literals](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-literals/) | don't assign literal values in reactive statements | :bulb: |
350346
| [svelte/no-unused-class-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-unused-class-name/) | disallow the use of a class in the template without a corresponding style | |
351347
| [svelte/no-unused-svelte-ignore](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/) | disallow unused svelte-ignore comments | :star: |
352348
| [svelte/no-useless-mustaches](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :wrench: |
353349
| [svelte/prefer-destructured-store-props](https://sveltejs.github.io/eslint-plugin-svelte/rules/prefer-destructured-store-props/) | destructure values from object stores for better change tracking & fewer redraws | :bulb: |
350+
| [svelte/require-each-key](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-each-key/) | require keyed `{#each}` block | |
354351
| [svelte/require-event-dispatcher-types](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-event-dispatcher-types/) | require type parameters for `createEventDispatcher` | |
355352
| [svelte/require-optimized-style-attribute](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-optimized-style-attribute/) | require style attributes that can be optimized | |
356353
| [svelte/require-stores-init](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-stores-init/) | require initial value in store | |
354+
| [svelte/valid-each-key](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-each-key/) | enforce keys to use variables defined in the `{#each}` block | |
357355

358356
## Stylistic Issues
359357

docs/README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: "eslint-plugin-svelte"
44

55
# Introduction
66

7-
`eslint-plugin-svelte` is [ESLint] plugin for [Svelte].
7+
`eslint-plugin-svelte` is the official [ESLint] plugin for [Svelte].
88
It provides many unique check rules by using the template AST.
99
You can check on the [Online DEMO](./playground.md).
1010

@@ -27,12 +27,6 @@ You can check on the [Online DEMO](./playground.md).
2727
[ESLint] plugin for [Svelte].
2828
It provides many unique check rules using the AST generated by [svelte-eslint-parser].
2929

30-
### ❓ Why?
31-
32-
[Svelte] has the official [ESLint] plugin the [eslint-plugin-svelte3]. The [eslint-plugin-svelte3] works well enough to check scripts. However, it does not handle the AST of the template, which makes it very difficult for third parties to create their own the [ESLint] rules for the [Svelte].
33-
34-
The [svelte-eslint-parser] aims to make it easy to create your own rules for the [Svelte] by allowing the template AST to be used in the rules.
35-
3630
### ❗ Attention
3731

3832
The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3].

docs/migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
You can not use both `eslint-plugin-svelte3` and `eslint-plugin-svelte` at same time.
66
So before start to use this plugin, you need to remove `eslint-plugin-svelte3`'s stuff from both `package.json` and `.eslintrc.*`.
77

8-
> Note: If you want to know difference between `eslint-plugin-svelte` and `eslint-plugin-svelte3`, Please read the [reason](../#why).
8+
> Note: If you want to know difference between `eslint-plugin-svelte` and `eslint-plugin-svelte3`, Please read the reason for deprecating `eslint-plugin-svelte3` in [eslint-plugin-svelte3 README](https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/README.md).
99
1010
> Note: If you're using TypeScript, maybe you get `Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.` error at some configuration files.<br>In this case, please refer [this GitHub comment](https://github.com/typescript-eslint/typescript-eslint/issues/1723#issuecomment-626766041) to solve it.
1111

0 commit comments

Comments
 (0)