diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..d4479bea2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +end_of_line = lf +indent_size = 2 +indent_style = tab +trim_trailing_whitespace = true diff --git a/.env-cmdrc.js b/.env-cmdrc.js deleted file mode 100644 index 3261880a7..000000000 --- a/.env-cmdrc.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -module.exports = { - version: { - IN_VERSION_SCRIPT: 'true' - }, - 'version-ci': { - IN_VERSION_CI_SCRIPT: 'true' - }, - debug: { - DEBUG: 'eslint-plugin-svelte*' - }, - 'update-fixtures': { - UPDATE_FIXTURES: 'true' - }, - sveltekit: { - NODE_OPTIONS: `--import ./svelte-kit-import.mjs ${ - // eslint-disable-next-line no-process-env -- ignore - process.env.NODE_OPTIONS || '' - }` - } -}; diff --git a/.env-cmdrc.json b/.env-cmdrc.json new file mode 100644 index 000000000..b860db924 --- /dev/null +++ b/.env-cmdrc.json @@ -0,0 +1,14 @@ +{ + "version": { + "IN_VERSION_SCRIPT": "true" + }, + "version-ci": { + "IN_VERSION_CI_SCRIPT": "true" + }, + "debug": { + "DEBUG": "eslint-plugin-svelte*" + }, + "update-fixtures": { + "UPDATE_FIXTURES": "true" + } +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index f99c08e96..810b1ca88 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,5 +1,7 @@ # These are supported funding model platforms +open_collective: svelte github: [ota-meshi, JounQin] -open_collective: rxts patreon: 1stG +custom: + - https://opencollective.com/rxts diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 71b3c970b..ce9bdc71a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -79,7 +79,7 @@ body: placeholder: | https://github.com/[your]/[repo] or - https://sveltejs.github.io/eslint-plugin-svelte/playground/#[hash] + https://eslint-online-playground.netlify.app/#[hash] validations: required: true - type: textarea diff --git a/.github/workflows/GHPages.yml b/.github/workflows/GHPages.yml index d002776e9..ac8f0c329 100644 --- a/.github/workflows/GHPages.yml +++ b/.github/workflows/GHPages.yml @@ -18,6 +18,7 @@ concurrency: jobs: deploy: + if: github.repository == 'sveltejs/eslint-plugin-svelte' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -25,7 +26,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install And Build run: | diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index 0c82d3a9f..3b442aa7b 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install Packages run: pnpm install @@ -36,7 +36,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - name: Install Packages run: pnpm install @@ -52,12 +52,12 @@ jobs: strategy: matrix: os: [ubuntu-latest] - eslint: [7, 8, 9] - node: [20] + eslint: [8, 9] + node: [18.x, 20.x, 22.x, latest] steps: - name: Checkout uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 - name: Setup Node.js ${{ matrix.node }} uses: actions/setup-node@v4 with: @@ -87,18 +87,10 @@ jobs: os: [ubuntu-latest] eslint: [9] node: [18, 20, 22] - include: - # On old Node.js version - - eslint: 8 - node: 16 - os: ubuntu-latest - - eslint: 8 - node: 17 - os: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 - name: Setup Node.js ${{ matrix.node }} uses: actions/setup-node@v4 with: @@ -124,23 +116,18 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [14] + node: [18] steps: - name: Checkout uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 - name: Setup Node.js ${{ matrix.node }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Install svelte@3 - # Remove @sveltejs/kit because postinstall fails on old node. run: | - cd docs-svelte-kit - pnpm rm @sveltejs/kit - cd .. - pnpm install -D -w @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5 eslint@8 - cd packages/eslint-plugin-svelte + cd ./packages/eslint-plugin-svelte pnpm install -D svelte@3 cd ../.. rm -rf packages/eslint-plugin-svelte/node_modules @@ -152,39 +139,12 @@ jobs: run: pnpm run test working-directory: ${{ env.project_root_path }} - test-for-typescript-eslint-v5: - name: Test for typescript-eslint v5 - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - node: [18] - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 - - name: Setup Node.js ${{ matrix.node }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - name: Install typescript-eslint v5 - run: | - pnpm install -D -w @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5 - rm -rf node_modules - - name: Install Packages - run: pnpm install - - name: Test - run: pnpm run test - working-directory: ${{ env.project_root_path }} - update-resources: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 - with: - node-version: 18 - name: Install Packages run: pnpm install - name: Update resources diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 7e1949ff0..0625bea8a 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -22,7 +22,7 @@ jobs: fetch-depth: 0 - name: Setup pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/pkg.pr.new-comment.yml b/.github/workflows/pkg.pr.new-comment.yml new file mode 100644 index 000000000..277168f72 --- /dev/null +++ b/.github/workflows/pkg.pr.new-comment.yml @@ -0,0 +1,36 @@ +name: Update pkg.pr.new comment + +on: + workflow_run: + workflows: ['Publish to pkg.pr.new'] + types: + - completed + +permissions: + issues: write + pull-requests: write + +jobs: + build: + if: github.repository == 'sveltejs/eslint-plugin-svelte' + name: 'Update comment' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: output + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + - run: ls -R . + - name: 'Post or update comment' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); + const { default: process } = await import('${{ github.workspace }}/tools/pkg.pr.new-comment.mjs') + + await process({github, context, core, output}) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml new file mode 100644 index 000000000..6f2fa51cc --- /dev/null +++ b/.github/workflows/pkg.pr.new.yml @@ -0,0 +1,43 @@ +name: Publish to pkg.pr.new +on: + pull_request: + branches: [main] + push: + branches: [main] + tags: ['!**'] + +jobs: + build: + if: github.repository == 'sveltejs/eslint-plugin-svelte' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + - name: Install Packages + run: pnpm install + - name: Build + run: pnpm run build + - run: pnpx pkg-pr-new publish --compact './packages/eslint-plugin-svelte' --json output.json --comment=off + - name: Add metadata to output + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); + output.number = context.issue.number; + output.event_name = context.eventName; + output.ref = context.ref; + output.sha = context.eventName === 'pull_request' + ? context.payload.pull_request.head.sha + : context.payload.after; + fs.writeFileSync('output.json', JSON.stringify(output), 'utf8'); + - name: Upload output + uses: actions/upload-artifact@v4 + with: + name: output + path: ./output.json + + - run: ls -R . diff --git a/.gitignore b/.gitignore index 5f1159039..ca0ac5061 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,6 @@ docs-svelte-kit/build /docs-svelte-kit/shim/assert.mjs /docs-svelte-kit/src/routes/*.md /docs-svelte-kit/src/routes/**/*.md +packages/eslint-plugin-svelte/README.md + +**/.DS_Store diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..26c178765 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["rvest.vs-code-prettier-eslint"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 9c214fd5a..04456da0f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,8 @@ "source.fixAll.stylelint": "explicit" }, "svelte.plugin.typescript.diagnostics.enable": false, - "typescript.tsdk": "node_modules/typescript/lib" + "typescript.tsdk": "node_modules/typescript/lib", + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } } diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index e940c1079..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,527 +0,0 @@ -# eslint-plugin-svelte - -## 2.39.0 - -### Minor Changes - -- [#749](https://github.com/sveltejs/eslint-plugin-svelte/pull/749) [`da4d535`](https://github.com/sveltejs/eslint-plugin-svelte/commit/da4d5357344805ef4e95aac681c2c58158199b8e) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: add `svelte/no-svelte-internal` rule - -- [#758](https://github.com/sveltejs/eslint-plugin-svelte/pull/758) [`6ee50c8`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6ee50c8b0d8e183cf0e3c974e3b3b131007a5a30) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: Update svelte-eslint-parser to 0.36 - -## 2.38.0 - -### Minor Changes - -- [#741](https://github.com/sveltejs/eslint-plugin-svelte/pull/741) [`33626a3`](https://github.com/sveltejs/eslint-plugin-svelte/commit/33626a3444cc6bd5a1789b0043ea5799b81711d1) Thanks [@baseballyama](https://github.com/baseballyama)! - Use the latest Svelte 5 - -## 2.37.0 - -### Minor Changes - -- [#735](https://github.com/sveltejs/eslint-plugin-svelte/pull/735) [`33f0de2`](https://github.com/sveltejs/eslint-plugin-svelte/commit/33f0de261636e0dca77ec0479fa93a988e6ca950) Thanks [@xiBread](https://github.com/xiBread)! - feat: add rule types - -## 2.36.0 - -### Minor Changes - -- Add experimental support for Svelte v5 - - [#622](https://github.com/sveltejs/eslint-plugin-svelte/pull/622) [`470ef6c`](https://github.com/sveltejs/eslint-plugin-svelte/commit/470ef6cd1ef4767528ff15b5fbdfec1740a5ec02) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for `{@snippet}`and `{@render}` in indent rule - - [#620](https://github.com/sveltejs/eslint-plugin-svelte/pull/620) [`1097107`](https://github.com/sveltejs/eslint-plugin-svelte/commit/1097107afce00fd8b959261b015a4eb1f39f116d) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: (experimental) partial support for Svelte v5 - - [#624](https://github.com/sveltejs/eslint-plugin-svelte/pull/624) [`7df5b6f`](https://github.com/sveltejs/eslint-plugin-svelte/commit/7df5b6f0963f1fb8fc9256f8ed6f034e5f7fbf3d) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for `{@snippet}` and `{@render}` in mustache-spacing rule - - Update parser and svelte(v5) - - [#657](https://github.com/sveltejs/eslint-plugin-svelte/pull/657) [`b159b46`](https://github.com/sveltejs/eslint-plugin-svelte/commit/b159b467427aab17c74246f9b89283aa966bb2e4) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update svelte to v5.0.0-next.33 - - [#704](https://github.com/sveltejs/eslint-plugin-svelte/pull/704) [`af2ccf9`](https://github.com/sveltejs/eslint-plugin-svelte/commit/af2ccf9f85af00221f9ec10efbc770cba5615a62) Thanks [@ota-meshi](https://github.com/ota-meshi)! - Update svelte-eslint-parser - - [#693](https://github.com/sveltejs/eslint-plugin-svelte/pull/693) [`b11ff34`](https://github.com/sveltejs/eslint-plugin-svelte/commit/b11ff34de949f778d9344ec1143d1a636864d95b) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update dependencies & some fixes - - [#628](https://github.com/sveltejs/eslint-plugin-svelte/pull/628) [`85fc8f4`](https://github.com/sveltejs/eslint-plugin-svelte/commit/85fc8f467bd9c69475b2ef46fae7bfdd7360158f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update parser and fix some tests - - [#696](https://github.com/sveltejs/eslint-plugin-svelte/pull/696) [`d4303f5`](https://github.com/sveltejs/eslint-plugin-svelte/commit/d4303f5347dae7828e08e699741a276ee35dbd43) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update svelte-eslint-parser - - [#635](https://github.com/sveltejs/eslint-plugin-svelte/pull/635) [`ec3f1cf`](https://github.com/sveltejs/eslint-plugin-svelte/commit/ec3f1cf5ab1726e2a8b79225c231159333474c71) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update svelte to v5.0.0-next.16 - - [#687](https://github.com/sveltejs/eslint-plugin-svelte/pull/687) [`2943021`](https://github.com/sveltejs/eslint-plugin-svelte/commit/29430210e25cbe417ba28d65d7bf1b07ed4e08e3) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update parser -- Support for ESLint v9 - - [#673](https://github.com/sveltejs/eslint-plugin-svelte/pull/673) [`b72b97b`](https://github.com/sveltejs/eslint-plugin-svelte/commit/b72b97ba617ff5eeb9b6f4e600c511250c19a72b) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for eslint v9 - - [#708](https://github.com/sveltejs/eslint-plugin-svelte/pull/708) [`d597a69`](https://github.com/sveltejs/eslint-plugin-svelte/commit/d597a69637d95f6be13eaa10a7cc6feebd812e23) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for flat config - - [#719](https://github.com/sveltejs/eslint-plugin-svelte/pull/719) [`eaf5e6a`](https://github.com/sveltejs/eslint-plugin-svelte/commit/eaf5e6af1edab5a4d565b74be6bcc02c71c13ac6) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: suppress comment not working in flat config. - - [#711](https://github.com/sveltejs/eslint-plugin-svelte/pull/711) [`aaba61f`](https://github.com/sveltejs/eslint-plugin-svelte/commit/aaba61f1d7f8337e690659e396d52453b3cc0002) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: flat config would cause an error with non-svelte files -- [#690](https://github.com/sveltejs/eslint-plugin-svelte/pull/690) [`e84397d`](https://github.com/sveltejs/eslint-plugin-svelte/commit/e84397dd71300fc5e4200e9e6c807a3e5f901e23) Thanks [@sdarnell](https://github.com/sdarnell)! - Added prefer option to prefer-class-directive rule ('always' or 'empty'). The default is now 'empty' which is a slight relaxation of the rule. -- [#679](https://github.com/sveltejs/eslint-plugin-svelte/pull/679) [`4e6c681`](https://github.com/sveltejs/eslint-plugin-svelte/commit/4e6c6817681b81bd546b032d7b1ff9a6a6e1935a) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the no-goto-without-base rule - -### Patch Changes - -- [#694](https://github.com/sveltejs/eslint-plugin-svelte/pull/694) [`73d6fd8`](https://github.com/sveltejs/eslint-plugin-svelte/commit/73d6fd832d88af44feb9a8b86826e138d47251de) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: style report location -- [#670](https://github.com/sveltejs/eslint-plugin-svelte/pull/670) [`6121a56`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6121a562f8a6d34bb338a5a2df373032abe514d6) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency eslint-compat-utils to ^0.3.0 - -## 2.36.0-next.13 - -### Patch Changes - -- [#719](https://github.com/sveltejs/eslint-plugin-svelte/pull/719) [`eaf5e6a`](https://github.com/sveltejs/eslint-plugin-svelte/commit/eaf5e6af1edab5a4d565b74be6bcc02c71c13ac6) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: suppress comment not working in flat config. - -## 2.36.0-next.12 - -### Patch Changes - -- [#711](https://github.com/sveltejs/eslint-plugin-svelte/pull/711) [`aaba61f`](https://github.com/sveltejs/eslint-plugin-svelte/commit/aaba61f1d7f8337e690659e396d52453b3cc0002) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: flat config would cause an error with non-svelte files - -## 2.36.0-next.11 - -### Minor Changes - -- [#708](https://github.com/sveltejs/eslint-plugin-svelte/pull/708) [`d597a69`](https://github.com/sveltejs/eslint-plugin-svelte/commit/d597a69637d95f6be13eaa10a7cc6feebd812e23) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for flat config - -## 2.36.0-next.10 - -### Patch Changes - -- [#704](https://github.com/sveltejs/eslint-plugin-svelte/pull/704) [`af2ccf9`](https://github.com/sveltejs/eslint-plugin-svelte/commit/af2ccf9f85af00221f9ec10efbc770cba5615a62) Thanks [@ota-meshi](https://github.com/ota-meshi)! - Update svelte-eslint-parser - -## 2.36.0-next.9 - -### Minor Changes - -- [#679](https://github.com/sveltejs/eslint-plugin-svelte/pull/679) [`4e6c681`](https://github.com/sveltejs/eslint-plugin-svelte/commit/4e6c6817681b81bd546b032d7b1ff9a6a6e1935a) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the no-goto-without-base rule - -### Patch Changes - -- [#696](https://github.com/sveltejs/eslint-plugin-svelte/pull/696) [`d4303f5`](https://github.com/sveltejs/eslint-plugin-svelte/commit/d4303f5347dae7828e08e699741a276ee35dbd43) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update svelte-eslint-parser - -## 2.36.0-next.8 - -### Patch Changes - -- [#694](https://github.com/sveltejs/eslint-plugin-svelte/pull/694) [`73d6fd8`](https://github.com/sveltejs/eslint-plugin-svelte/commit/73d6fd832d88af44feb9a8b86826e138d47251de) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: style report location - -## 2.36.0-next.7 - -### Minor Changes - -- [#690](https://github.com/sveltejs/eslint-plugin-svelte/pull/690) [`e84397d`](https://github.com/sveltejs/eslint-plugin-svelte/commit/e84397dd71300fc5e4200e9e6c807a3e5f901e23) Thanks [@sdarnell](https://github.com/sdarnell)! - Added prefer option to prefer-class-directive rule ('always' or 'empty'). The default is now 'empty' which is a slight relaxation of the rule. - -### Patch Changes - -- [#693](https://github.com/sveltejs/eslint-plugin-svelte/pull/693) [`b11ff34`](https://github.com/sveltejs/eslint-plugin-svelte/commit/b11ff34de949f778d9344ec1143d1a636864d95b) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update dependencies & some fixes - -## 2.36.0-next.6 - -### Patch Changes - -- [#687](https://github.com/sveltejs/eslint-plugin-svelte/pull/687) [`2943021`](https://github.com/sveltejs/eslint-plugin-svelte/commit/29430210e25cbe417ba28d65d7bf1b07ed4e08e3) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update parser - -## 2.36.0-next.5 - -### Patch Changes - -- [#670](https://github.com/sveltejs/eslint-plugin-svelte/pull/670) [`6121a56`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6121a562f8a6d34bb338a5a2df373032abe514d6) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency eslint-compat-utils to ^0.3.0 - -- [#673](https://github.com/sveltejs/eslint-plugin-svelte/pull/673) [`b72b97b`](https://github.com/sveltejs/eslint-plugin-svelte/commit/b72b97ba617ff5eeb9b6f4e600c511250c19a72b) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for eslint v9 - -## 2.36.0-next.4 - -### Patch Changes - -- [#657](https://github.com/sveltejs/eslint-plugin-svelte/pull/657) [`b159b46`](https://github.com/sveltejs/eslint-plugin-svelte/commit/b159b467427aab17c74246f9b89283aa966bb2e4) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update svelte to v5.0.0-next.33 - -## 2.36.0-next.3 - -### Patch Changes - -- [#635](https://github.com/sveltejs/eslint-plugin-svelte/pull/635) [`ec3f1cf`](https://github.com/sveltejs/eslint-plugin-svelte/commit/ec3f1cf5ab1726e2a8b79225c231159333474c71) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update svelte to v5.0.0-next.16 - -## 2.36.0-next.2 - -### Patch Changes - -- [#628](https://github.com/sveltejs/eslint-plugin-svelte/pull/628) [`85fc8f4`](https://github.com/sveltejs/eslint-plugin-svelte/commit/85fc8f467bd9c69475b2ef46fae7bfdd7360158f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update parser and fix some tests - -## 2.36.0-next.1 - -### Minor Changes - -- [#622](https://github.com/sveltejs/eslint-plugin-svelte/pull/622) [`470ef6c`](https://github.com/sveltejs/eslint-plugin-svelte/commit/470ef6cd1ef4767528ff15b5fbdfec1740a5ec02) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for `{@snippet}`and `{@render}` in indent rule - -- [#624](https://github.com/sveltejs/eslint-plugin-svelte/pull/624) [`7df5b6f`](https://github.com/sveltejs/eslint-plugin-svelte/commit/7df5b6f0963f1fb8fc9256f8ed6f034e5f7fbf3d) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for `{@snippet}` and `{@render}` in mustache-spacing rule - -## 2.36.0-next.0 - -### Minor Changes - -- [#620](https://github.com/sveltejs/eslint-plugin-svelte/pull/620) [`1097107`](https://github.com/sveltejs/eslint-plugin-svelte/commit/1097107afce00fd8b959261b015a4eb1f39f116d) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: (experimental) partial support for Svelte v5 - -## 2.35.1 - -### Patch Changes - -- [#623](https://github.com/sveltejs/eslint-plugin-svelte/pull/623) [`a8b4bd4`](https://github.com/sveltejs/eslint-plugin-svelte/commit/a8b4bd4bb7c0164f76e4efd19bd8ab6de3185cd6) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: replace deprecated typeParameters with typeArguments - -## 2.35.0 - -### Minor Changes - -- [#608](https://github.com/sveltejs/eslint-plugin-svelte/pull/608) [`ff28fd3`](https://github.com/sveltejs/eslint-plugin-svelte/commit/ff28fd328254a0b7327078a878c9486f4db1b7c8) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the no-inline-styles rule - -- [#605](https://github.com/sveltejs/eslint-plugin-svelte/pull/605) [`ef5f965`](https://github.com/sveltejs/eslint-plugin-svelte/commit/ef5f965024935c9bf6224450243223066789501e) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: use eslint-compat-utils - -## 2.34.1 - -### Patch Changes - -- [#604](https://github.com/sveltejs/eslint-plugin-svelte/pull/604) [`796c0ad`](https://github.com/sveltejs/eslint-plugin-svelte/commit/796c0ad5f71dd927989caea109027e1735202c3b) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for custom-element with svelte v3 in `svelte/valid-compile` - -## 2.34.0 - -### Minor Changes - -- [#592](https://github.com/sveltejs/eslint-plugin-svelte/pull/592) [`1fe38d7`](https://github.com/sveltejs/eslint-plugin-svelte/commit/1fe38d770928bb890d4292e6a10028b93d9ba843) Thanks [@moufmouf](https://github.com/moufmouf)! - feat: add new `svelte/no-ignored-unsubscribe` rule. - -## 2.33.2 - -### Patch Changes - -- [#585](https://github.com/sveltejs/eslint-plugin-svelte/pull/585) [`d9866a1`](https://github.com/sveltejs/eslint-plugin-svelte/commit/d9866a1396da2374926158034e92464164c061c0) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for `bind:` with member in `svelte/no-immutable-reactive-statements` rule - -## 2.33.1 - -### Patch Changes - -- [#581](https://github.com/sveltejs/eslint-plugin-svelte/pull/581) [`1645a9e`](https://github.com/sveltejs/eslint-plugin-svelte/commit/1645a9eb28519051f997c019ed95347055a76959) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for mutable member in `svelte/no-immutable-reactive-statements` rule - -## 2.33.0 - -### Minor Changes - -- [#565](https://github.com/sveltejs/eslint-plugin-svelte/pull/565) [`bd11057`](https://github.com/sveltejs/eslint-plugin-svelte/commit/bd110572cafc9c7323e6f2d0407bb237d0f32708) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: change dependency parser version - -## 2.32.4 - -### Patch Changes - -- [#551](https://github.com/sveltejs/eslint-plugin-svelte/pull/551) [`a17a6e0`](https://github.com/sveltejs/eslint-plugin-svelte/commit/a17a6e003e8321aca0b9b95d1a401bf7f8966451) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency known-css-properties to ^0.28.0 - -## 2.32.3 - -### Patch Changes - -- [#548](https://github.com/sveltejs/eslint-plugin-svelte/pull/548) [`68e7724`](https://github.com/sveltejs/eslint-plugin-svelte/commit/68e77240499b93a1fe0d31d0defa8e42d48a6e5d) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: typescript-eslint v6 compatibility - -## 2.32.2 - -### Patch Changes - -- [#530](https://github.com/sveltejs/eslint-plugin-svelte/pull/530) [`c584404`](https://github.com/sveltejs/eslint-plugin-svelte/commit/c584404bd5a2134d81067abbd3c01525abc8e9f7) Thanks [@pawelblaszczyk5](https://github.com/pawelblaszczyk5)! - fix: handle type aliases for $Events and $Slots declarations - -## 2.32.1 - -### Patch Changes - -- [#527](https://github.com/sveltejs/eslint-plugin-svelte/pull/527) [`0212a78`](https://github.com/sveltejs/eslint-plugin-svelte/commit/0212a78541e2ff51305c3b75f115dabcba73ab78) Thanks [@marekdedic](https://github.com/marekdedic)! - fix(no-ununsed-class-name): fixed an error with `@use` at-rules - -## 2.32.0 - -### Minor Changes - -- [#520](https://github.com/sveltejs/eslint-plugin-svelte/pull/520) [`8ba5fb1`](https://github.com/sveltejs/eslint-plugin-svelte/commit/8ba5fb102d39310cdd5756245bb1f388e432a7a0) Thanks [@marekdedic](https://github.com/marekdedic)! - feat(no-unused-class-name): added an option to allow some specific class names - -- [#524](https://github.com/sveltejs/eslint-plugin-svelte/pull/524) [`1e0346e`](https://github.com/sveltejs/eslint-plugin-svelte/commit/1e0346ef287089cf2b9169abf319d81e52993630) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add support for Svelte v4 - -- [#525](https://github.com/sveltejs/eslint-plugin-svelte/pull/525) [`20412ab`](https://github.com/sveltejs/eslint-plugin-svelte/commit/20412ab756154291e36671e31c41a0ca7c3c7f97) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency svelte-eslint-parser to ^0.32.0 - -### Patch Changes - -- [#511](https://github.com/sveltejs/eslint-plugin-svelte/pull/511) [`bb30943`](https://github.com/sveltejs/eslint-plugin-svelte/commit/bb309430f45b49e86b3c4cb6fd53d6e57ea37a86) Thanks [@marekdedic](https://github.com/marekdedic)! - feat(block-lang): added support for multiple modules of the same type - -## 2.31.1 - -### Patch Changes - -- [#514](https://github.com/sveltejs/eslint-plugin-svelte/pull/514) [`95ed14e`](https://github.com/sveltejs/eslint-plugin-svelte/commit/95ed14ef4a59bfa25f3dd74403d583eb45df75f8) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: `plugin:svelte/all` config - -- [#517](https://github.com/sveltejs/eslint-plugin-svelte/pull/517) [`c1f27c4`](https://github.com/sveltejs/eslint-plugin-svelte/commit/c1f27c4a89e744131aa3ec93d9ad2cceddd84412) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positive for `customElement="..."` in `svelte/valid-compile` - -- [#515](https://github.com/sveltejs/eslint-plugin-svelte/pull/515) [`1ecdfee`](https://github.com/sveltejs/eslint-plugin-svelte/commit/1ecdfeedd47cfe81cc8c121c847a05bfbdfdb76e) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: crash with non svelte files in `svelte/no-unused-class-name` - -## 2.31.0 - -### Minor Changes - -- [#489](https://github.com/sveltejs/eslint-plugin-svelte/pull/489) [`cc321f4`](https://github.com/sveltejs/eslint-plugin-svelte/commit/cc321f4182fe71b0b1f136d6ede37c509a402c25) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the no-unused-class-name rule - -- [#504](https://github.com/sveltejs/eslint-plugin-svelte/pull/504) [`ab9e6e7`](https://github.com/sveltejs/eslint-plugin-svelte/commit/ab9e6e7f64537747a31826d9ff3758350f0b0f59) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency svelte-eslint-parser to ^0.31.0 - -- [#499](https://github.com/sveltejs/eslint-plugin-svelte/pull/499) [`16d6816`](https://github.com/sveltejs/eslint-plugin-svelte/commit/16d6816bbfec66ad89bbbe59429c74c6a21542df) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: add `no-restricted-html-elements` rule - -## 2.30.0 - -### Minor Changes - -- [#494](https://github.com/sveltejs/eslint-plugin-svelte/pull/494) [`e5ea6fe`](https://github.com/sveltejs/eslint-plugin-svelte/commit/e5ea6fe641788e05339f468ce6c3d818df7b2446) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add experimental support for Svelte v4 - -- [#494](https://github.com/sveltejs/eslint-plugin-svelte/pull/494) [`e5ea6fe`](https://github.com/sveltejs/eslint-plugin-svelte/commit/e5ea6fe641788e05339f468ce6c3d818df7b2446) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix(deps): update dependency svelte-eslint-parser to ^0.30.0 - -## 2.29.0 - -### Minor Changes - -- [#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 - -## 2.28.0 - -### Minor Changes - -- [#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 - -- [#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 - -- [#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 - -- [#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 - -## 2.27.4 - -### Patch Changes - -- [#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` - -- [#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` - -## 2.27.3 - -### Patch Changes - -- [#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) - -## 2.27.2 - -### Patch Changes - -- [#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 - -## 2.27.1 - -### Patch Changes - -- [#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 - -## 2.27.0 - -### Minor Changes - -- [#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 - -- [#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 - -- [#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 - -## 2.26.0 - -### Minor Changes - -- [#433](https://github.com/sveltejs/eslint-plugin-svelte/pull/433) [`890cfa2`](https://github.com/sveltejs/eslint-plugin-svelte/commit/890cfa268b2473fb770de9d79682078f97c9e295) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update svelte-eslint-parser to add support for `` - -## 2.25.0 - -### Minor Changes - -- [#428](https://github.com/sveltejs/eslint-plugin-svelte/pull/428) [`89925ea`](https://github.com/sveltejs/eslint-plugin-svelte/commit/89925eaf45b94b91e0c0c37fa754652f807e225d) Thanks [@ota-meshi](https://github.com/ota-meshi)! - chore: move repo and move url of rule docs - -## 2.24.0 - -### Minor Changes - -- [#425](https://github.com/sveltejs/eslint-plugin-svelte/pull/425) [`2f08a42`](https://github.com/sveltejs/eslint-plugin-svelte/commit/2f08a421cc6317d4b2c06325ae1c9105df6a110e) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update svelte-eslint-parser to v0.25 - -## 2.23.1 - -### Patch Changes - -- [#420](https://github.com/sveltejs/eslint-plugin-svelte/pull/420) [`4ae07d9`](https://github.com/sveltejs/eslint-plugin-svelte/commit/4ae07d93a4102504afd9f37a38ff0e90de075a79) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positive for containing element in `svelte/no-unused-svelte-ignore` - -## 2.23.0 - -### Minor Changes - -- [#403](https://github.com/sveltejs/eslint-plugin-svelte/pull/403) [`c171d9c`](https://github.com/sveltejs/eslint-plugin-svelte/commit/c171d9c1a3ea80359db46d925cdce06c8dff4d5b) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: use `@eslint-community` packages - -### Patch Changes - -- [#415](https://github.com/sveltejs/eslint-plugin-svelte/pull/415) [`9714749`](https://github.com/sveltejs/eslint-plugin-svelte/commit/97147490f72b09602bd8667c9fe00131b2fb8bbc) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: ignore indent for inline style tags in `svelte/indent` rule - -- [#418](https://github.com/sveltejs/eslint-plugin-svelte/pull/418) [`fe306ed`](https://github.com/sveltejs/eslint-plugin-svelte/commit/fe306ed81223a0379147421bab1dd0176941fb6f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: maximum call stack error in `svelte/infinite-reactive-loop` rule - -## 2.22.0 - -### Minor Changes - -- [#407](https://github.com/sveltejs/eslint-plugin-svelte/pull/407) [`c394a80`](https://github.com/sveltejs/eslint-plugin-svelte/commit/c394a80fd5aaa68236563f44d4ef0afb7424bc33) Thanks [@DetachHead](https://github.com/DetachHead)! - add `all` config which enables every rule - -## 2.21.0 - -### Minor Changes - -- [#399](https://github.com/sveltejs/eslint-plugin-svelte/pull/399) [`0e102c2`](https://github.com/sveltejs/eslint-plugin-svelte/commit/0e102c2a5c1b6feeece43615b4a0eb3b06acb0b7) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update svelte-eslint-parser to v0.24 - -## 2.20.2 - -### Patch Changes - -- [#397](https://github.com/sveltejs/eslint-plugin-svelte/pull/397) [`7b0d70b`](https://github.com/sveltejs/eslint-plugin-svelte/commit/7b0d70b4d85c6090b84c5de51d1215e2d3ebddeb) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: `ReferenceTracker` usage - -## 2.20.1 - -### Patch Changes - -- [#394](https://github.com/sveltejs/eslint-plugin-svelte/pull/394) [`4c5be6f`](https://github.com/sveltejs/eslint-plugin-svelte/commit/4c5be6f0c96c1c08e8c5878ece6af55bb2f35266) Thanks [@marekdedic](https://github.com/marekdedic)! - fix(block-lang): fixed false positives for non-svelte files - -## 2.20.0 - -### Minor Changes - -- [#389](https://github.com/sveltejs/eslint-plugin-svelte/pull/389) [`6039793`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6039793f6e1243f2180564ea992f762ecf1c5ab2) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the `svelte/block-lang` rule - -## 2.19.2 - -### Patch Changes - -- [#387](https://github.com/sveltejs/eslint-plugin-svelte/pull/387) [`6422ee8`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6422ee89fcb5c8cefceda7dfa5b78e411c27f557) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positive for element in `svelte/no-unused-svelte-ignore` - -## 2.19.1 - -### Patch Changes - -- [#383](https://github.com/sveltejs/eslint-plugin-svelte/pull/383) [`08aace5`](https://github.com/sveltejs/eslint-plugin-svelte/commit/08aace561ab4f013b4eda47f829bc7fa545d5c9f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for read property in `svelte/no-dom-manipulating` - -## 2.19.0 - -### Minor Changes - -- [#375](https://github.com/sveltejs/eslint-plugin-svelte/pull/375) [`d692baf`](https://github.com/sveltejs/eslint-plugin-svelte/commit/d692baf88637c8aca066d4abe62450b2b9f9940f) Thanks [@ptrxyz](https://github.com/ptrxyz)! - Change to use `parserServices.program.getCompilerOptions().target` for TS transpile in `svelte/valid-compile` rule. - -## 2.18.0 - -### Minor Changes - -- [#368](https://github.com/sveltejs/eslint-plugin-svelte/pull/368) [`fcb5e31`](https://github.com/sveltejs/eslint-plugin-svelte/commit/fcb5e319620b1cc71ffe579760033813bd719410) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the `svelte/experimental-require-slot-types` rule - -- [#365](https://github.com/sveltejs/eslint-plugin-svelte/pull/365) [`e61bbc3`](https://github.com/sveltejs/eslint-plugin-svelte/commit/e61bbc347f416f19e9e1e026c4d692e404776023) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the `svelte/experimental-require-strict-events` rule - -## 2.17.0 - -### Minor Changes - -- [#366](https://github.com/sveltejs/eslint-plugin-svelte/pull/366) [`a1fe4ac`](https://github.com/sveltejs/eslint-plugin-svelte/commit/a1fe4aca6fbc5620d831ae93195faa4863936855) Thanks [@baseballyama](https://github.com/baseballyama)! - Support `snapshot` to `valid-prop-names-in-kit-pages` rule - -## 2.16.0 - -### Minor Changes - -- [#358](https://github.com/sveltejs/eslint-plugin-svelte/pull/358) [`3464f23`](https://github.com/sveltejs/eslint-plugin-svelte/commit/3464f2340ee1a45a4f50900eafe6435af9ba2931) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update svelte-eslint-parser to v0.23 - -- [#332](https://github.com/sveltejs/eslint-plugin-svelte/pull/332) [`26870cf`](https://github.com/sveltejs/eslint-plugin-svelte/commit/26870cf4eae7c682ae9d2741194fc23fdca9112e) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: add `svelte/nfinite-reactive-loop` rule - -- [#354](https://github.com/sveltejs/eslint-plugin-svelte/pull/354) [`2f1d89a`](https://github.com/sveltejs/eslint-plugin-svelte/commit/2f1d89a4cbb5845aa328f5889dd449c386f04bda) Thanks [@marekdedic](https://github.com/marekdedic)! - feat: added the `svelte/require-event-dispatcher-types` rule - -### Patch Changes - -- [#357](https://github.com/sveltejs/eslint-plugin-svelte/pull/357) [`a561f99`](https://github.com/sveltejs/eslint-plugin-svelte/commit/a561f995a426ccb2d9a4066fc8cc264efbb74d7e) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for ts in `svelte/no-unused-svelte-ignore` - -## 2.15.0 - -### Minor Changes - -- [#349](https://github.com/sveltejs/eslint-plugin-svelte/pull/349) [`b3f6fd5`](https://github.com/sveltejs/eslint-plugin-svelte/commit/b3f6fd50169a45e2efc229f9f132635a1c8a3136) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: improved loading of external modules - -### Patch Changes - -- [#351](https://github.com/sveltejs/eslint-plugin-svelte/pull/351) [`aa7ab6c`](https://github.com/sveltejs/eslint-plugin-svelte/commit/aa7ab6cacb502eac046d89ecc5ff63b07f7118f8) Thanks [@SiNONiMiTY](https://github.com/SiNONiMiTY)! - fix(deps): update sourcemap-codec dependency - -- [#353](https://github.com/sveltejs/eslint-plugin-svelte/pull/353) [`5933794`](https://github.com/sveltejs/eslint-plugin-svelte/commit/593379470019210bf9104bc260dffacb8976f8f5) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false positives for `form` in `svelte/valid-prop-names-in-kit-pages` - -## 2.14.1 - -### Patch Changes - -- [#318](https://github.com/sveltejs/eslint-plugin-svelte/pull/318) [`53d4fda`](https://github.com/sveltejs/eslint-plugin-svelte/commit/53d4fdaf0fe60f78677b6f9b85ed81da553301e5) Thanks [@DetachHead](https://github.com/DetachHead)! - fix `isKitPageComponent` on windows - -## 2.14.0 - -### Minor Changes - -- [#310](https://github.com/sveltejs/eslint-plugin-svelte/pull/310) [`6d392c4`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6d392c4ac1d94e6f296858da99454198774c6bec) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: improve `svelte/indent` rule to support more ts syntax - -- [#308](https://github.com/sveltejs/eslint-plugin-svelte/pull/308) [`a9c4912`](https://github.com/sveltejs/eslint-plugin-svelte/commit/a9c4912b9d23fe7557786445fa8180a7b35bda21) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/no-dupe-use-directives` rule - -- [#308](https://github.com/sveltejs/eslint-plugin-svelte/pull/308) [`a9c4912`](https://github.com/sveltejs/eslint-plugin-svelte/commit/a9c4912b9d23fe7557786445fa8180a7b35bda21) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/no-dupe-on-directives` rule - -## 2.13.1 - -### Patch Changes - -- [#306](https://github.com/sveltejs/eslint-plugin-svelte/pull/306) [`48bb4b7`](https://github.com/sveltejs/eslint-plugin-svelte/commit/48bb4b793864dc9689a5f021ae17c2bd08a3e325) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update svelte-eslint-parser to 0.22 - -## 2.13.0 - -### Minor Changes - -- [#303](https://github.com/sveltejs/eslint-plugin-svelte/pull/303) [`747eae5`](https://github.com/sveltejs/eslint-plugin-svelte/commit/747eae528d8aadc0d31a64f04baa8f2e557e80c6) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: update svelte-eslint-parser to v0.21 - -- [#296](https://github.com/sveltejs/eslint-plugin-svelte/pull/296) [`695e2e5`](https://github.com/sveltejs/eslint-plugin-svelte/commit/695e2e50762bf004af9200d7d05958e5cea08f70) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: improve reporting range for `svelte/html-self-closing` rule. - -- [#302](https://github.com/sveltejs/eslint-plugin-svelte/pull/302) [`f0d3e68`](https://github.com/sveltejs/eslint-plugin-svelte/commit/f0d3e68f75f6a90d5f245313e96b3987fec6761f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/no-dom-manipulating` rule - -## 2.12.0 - -### Minor Changes - -- [#291](https://github.com/sveltejs/eslint-plugin-svelte/pull/291) [`049ac2d`](https://github.com/sveltejs/eslint-plugin-svelte/commit/049ac2db68a9a3c753cc4e5fdf178795b01d715c) Thanks [@renovate](https://github.com/apps/renovate)! - feat: update dependency svelte-eslint-parser to ^0.20.0 - -- [#284](https://github.com/sveltejs/eslint-plugin-svelte/pull/284) [`1240968`](https://github.com/sveltejs/eslint-plugin-svelte/commit/1240968523fb7721c6ca3ea5bdf943247be4a099) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: add `require-store-callbacks-use-set-param` rule - -- [#281](https://github.com/sveltejs/eslint-plugin-svelte/pull/281) [`8da870f`](https://github.com/sveltejs/eslint-plugin-svelte/commit/8da870fc6c7d2b00a067d8befe124576c623a907) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: add `no-export-load-in-svelte-module-in-kit-pages` rule - -- [#283](https://github.com/sveltejs/eslint-plugin-svelte/pull/283) [`909979e`](https://github.com/sveltejs/eslint-plugin-svelte/commit/909979e004f5b069dbd4adb1a53a125ecda110a7) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: add `svelte/valid-prop-names-in-kit-pages` rule - -- [#289](https://github.com/sveltejs/eslint-plugin-svelte/pull/289) [`2895f16`](https://github.com/sveltejs/eslint-plugin-svelte/commit/2895f16c0e62cd0e946e549f8fc147aef42c143b) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/require-store-reactive-access` rule - -### Patch Changes - -- [#286](https://github.com/sveltejs/eslint-plugin-svelte/pull/286) [`8802e14`](https://github.com/sveltejs/eslint-plugin-svelte/commit/8802e1456b3d0c2bf021a3086b5160c51f56b049) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency known-css-properties to ^0.26.0 - -## 2.11.0 - -### Minor Changes - -- [#274](https://github.com/sveltejs/eslint-plugin-svelte/pull/274) [`9a9ba19`](https://github.com/sveltejs/eslint-plugin-svelte/commit/9a9ba19ee6301de01196a26696fc2ed350238c7f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: update svelte-eslint-parser to v0.19.0. See [release note](https://github.com/ota-meshi/svelte-eslint-parser/releases/tag/v0.19.0) - -- [#276](https://github.com/sveltejs/eslint-plugin-svelte/pull/276) [`e9f7bcf`](https://github.com/sveltejs/eslint-plugin-svelte/commit/e9f7bcf8f96bf33d7f24cac2178b5dbd95f1b72d) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: deprecate `svelte/@typescript-eslint/no-unnecessary-condition` rule - -## 2.10.0 - -### Minor Changes - -- [#270](https://github.com/sveltejs/eslint-plugin-svelte/pull/270) [`dc60b36`](https://github.com/sveltejs/eslint-plugin-svelte/commit/dc60b36007d26ce5bc639a87d2a57072d7cf6c89) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/prefer-destructured-store-props` rule - -## 2.9.0 - -### Minor Changes - -- [#262](https://github.com/sveltejs/eslint-plugin-svelte/pull/262) [`b732ec6`](https://github.com/sveltejs/eslint-plugin-svelte/commit/b732ec621b1832ddf214ca3bb556d1c0b9ead463) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/@typescript-eslint/no-unnecessary-condition` rule - -### Patch Changes - -- [#261](https://github.com/sveltejs/eslint-plugin-svelte/pull/261) [`3dae5ab`](https://github.com/sveltejs/eslint-plugin-svelte/commit/3dae5abe1ac9487697784109e31370641efb204f) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: false report in `settings.ignoreWarnings` - -## 2.8.0 - -### Minor Changes - -- [#249](https://github.com/sveltejs/eslint-plugin-svelte/pull/249) [`6d0b89f`](https://github.com/sveltejs/eslint-plugin-svelte/commit/6d0b89f644b160b94293f4f0a63d5cef4bb032e4) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: add `svelte/derived-has-same-inputs-outputs` rule - -## 2.7.0 - -### Minor Changes - -- [#240](https://github.com/sveltejs/eslint-plugin-svelte/pull/240) [`e56fbdb`](https://github.com/sveltejs/eslint-plugin-svelte/commit/e56fbdb34079567a6c1061909fa7d54cfc91727d) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: add `svelte/no-trailing-spaces` rule -- [#225](https://github.com/sveltejs/eslint-plugin-svelte/pull/225) [`a3888b3`](https://github.com/sveltejs/eslint-plugin-svelte/commit/a3888b3cf358ceaa4ddaf22af19f8124d0ff53e4) Thanks [@baseballyama](https://github.com/baseballyama)! - feat: add `svelte/no-store-async` rule - -## 2.6.0 - -### Minor Changes - -- [#216](https://github.com/sveltejs/eslint-plugin-svelte/pull/216) [`9d122ea`](https://github.com/sveltejs/eslint-plugin-svelte/commit/9d122eaee577ffb846051b7cad15f515dbbb2ccb) Thanks [@marekvospel](https://github.com/marekvospel)! - feat(html-self-closing): add configuration presets diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c273bea6..1f1d95462 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -Thanks for contributing! +Thank you for contributing! ## Installation @@ -10,62 +10,60 @@ cd eslint-plugin-svelte pnpm install ``` -## Running the tests +## Running Tests ```sh +cd packages/eslint-plugin-svelte pnpm run test ``` -To run the tests with debugging log, you can use `pnpm run test:debug`. +This is an [ESLint](http://eslint.org) plugin. See ESLint's [Working with Plugins](http://eslint.org/docs/developer-guide/working-with-plugins) for API details. -This is an [ESLint](http://eslint.org) plugin. Documentation for the APIs that it uses can be found on ESLint's [Working with Plugins](http://eslint.org/docs/developer-guide/working-with-plugins) page. - -This plugin is used to lint itself. The style is checked when `pnpm run lint` is run, and the build will fail if there are any linting errors. You can use `pnpm run lint-fix` to fix some linting errors. +The plugin lints itself. Running `pnpm run lint` checks the style and will fail the build if there are lint errors. Use `pnpm run lint-fix` to automatically fix some issues. ## Other Development Tools -- `pnpm run test` runs tests. -- `pnpm run cover` runs tests and measures coverage. -- `pnpm run new -- [new-rule-name]` generate the files needed to implement the new rule. -- `pnpm run update` runs in order to update readme and recommended configuration. -- `pnpm run docs:watch` launch the document site in development mode. +- `pnpm run test` – runs tests. +- `pnpm run new -- [new-rule-name]` – generates files for a new rule. +- `pnpm run update` – updates the README and recommended configuration. -## Test the Rule +## Rule Testing -Rule testing almost always uses fixtures. -For example, for an `indent` rule, the `.ts` file that runs the test is `tests/src/rules/indent.ts` and the fixture is in `tests/fixtures/rules/indent`. -The fixture directory has an `invalid` directory and a `valid` directory. +Rule tests typically use fixtures. For example, for the `indent` rule, the test file is `tests/src/rules/indent.ts` and the fixtures are in `tests/fixtures/rules/indent`, which contains `invalid` and `valid` directories. -- The `invalid` directory contains test cases where the rule reports problems. -- The `valid` directory contains test cases where the rule does not report a problem. +- The `invalid` directory contains test cases where the rule should report errors. +- The `valid` directory contains test cases where no errors are reported. -The fixture input file should be named `*-input.svelte`. It is automatically collected and tested. -If your test requires configuration, you need to add a json file with the configuration. +Fixture input files should be named `*-input.svelte` and are automatically collected. +If configuration is needed, include a JSON file: -- If you want to apply a configuration to `my-test-input.svelte`, add `my-test-config.json`. -- If you want to apply the same configuration to all the fixtures in that directory, add `_config.json`. +- For a specific test file (e.g., `my-test-input.svelte`), add `my-test-config.json`. +- For all fixtures in a directory, add `_config.json`. -To verify the output of invalid test cases requires `*-errors.json`, and `*-output.svelte` (for auto-fix). However, you don't have to add them yourself. If they do not exist, they will be automatically generated when you run the test. In other words, delete them manually when you want to recreate them. +Verifying output for invalid tests requires `*-errors.json` and `*-output.svelte` (for auto-fix). These files are auto-generated if missing—delete them to recreate. **Tips**: -If you want to test only one rule, run the following command (for `indent` rule): +To test only one rule (e.g., `indent`), run: ```sh pnpm run test -- -g indent ``` -Take as reference for details. +Refer to [this Stack Overflow post](https://stackoverflow.com/questions/10832031/how-to-run-a-single-test-with-mocha) for details. -If you want to test only `my-test-input.svelte`, add `my-test-config.json` and save `{"only": true}`. -(Note that `{"only": true}` must be removed before making a pull request.) +To test a single file (e.g., `my-test-input.svelte`), add a `my-test-config.json` with `{"only": true}`. +(Remember to remove `{"only": true}` before submitting a pull request.) -## Commit messages +## Preview Docs -Please view [commitlint](https://commitlint.js.org) and [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) for more details. +```sh +cd docs-svelte-kit +pnpm run build && pnpm run preview +``` ## Publishing -We're using [changesets](https://github.com/changesets/changesets) for version management, CHANGELOG and releasing automatically. +We use [changesets](https://github.com/changesets/changesets) for version management, changelog generation, and automated releases. -Please view [changesets-bot](https://github.com/apps/changeset-bot) and its [action](https://github.com/changesets/action) for more details. +For more details, see [changesets-bot](https://github.com/apps/changeset-bot) and its [action](https://github.com/changesets/action). diff --git a/README.md b/README.md index 4ba4c5a2c..c379a3d82 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,4 @@ -# Introduction - -`eslint-plugin-svelte` is the official [ESLint] plugin for [Svelte]. -It provides many unique check rules by using the template AST. -You can check on the [Online DEMO](https://sveltejs.github.io/eslint-plugin-svelte/playground/). - -**_We are working on experimental support for Svelte v5, but may break with new versions of Svelte v5._** + [![NPM license](https://img.shields.io/npm/l/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte) [![NPM version](https://img.shields.io/npm/v/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte) @@ -20,302 +14,214 @@ You can check on the [Online DEMO](https://sveltejs.github.io/eslint-plugin-svel [![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/atlassian/changesets) -## :name_badge: What is this plugin? - -[ESLint] plugin for [Svelte]. -It provides many unique check rules using the AST generated by [svelte-eslint-parser]. +
-### ❗ Attention +# eslint-plugin-svelte -#### Cannot be used with eslint-plugin-svelte3 +## ESLint plugin for Svelte using AST -The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3]. +[Live Demo](https://eslint-online-playground.netlify.app/#eslint-plugin-svelte%20with%20typescript) • +[Documentation](https://sveltejs.github.io/eslint-plugin-svelte/) • +[Discord](https://svelte.dev/chat) -[svelte-eslint-parser]: https://github.com/sveltejs/svelte-eslint-parser -[eslint-plugin-svelte3]: https://github.com/sveltejs/eslint-plugin-svelte3 - -#### Experimental support for Svelte v5 - -We are working on support for Svelte v5, but it is still an experimental feature. Please note that rules and features related to Svelte v5 may be changed or removed in minor versions without notice. - - +
-## Migration Guide + -To migrate from `eslint-plugin-svelte` v1, or [`@ota-meshi/eslint-plugin-svelte`](https://www.npmjs.com/package/@ota-meshi/eslint-plugin-svelte), please refer to the [migration guide](https://sveltejs.github.io/eslint-plugin-svelte/migration/). +## Introduction -## :book: Documentation +`eslint-plugin-svelte` is the official [ESLint](https://eslint.org/) plugin for [Svelte](https://svelte.dev/). +It leverages the AST generated by [svelte-eslint-parser](https://github.com/sveltejs/svelte-eslint-parser) to provide custom linting for Svelte. +Note that `eslint-plugin-svelte` and `svelte-eslint-parser` cannot be used alongside [eslint-plugin-svelte3](https://github.com/sveltejs/eslint-plugin-svelte3). -See [documents](https://sveltejs.github.io/eslint-plugin-svelte/). + + -## :cd: Installation +## Installation ```bash -npm install --save-dev eslint eslint-plugin-svelte svelte +npm install --save-dev svelte eslint eslint-plugin-svelte globals ``` -> **Requirements** +> [!NOTE] > -> - ESLint v7.0.0 and above -> - Node.js v14.17.x, v16.x and above +> **Requirements:** +> +> - ESLint v8.57.1, v9.0.0, and above +> - Node.js v18.18.0, v20.9.0, v21.1.0 and above - +## Usage -## :book: Usage - - - +Use the `eslint.config.js` file to configure rules. For more details, see the [ESLint documentation](https://eslint.org/docs/latest/use/configure/configuration-files-new). ### Configuration -#### New Config (`eslint.config.js`) - -Use `eslint.config.js` file to configure rules. See also: . - -Example **eslint.config.js**: +#### JavaScript project ```js -import eslintPluginSvelte from 'eslint-plugin-svelte'; +// eslint.config.js +import js from '@eslint/js'; +import svelte from 'eslint-plugin-svelte'; +import globals from 'globals'; +import svelteConfig from './svelte.config.js'; + +/** @type {import('eslint').Linter.Config[]} */ export default [ - // add more generic rule sets here, such as: - // js.configs.recommended, - ...eslintPluginSvelte.configs['flat/recommended'], + js.configs.recommended, + ...svelte.configs.recommended, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node // Add this if you are using SvelteKit in non-SPA mode + } + } + }, + { + files: ['**/*.svelte', '**/*.svelte.js'], + languageOptions: { + parserOptions: { + // We recommend importing and specifying svelte.config.js. + // By doing so, some rules in eslint-plugin-svelte will automatically read the configuration and adjust their behavior accordingly. + // While certain Svelte settings may be statically loaded from svelte.config.js even if you don’t specify it, + // explicitly specifying it ensures better compatibility and functionality. + svelteConfig + } + } + }, { rules: { - // override/add rules settings here, such as: + // Override or add rule settings here, such as: // 'svelte/rule-name': 'error' } } ]; ``` -This plugin provides configs: +#### TypeScript project -- `eslintPluginSvelte.configs['flat/base']` ... Configuration to enable correct Svelte parsing. -- `eslintPluginSvelte.configs['flat/recommended']` ... Above, plus rules to prevent errors or unintended behavior. -- `eslintPluginSvelte.configs['flat/prettier']` ... Turns off rules that may conflict with [Prettier](https://prettier.io/) (You still need to configure prettier to work with svelte yourself, for example by using [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte).). -- `eslintPluginSvelte.configs['flat/all']` ... All rules. This configuration is not recommended for production use because it changes with every minor and major version of `eslint-plugin-svelte`. Use it at your own risk. - -See [the rule list](https://sveltejs.github.io/eslint-plugin-svelte/rules/) to get the `rules` that this plugin provides. - -#### Legacy Config (`.eslintrc`) - -Use `.eslintrc.*` file to configure rules. See also: . - -Example **.eslintrc.js**: - -```js -module.exports = { - extends: [ - // add more generic rule sets here, such as: - // 'eslint:recommended', - 'plugin:svelte/recommended' - ], - rules: { - // override/add rules settings here, such as: - // 'svelte/rule-name': 'error' - } -}; -``` - -This plugin provides configs: - -- `plugin:svelte/base` ... Configuration to enable correct Svelte parsing. -- `plugin:svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior. -- `plugin:svelte/prettier` ... Turns off rules that may conflict with [Prettier](https://prettier.io/) (You still need to configure prettier to work with svelte yourself, for example by using [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte).). -- `plugin:svelte/all` ... All rules. This configuration is not recommended for production use because it changes with every minor and major version of `eslint-plugin-svelte`. Use it at your own risk. - -See [the rule list](https://sveltejs.github.io/eslint-plugin-svelte/rules/) to get the `rules` that this plugin provides. - -::: warning ❗ Attention - -The `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3]. -If you are using [eslint-plugin-svelte3] you need to remove it. - -```diff - "plugins": [ -- "svelte3" - ] +```shell +npm install --save-dev typescript-eslint ``` -::: - -#### Parser Configuration - -If you have specified a parser, you need to configure a parser for `.svelte`. - -For example, if you are using the `"@babel/eslint-parser"`, configure it as follows: - -```js -module.exports = { - // ... - extends: ['plugin:svelte/recommended'], - // ... - parser: '@babel/eslint-parser', - // Add an `overrides` section to add a parser configuration for svelte. - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser' - } - // ... - ] - // ... -}; -``` - -For example, if you are using the `"@typescript-eslint/parser"`, and if you want to use TypeScript in ` - -
- -
- -
- -
- {#if fix} - - {/if} - {time} -
-
- - diff --git a/docs-svelte-kit/src/lib/components/ESLintPlayground.svelte b/docs-svelte-kit/src/lib/components/ESLintPlayground.svelte deleted file mode 100644 index ce705f0af..000000000 --- a/docs-svelte-kit/src/lib/components/ESLintPlayground.svelte +++ /dev/null @@ -1,278 +0,0 @@ - - - - -
-
- {time} -
-
- -
- -
-
    - {#each messages as msg, i (`${msg.line}:${msg.column}:${msg.ruleId}@${i}`)} -
  1. - : - {msg.message} - ({msg.ruleId}) -
  2. - {/each} -
-
-
-
-
- - diff --git a/docs-svelte-kit/src/lib/eslint/ESLintEditor.svelte b/docs-svelte-kit/src/lib/eslint/ESLintEditor.svelte deleted file mode 100644 index cae68ed39..000000000 --- a/docs-svelte-kit/src/lib/eslint/ESLintEditor.svelte +++ /dev/null @@ -1,259 +0,0 @@ - - -
- -
- {#if showApplyFix} - - {/if} -
-
- - diff --git a/docs-svelte-kit/src/lib/eslint/MonacoEditor.svelte b/docs-svelte-kit/src/lib/eslint/MonacoEditor.svelte deleted file mode 100644 index 9fed3d2fd..000000000 --- a/docs-svelte-kit/src/lib/eslint/MonacoEditor.svelte +++ /dev/null @@ -1,278 +0,0 @@ - - - - -{#await loading} - {#if started} -
- {/if} -{:then} -
-{/await} - - diff --git a/docs-svelte-kit/src/lib/eslint/RulesSettings.svelte b/docs-svelte-kit/src/lib/eslint/RulesSettings.svelte deleted file mode 100644 index 8fdf4ada0..000000000 --- a/docs-svelte-kit/src/lib/eslint/RulesSettings.svelte +++ /dev/null @@ -1,268 +0,0 @@ - - -
-
- - -
-
    - {#each filteredCategories as category (category.title)} - {#if category.rules.length} -
  • - -
    - -
    - - {#if !categoryState[category.title].close} -
      - {#each category.rules as rule (rule.ruleId)} -
    • - - -
    • - {/each} -
    - {/if} -
  • - {/if} - {/each} -
-
- - diff --git a/docs-svelte-kit/src/lib/eslint/scripts/json.js b/docs-svelte-kit/src/lib/eslint/scripts/json.js deleted file mode 100644 index 43a17bafb..000000000 --- a/docs-svelte-kit/src/lib/eslint/scripts/json.js +++ /dev/null @@ -1,68 +0,0 @@ -export function processJsonValue(options, ctx, value) { - const type = typeof value; - if (type === 'string' || type === 'number' || type === 'boolean' || value === null) { - ctx.appendText(JSON.stringify(value)); - return; - } else if (type !== 'object') { - ctx.appendText('"?"'); - return; - } - if (Array.isArray(value)) { - ctx.appendText('[\n').indent(); - const arr = [...value]; - while (arr.length) { - ctx.appendIndent(); - const e = arr.shift(); - processJsonValue(options, ctx, e); - if (arr.length) { - ctx.appendText(','); - } - ctx.appendText('\n'); - } - ctx.outdent().appendIndent().appendText(']'); - } else { - let entries = Object.entries(value); - const valueIsNode = isNode(value); - if (valueIsNode) { - ctx.pushNode(value); - const typeEntry = entries.find(([key]) => key === 'type'); - const locEntries = options.showLocations - ? entries.filter(([key]) => key === 'loc' || key === 'range') - : []; - entries = entries.filter( - ([key]) => - key !== 'type' && - key !== 'loc' && - key !== 'range' && - key !== 'parent' && - !((key === 'start' || key === 'end') && typeof value.start === 'number') - ); - if (typeEntry) entries.unshift(typeEntry); - entries.push(...locEntries); - } - ctx.appendText('{\n').indent(); - while (entries.length) { - const [key, val] = entries.shift(); - ctx.appendIndent(); - processJsonValue(options, ctx, key); - ctx.appendText(': '); - processJsonValue(options, ctx, val); - if (entries.length) { - ctx.appendText(','); - } - ctx.appendText('\n'); - } - ctx.outdent().appendIndent().appendText('}'); - - if (valueIsNode) { - ctx.popNode(); - } - } -} - -/** - * Check if given value is node - */ -function isNode(value) { - return value != null && Array.isArray(value.range) && 'loc' in value && 'type' in value; -} diff --git a/docs-svelte-kit/src/lib/eslint/scripts/linter.js b/docs-svelte-kit/src/lib/eslint/scripts/linter.js deleted file mode 100644 index 01dd44666..000000000 --- a/docs-svelte-kit/src/lib/eslint/scripts/linter.js +++ /dev/null @@ -1,151 +0,0 @@ -import { rules as pluginRules } from '../../../../../packages/eslint-plugin-svelte/src/utils/rules.ts'; -import { builtinRules } from 'eslint/use-at-your-own-risk'; -import * as svelteEslintParser from 'svelte-eslint-parser'; - -export { - preprocess, - postprocess -} from '../../../../../packages/eslint-plugin-svelte/src/processor/index.ts'; - -export const categories = [ - { - title: 'Possible Errors', - classes: 'svelte-category', - rules: [] - }, - { - title: 'Security Vulnerability', - classes: 'svelte-category', - rules: [] - }, - { - title: 'Best Practices', - classes: 'svelte-category', - rules: [] - }, - { - title: 'Stylistic Issues', - classes: 'svelte-category', - rules: [] - }, - { - title: 'Extension Rules', - classes: 'svelte-category', - rules: [] - }, - { - title: 'SvelteKit', - classes: 'svelte-category', - rules: [] - }, - { - title: 'Experimental', - classes: 'svelte-category', - rules: [] - }, - { - title: 'System', - classes: 'svelte-category', - rules: [] - }, - { - type: 'problem', - title: 'Possible Errors (CORE)', - classes: 'core-category', - rules: [] - }, - { - type: 'suggestion', - title: 'Suggestions (CORE)', - classes: 'core-category', - rules: [] - }, - { - type: 'layout', - title: 'Layout & Formatting (CORE)', - classes: 'core-category', - rules: [] - } -]; -export const DEFAULT_RULES_CONFIG = {}; - -const rules = []; -for (const rule of pluginRules) { - if (rule.meta.deprecated) { - continue; - } - const data = { - ruleId: rule.meta.docs.ruleId, - rule, - classes: 'svelte-rule', - url: rule.meta.docs.url - }; - rules.push(data); - const category = rule.meta.docs.category; - categories.find((c) => c.title === category).rules.push(data); - - if ( - rule.meta.docs.ruleId !== 'svelte/no-export-load-in-svelte-module-in-kit-pages' && - rule.meta.docs.ruleId !== 'svelte/valid-prop-names-in-kit-pages' && - rule.meta.docs.ruleId !== 'svelte/no-restricted-html-elements' - ) { - DEFAULT_RULES_CONFIG[rule.meta.docs.ruleId] = 'error'; - } -} - -for (const [ruleId, rule] of builtinRules) { - if (rule.meta.deprecated) { - continue; - } - const data = { - ruleId, - rule, - classes: 'core-rule', - url: rule.meta.docs.url - }; - rules.push(data); - const type = rule.meta.type; - categories.find((c) => c.type === type).rules.push(data); - - if (rule.meta.docs.recommended && ruleId !== 'no-inner-declarations') { - DEFAULT_RULES_CONFIG[ruleId] = 'error'; - } -} - -/** Get rule data */ -export function getRule(ruleId) { - for (const cat of categories) { - for (const rule of cat.rules) { - if (rule.ruleId === ruleId) { - return rule; - } - } - } - return ''; -} - -/** - * @returns {import('eslint').Linter.FlatConfig[]} - */ -export function createLinterConfig() { - return [ - { - files: ['**'], - plugins: { - svelte: { - rules: Object.fromEntries(pluginRules.map((rule) => [rule.meta.docs.ruleName, rule])) - } - } - }, - { - files: ['**/*.svelte', '*.svelte'], - languageOptions: { - parser: svelteEslintParser - } - } - ]; -} - -export function rulesMap() { - return new Map([...builtinRules, ...pluginRules.map((rule) => [rule.meta.docs.ruleId, rule])]); -} diff --git a/docs-svelte-kit/src/lib/eslint/scripts/monaco-loader.js b/docs-svelte-kit/src/lib/eslint/scripts/monaco-loader.js deleted file mode 100644 index cd1e85ed3..000000000 --- a/docs-svelte-kit/src/lib/eslint/scripts/monaco-loader.js +++ /dev/null @@ -1,66 +0,0 @@ -import { language } from './syntax.js'; - -async function setupMonaco() { - if (typeof window !== 'undefined') { - const monacoScript = - Array.from(document.head.querySelectorAll('script')).find( - (script) => script.src && script.src.includes('monaco') && script.src.includes('vs/loader') - ) || (await appendMonacoEditorScript()); - window.require.config({ - paths: { - vs: monacoScript.src.replace(/\/vs\/.*$/u, '/vs') - } - }); - } -} - -function appendMonacoEditorScript() { - return new Promise((resolve) => { - const script = document.createElement('script'); - script.src = 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.34.0/min/vs/loader.min.js'; - script.onload = () => { - script.onload = null; - - watch(); - - function watch() { - if (window.require) { - resolve(script); - return; - } - setTimeout(watch, 200); - } - }; - document.head.append(script); - }); -} - -let setupedMonaco = null; -let editorLoaded = null; - -export function loadMonacoEngine() { - return setupedMonaco || (setupedMonaco = setupMonaco()); -} -export function loadMonacoEditor() { - if (editorLoaded) { - return editorLoaded; - } - return (editorLoaded = (async () => { - const monaco = await loadModuleFromMonaco('vs/editor/editor.main'); - - monaco.languages.register({ id: 'svelte' }); - monaco.languages.setMonarchTokensProvider('svelte', language); - return monaco; - })()); -} - -export async function loadModuleFromMonaco(moduleName) { - await loadMonacoEngine(); - return new Promise((resolve) => { - if (typeof window !== 'undefined') { - window.require([moduleName], (r) => { - resolve(r); - }); - } - }); -} diff --git a/docs-svelte-kit/src/lib/eslint/scripts/state/deserialize.js b/docs-svelte-kit/src/lib/eslint/scripts/state/deserialize.js deleted file mode 100644 index ab8ffdfe3..000000000 --- a/docs-svelte-kit/src/lib/eslint/scripts/state/deserialize.js +++ /dev/null @@ -1,46 +0,0 @@ -import pako from 'pako'; - -/** - * Deserialize a given serialized string then update this object. - * @param {string} serializedString A serialized string. - * @returns {object} The deserialized state. - */ -export function deserializeState(serializedString) { - const state = { - code: undefined, - rules: undefined - }; - - if (serializedString === '') { - return state; - } - - try { - const compressedString = window.atob(serializedString); - const uint8Arr = pako.inflate(Uint8Array.from(compressedString, (c) => c.charCodeAt(0))); - - const jsonText = new TextDecoder().decode(uint8Arr); - const json = JSON.parse(jsonText); - - if (typeof json === 'object' && json != null) { - if (typeof json.code === 'string') { - state.code = json.code; - } - if (json.useEslintPluginSvelte3 === true) { - state.useEslintPluginSvelte3 = true; - } - - if (typeof json.rules === 'object' && json.rules != null) { - state.rules = {}; - for (const id of Object.keys(json.rules)) { - state.rules[id] = json.rules[id] === 2 ? 'error' : 'off'; - } - } - } - } catch (error) { - // eslint-disable-next-line no-console -- Demo - console.error(error); - } - - return state; -} diff --git a/docs-svelte-kit/src/lib/eslint/scripts/state/index.js b/docs-svelte-kit/src/lib/eslint/scripts/state/index.js deleted file mode 100644 index e04dbd277..000000000 --- a/docs-svelte-kit/src/lib/eslint/scripts/state/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from './deserialize'; -export * from './serialize'; diff --git a/docs-svelte-kit/src/lib/eslint/scripts/state/serialize.js b/docs-svelte-kit/src/lib/eslint/scripts/state/serialize.js deleted file mode 100644 index 02d0b8d80..000000000 --- a/docs-svelte-kit/src/lib/eslint/scripts/state/serialize.js +++ /dev/null @@ -1,43 +0,0 @@ -import pako from 'pako'; - -/** - * Get only enabled rules to make the serialized data smaller. - * @param {object} allRules The rule settings. - * @returns {object} The rule settings for the enabled rules. - */ -function getEnabledRules(allRules) { - return Object.keys(allRules).reduce((map, id) => { - if (allRules[id] === 'error') { - map[id] = 2; - } - return map; - }, {}); -} - -/** - * Serialize a given state as a base64 string. - * @param {State} state The state to serialize. - * @returns {string} The serialized string. - */ -export function serializeState(state) { - const saveData = { - code: state.code, - rules: state.rules ? getEnabledRules(state.rules) : undefined, - useEslintPluginSvelte3: state.useEslintPluginSvelte3 - }; - const jsonString = JSON.stringify(saveData); - - const uint8Arr = new TextEncoder().encode(jsonString); - const compressedString = String.fromCharCode(...pako.deflate(uint8Arr)); - const base64 = - (typeof window !== 'undefined' && window.btoa(compressedString)) || compressedString; - - // eslint-disable-next-line no-console -- Demo - console.log( - `The compress rate of serialized string: ${((100 * base64.length) / jsonString.length).toFixed( - 1 - )}% (${jsonString.length}B → ${base64.length}B)` - ); - - return base64; -} diff --git a/docs-svelte-kit/src/lib/eslint/scripts/syntax.js b/docs-svelte-kit/src/lib/eslint/scripts/syntax.js deleted file mode 100644 index cc23d2f39..000000000 --- a/docs-svelte-kit/src/lib/eslint/scripts/syntax.js +++ /dev/null @@ -1,294 +0,0 @@ -export const language = { - defaultToken: '', - tokenPostfix: '.html', - ignoreCase: true, - - // The main tokenizer for our languages - tokenizer: { - root: [ - [/)/, ['delimiter', 'tag', '', 'delimiter']], - [/(<)(script)/, ['delimiter', { token: 'tag', next: '@script' }]], - [/(<)(style)/, ['delimiter', { token: 'tag', next: '@style' }]], - [/(<)((?:[\w-]+:)?[\w-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]], - [/(<\/)((?:[\w-]+:)?[\w-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]], - [/]+/, 'metatag.content'], - [/>/, 'metatag', '@pop'] - ], - - comment: [ - [/-->/, 'comment', '@pop'], - [/[^-]+/, 'comment.content'], - [/./, 'comment.content'] - ], - - otherTag: [ - [/\/?>/, 'delimiter', '@pop'], - [ - /([=])(["'])/, - [ - 'delimiter', - { - token: 'attribute.value', - next: '@attributeValue.$2' - } - ] - ], - [ - /([=])(\s+)(["'])/, - [ - 'delimiter', - '', - { - token: 'attribute.value', - next: '@attributeValue.$3' - } - ] - ], - [/[=]\s*\{/, 'delimiter', '@svelteMustache'], - [/"([^"]*)"/, 'attribute.value'], - [/'([^']*)'/, 'attribute.value'], - [/(\w+)(:)([\w-]+)/, ['keyword.flow', 'delimiter.svelte', 'attribute.name']], - [/[\w-]+/, 'attribute.name'], - [/[=]/, 'delimiter'], - [/[\t\n\r ]+/] // whitespace - ], - - attributeValue: [ - [ - /[\s\S]/, - { - cases: { - '$0==$S2': { token: 'attribute.value', next: '@pop' }, - '$0=={': { token: 'delimiter', next: '@svelteMustache' }, - '@default': { token: 'attribute.value' } - } - } - ] - ], - - // -- BEGIN