diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e57cee6a2..4b84a9b11 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,7 +22,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "npm install --legacy-peer-deps", + "postCreateCommand": "yarn install", // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "node" diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 814b817ba..f99c08e96 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,12 +1,5 @@ # These are supported funding model platforms -github: ota-meshi -# patreon: # Replace with a single Patreon username -# open_collective: # Replace with a single Open Collective username -# ko_fi: # Replace with a single Ko-fi username -# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -# liberapay: # Replace with a single Liberapay username -# issuehunt: # Replace with a single IssueHunt username -# otechie: # Replace with a single Otechie username -# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +github: [ota-meshi, JounQin] +open_collective: rxts +patreon: 1stG diff --git a/.github/workflows/GHPages.yml b/.github/workflows/GHPages.yml index 9b6d0b460..de80c8750 100644 --- a/.github/workflows/GHPages.yml +++ b/.github/workflows/GHPages.yml @@ -13,10 +13,10 @@ jobs: - uses: actions/setup-node@v3 - name: Install And Build run: |+ - npm install --legacy-peer-deps - npm run build + yarn install + yarn build export NODE_OPTIONS="--max-old-space-size=8192" - npm run docs:build + yarn docs:build - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index bd2e27e57..3972ed6c5 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -13,20 +13,22 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Install Packages - run: npm install --legacy-peer-deps + run: yarn install - name: Lint - run: npm run lint + run: |+ + yarn build + yarn lint build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Install Packages - run: npm install --legacy-peer-deps + run: yarn install - name: Build run: |+ - npm run update - npm run build + yarn update + yarn build test: name: "Test for ESLint ${{ matrix.eslint }} on ${{ matrix.node }} OS: ${{matrix.os}}" runs-on: ${{ matrix.os }} @@ -44,10 +46,10 @@ jobs: node-version: ${{ matrix.node }} - name: Install ESLint ${{ matrix.eslint }} run: |+ - npm i -D eslint@${{ matrix.eslint }} --legacy-peer-deps - npx rimraf node_modules + yarn add -D eslint@${{ matrix.eslint }} --ignore-engines + rm -rf node_modules if: matrix.eslint != 8 - name: Install Packages - run: npm install --legacy-peer-deps + run: yarn install --ignore-engines - name: Test - run: npm test + run: yarn test diff --git a/.github/workflows/NpmPublish.yml b/.github/workflows/NpmPublish.yml deleted file mode 100644 index c160eb082..000000000 --- a/.github/workflows/NpmPublish.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: publish -on: - push: - tags: - - "*" -jobs: - release: - name: check version, and release - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup Node - uses: actions/setup-node@v3 - with: - registry-url: "https://registry.npmjs.org" - - name: Install Packages - run: npm install --legacy-peer-deps - - name: test and build - run: | - npm run build - npm run test - - name: check can npm-publish - run: npx can-npm-publish - - name: release - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index dd1ad7772..14f844ab3 100644 --- a/.gitignore +++ b/.gitignore @@ -101,6 +101,7 @@ dist .tern-port ## repo +/yarn.lock /lib /.svelte-kit /build diff --git a/README.md b/README.md index d3b0dc137..495ab2528 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # Introduction -`@ota-meshi/eslint-plugin-svelte` is [ESLint] plugin for [Svelte]. +`eslint-plugin-svelte` is [ESLint] plugin for [Svelte]. It provides many unique check rules by using the template AST. You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-svelte/playground/). -[![NPM license](https://img.shields.io/npm/l/@ota-meshi/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/@ota-meshi/eslint-plugin-svelte) -[![NPM version](https://img.shields.io/npm/v/@ota-meshi/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/@ota-meshi/eslint-plugin-svelte) -[![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads&colorB=green&suffix=/day&query=$.downloads&uri=https://api.npmjs.org//downloads/point/last-day/@ota-meshi/eslint-plugin-svelte&maxAge=3600)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte) -[![NPM downloads](https://img.shields.io/npm/dw/@ota-meshi/eslint-plugin-svelte.svg)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte) -[![NPM downloads](https://img.shields.io/npm/dm/@ota-meshi/eslint-plugin-svelte.svg)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte) -[![NPM downloads](https://img.shields.io/npm/dy/@ota-meshi/eslint-plugin-svelte.svg)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte) -[![NPM downloads](https://img.shields.io/npm/dt/@ota-meshi/eslint-plugin-svelte.svg)](http://www.npmtrends.com/@ota-meshi/eslint-plugin-svelte) +[![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) +[![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads&colorB=green&suffix=/day&query=$.downloads&uri=https://api.npmjs.org//downloads/point/last-day/eslint-plugin-svelte&maxAge=3600)](http://www.npmtrends.com/eslint-plugin-svelte) +[![NPM downloads](https://img.shields.io/npm/dw/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte) +[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte) +[![NPM downloads](https://img.shields.io/npm/dy/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte) +[![NPM downloads](https://img.shields.io/npm/dt/eslint-plugin-svelte.svg)](http://www.npmtrends.com/eslint-plugin-svelte) [![Build Status](https://github.com/ota-meshi/eslint-plugin-svelte/workflows/CI/badge.svg?branch=main)](https://github.com/ota-meshi/eslint-plugin-svelte/actions?query=workflow%3ACI) ## :name_badge: What is this plugin? @@ -26,13 +26,17 @@ The [svelte-eslint-parser] aims to make it easy to create your own rules for the ### ❗ Attention -The [svelte-eslint-parser] and the `@ota-meshi/eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3]. +The [svelte-eslint-parser] and the `eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3]. [svelte-eslint-parser]: https://github.com/ota-meshi/svelte-eslint-parser [eslint-plugin-svelte3]: https://github.com/sveltejs/eslint-plugin-svelte3 +## Migration Guide + +To migrate from `eslint-plugin-svelte` v1, or `@ota-meshi/eslint-plugin-svelte`, please refer to the [migration guide](https://ota-meshi.github.io/eslint-plugin-svelte/migration/). + ## :book: Documentation See [documents](https://ota-meshi.github.io/eslint-plugin-svelte/). @@ -40,7 +44,7 @@ See [documents](https://ota-meshi.github.io/eslint-plugin-svelte/). ## :cd: Installation ```bash -npm install --save-dev eslint @ota-meshi/eslint-plugin-svelte svelte +npm install --save-dev eslint eslint-plugin-svelte svelte ``` > **Requirements** @@ -66,25 +70,25 @@ module.exports = { extends: [ // add more generic rule sets here, such as: // 'eslint:recommended', - "plugin:@ota-meshi/svelte/recommended", + "plugin:svelte/recommended", ], rules: { // override/add rules settings here, such as: - // '@ota-meshi/svelte/rule-name': 'error' + // 'svelte/rule-name': 'error' }, } ``` This plugin provides configs: -- `plugin:@ota-meshi/svelte/base` ... Configuration to enable correct Svelte parsing. -- `plugin:@ota-meshi/svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior. +- `plugin:svelte/base` ... Configuration to enable correct Svelte parsing. +- `plugin:svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior. See [the rule list](https://ota-meshi.github.io/eslint-plugin-svelte/rules/) to get the `rules` that this plugin provides. ::: warning ❗ Attention -The `@ota-meshi/eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3]. +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 @@ -104,7 +108,7 @@ For example, if you are using the `"@babel/eslint-parser"`, configure it as foll ```js module.exports = { // ... - extends: ["plugin:@ota-meshi/svelte/recommended"], + extends: ["plugin:svelte/recommended"], // ... parser: "@babel/eslint-parser", // Add an `overrides` section to add a parser configuration for svelte. @@ -124,7 +128,7 @@ For example, if you are using the `"@typescript-eslint/parser"`, and if you want ```js module.exports = { // ... - extends: ["plugin:@ota-meshi/svelte/recommended"], + extends: ["plugin:svelte/recommended"], // ... parser: "@typescript-eslint/parser", parserOptions: { @@ -173,13 +177,13 @@ module.exports = { See also [https://github.com/ota-meshi/svelte-eslint-parser#readme](https://github.com/ota-meshi/svelte-eslint-parser#readme). -#### settings["@ota-meshi/svelte"] +#### settings.svelte You can change the behavior of this plugin with some settings. - `ignoreWarnings` (optional) ... Specifies an array of rules that ignore reports in the template. For example, set rules on the template that cannot avoid false positives. -- `compileOptions` (optional) ... Specifies options for Svelte compile. Effects rules that use Svelte compile. The target rules are [@ota-meshi/svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile/) and [@ota-meshi/svelte/no-unused-svelte-ignore](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/). **Note that it has no effect on ESLint's custom parser**. +- `compileOptions` (optional) ... Specifies options for Svelte compile. Effects rules that use Svelte compile. The target rules are [svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile/) and [svelte/no-unused-svelte-ignore](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/). **Note that it has no effect on ESLint's custom parser**. - `postcss` (optional) ... Specifies options related to PostCSS. You can disable the PostCSS process by specifying `false`. - `configFilePath` (optional) ... Specifies the path of the directory containing the PostCSS configuration. @@ -189,7 +193,7 @@ e.g. module.exports = { // ... settings: { - "@ota-meshi/svelte": { + svelte: { ignoreWarnings: [ "@typescript-eslint/no-unsafe-assignment", "@typescript-eslint/no-unsafe-member-access", @@ -250,14 +254,14 @@ These rules relate to possible syntax or logic errors in Svelte code: | Rule ID | Description | | |:--------|:------------|:---| -| [@ota-meshi/svelte/no-dupe-else-if-blocks](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-else-if-blocks/) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: | -| [@ota-meshi/svelte/no-dupe-style-properties](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-style-properties/) | disallow duplicate style properties | :star: | -| [@ota-meshi/svelte/no-dynamic-slot-name](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | disallow dynamic slot name | :star::wrench: | -| [@ota-meshi/svelte/no-not-function-handler](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-not-function-handler/) | disallow use of not function in event handler | :star: | -| [@ota-meshi/svelte/no-object-in-text-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches/) | disallow objects in text mustache interpolation | :star: | -| [@ota-meshi/svelte/no-shorthand-style-property-overrides](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-shorthand-style-property-overrides/) | disallow shorthand style properties that override related longhand properties | :star: | -| [@ota-meshi/svelte/no-unknown-style-directive-property](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unknown-style-directive-property/) | disallow unknown `style:property` | :star: | -| [@ota-meshi/svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile/) | disallow warnings when compiling. | :star: | +| [svelte/no-dupe-else-if-blocks](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-else-if-blocks/) | disallow duplicate conditions in `{#if}` / `{:else if}` chains | :star: | +| [svelte/no-dupe-style-properties](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-style-properties/) | disallow duplicate style properties | :star: | +| [svelte/no-dynamic-slot-name](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | disallow dynamic slot name | :star::wrench: | +| [svelte/no-not-function-handler](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-not-function-handler/) | disallow use of not function in event handler | :star: | +| [svelte/no-object-in-text-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches/) | disallow objects in text mustache interpolation | :star: | +| [svelte/no-shorthand-style-property-overrides](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-shorthand-style-property-overrides/) | disallow shorthand style properties that override related longhand properties | :star: | +| [svelte/no-unknown-style-directive-property](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unknown-style-directive-property/) | disallow unknown `style:property` | :star: | +| [svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile/) | disallow warnings when compiling. | :star: | ## Security Vulnerability @@ -265,8 +269,8 @@ These rules relate to security vulnerabilities in Svelte code: | Rule ID | Description | | |:--------|:------------|:---| -| [@ota-meshi/svelte/no-at-html-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-html-tags/) | disallow use of `{@html}` to prevent XSS attack | :star: | -| [@ota-meshi/svelte/no-target-blank](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-target-blank/) | disallow `target="_blank"` attribute without `rel="noopener noreferrer"` | | +| [svelte/no-at-html-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-html-tags/) | disallow use of `{@html}` to prevent XSS attack | :star: | +| [svelte/no-target-blank](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-target-blank/) | disallow `target="_blank"` attribute without `rel="noopener noreferrer"` | | ## Best Practices @@ -274,11 +278,11 @@ These rules relate to better ways of doing things to help you avoid problems: | Rule ID | Description | | |:--------|:------------|:---| -| [@ota-meshi/svelte/button-has-type](https://ota-meshi.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute | | -| [@ota-meshi/svelte/no-at-debug-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: | -| [@ota-meshi/svelte/no-unused-svelte-ignore](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/) | disallow unused svelte-ignore comments | :star: | -| [@ota-meshi/svelte/no-useless-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :wrench: | -| [@ota-meshi/svelte/require-optimized-style-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/require-optimized-style-attribute/) | require style attributes that can be optimized | | +| [svelte/button-has-type](https://ota-meshi.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute | | +| [svelte/no-at-debug-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: | +| [svelte/no-unused-svelte-ignore](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/) | disallow unused svelte-ignore comments | :star: | +| [svelte/no-useless-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :wrench: | +| [svelte/require-optimized-style-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/require-optimized-style-attribute/) | require style attributes that can be optimized | | ## Stylistic Issues @@ -286,16 +290,16 @@ These rules relate to style guidelines, and are therefore quite subjective: | Rule ID | Description | | |:--------|:------------|:---| -| [@ota-meshi/svelte/first-attribute-linebreak](https://ota-meshi.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak/) | enforce the location of first attribute | :wrench: | -| [@ota-meshi/svelte/html-quotes](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-quotes/) | enforce quotes style of HTML attributes | :wrench: | -| [@ota-meshi/svelte/indent](https://ota-meshi.github.io/eslint-plugin-svelte/rules/indent/) | enforce consistent indentation | :wrench: | -| [@ota-meshi/svelte/max-attributes-per-line](https://ota-meshi.github.io/eslint-plugin-svelte/rules/max-attributes-per-line/) | enforce the maximum number of attributes per line | :wrench: | -| [@ota-meshi/svelte/mustache-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/mustache-spacing/) | enforce unified spacing in mustache | :wrench: | -| [@ota-meshi/svelte/prefer-class-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-class-directive/) | require class directives instead of ternary expressions | :wrench: | -| [@ota-meshi/svelte/prefer-style-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-style-directive/) | require style directives instead of style attribute | :wrench: | -| [@ota-meshi/svelte/shorthand-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-attribute/) | enforce use of shorthand syntax in attribute | :wrench: | -| [@ota-meshi/svelte/shorthand-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-directive/) | enforce use of shorthand syntax in directives | :wrench: | -| [@ota-meshi/svelte/spaced-html-comment](https://ota-meshi.github.io/eslint-plugin-svelte/rules/spaced-html-comment/) | enforce consistent spacing after the `` in a HTML comment | :wrench: | +| [svelte/first-attribute-linebreak](https://ota-meshi.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak/) | enforce the location of first attribute | :wrench: | +| [svelte/html-quotes](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-quotes/) | enforce quotes style of HTML attributes | :wrench: | +| [svelte/indent](https://ota-meshi.github.io/eslint-plugin-svelte/rules/indent/) | enforce consistent indentation | :wrench: | +| [svelte/max-attributes-per-line](https://ota-meshi.github.io/eslint-plugin-svelte/rules/max-attributes-per-line/) | enforce the maximum number of attributes per line | :wrench: | +| [svelte/mustache-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/mustache-spacing/) | enforce unified spacing in mustache | :wrench: | +| [svelte/prefer-class-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-class-directive/) | require class directives instead of ternary expressions | :wrench: | +| [svelte/prefer-style-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/prefer-style-directive/) | require style directives instead of style attribute | :wrench: | +| [svelte/shorthand-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-attribute/) | enforce use of shorthand syntax in attribute | :wrench: | +| [svelte/shorthand-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/shorthand-directive/) | enforce use of shorthand syntax in directives | :wrench: | +| [svelte/spaced-html-comment](https://ota-meshi.github.io/eslint-plugin-svelte/rules/spaced-html-comment/) | enforce consistent spacing after the `` in a HTML comment | :wrench: | ## Extension Rules @@ -303,7 +307,7 @@ These rules extend the rules provided by ESLint itself to work well in Svelte: | Rule ID | Description | | |:--------|:------------|:---| -| [@ota-meshi/svelte/no-inner-declarations](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-inner-declarations/) | disallow variable or `function` declarations in nested blocks | :star: | +| [svelte/no-inner-declarations](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-inner-declarations/) | disallow variable or `function` declarations in nested blocks | :star: | ## System @@ -311,8 +315,8 @@ These rules relate to this plugin works: | Rule ID | Description | | |:--------|:------------|:---| -| [@ota-meshi/svelte/comment-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/comment-directive/) | support comment-directives in HTML template | :star: | -| [@ota-meshi/svelte/system](https://ota-meshi.github.io/eslint-plugin-svelte/rules/system/) | system rule for working this plugin | :star: | +| [svelte/comment-directive](https://ota-meshi.github.io/eslint-plugin-svelte/rules/comment-directive/) | support comment-directives in HTML template | :star: | +| [svelte/system](https://ota-meshi.github.io/eslint-plugin-svelte/rules/system/) | system rule for working this plugin | :star: | @@ -327,8 +331,8 @@ Please use GitHub's Issues/PRs. ### Development Tools -- `npm test` runs tests and measures coverage. -- `npm run update` runs in order to update readme and recommended configuration. +- `yarn test` runs tests and measures coverage. +- `yarn update` runs in order to update readme and recommended configuration. ### Working With Rules diff --git a/docs-svelte-kit/.eslintrc.cjs b/docs-svelte-kit/.eslintrc.cjs index b10db881a..bddda3031 100644 --- a/docs-svelte-kit/.eslintrc.cjs +++ b/docs-svelte-kit/.eslintrc.cjs @@ -1,6 +1,6 @@ // eslint-disable-next-line no-undef -- ignore module.exports = { - extends: ["plugin:@ota-meshi/svelte/recommended"], + extends: ["plugin:svelte/recommended"], env: { browser: true, es2022: true, @@ -9,11 +9,11 @@ module.exports = { sourceType: "module", }, rules: { - "@ota-meshi/svelte/no-target-blank": "error", - "@ota-meshi/svelte/button-has-type": "error", - "@ota-meshi/svelte/no-useless-mustaches": "error", - "@ota-meshi/svelte/prefer-class-directive": "error", - "@ota-meshi/svelte/prefer-style-directive": "error", - "@ota-meshi/svelte/spaced-html-comment": "error", + "svelte/no-target-blank": "error", + "svelte/button-has-type": "error", + "svelte/no-useless-mustaches": "error", + "svelte/prefer-class-directive": "error", + "svelte/prefer-style-directive": "error", + "svelte/spaced-html-comment": "error", }, } diff --git a/docs-svelte-kit/src/app.html b/docs-svelte-kit/src/app.html index 875a9e51e..af3ddc5bf 100644 --- a/docs-svelte-kit/src/app.html +++ b/docs-svelte-kit/src/app.html @@ -15,7 +15,7 @@ property="og:image" content="https://ota-meshi.github.io/eslint-plugin-svelte/favicon.png" /> - + + ` @@ -40,7 +40,7 @@ This rule aims to warn if no type or an invalid type is used on a button type at ```json { - "@ota-meshi/svelte/button-has-type": [ + "svelte/button-has-type": [ "error", { "button": true, @@ -63,7 +63,7 @@ This rule aims to warn if no type or an invalid type is used on a button type at ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.0.4 +This rule was introduced in eslint-plugin-svelte v0.0.4 ## :mag: Implementation diff --git a/docs/rules/comment-directive.md b/docs/rules/comment-directive.md index 54f3ec154..2b688adcf 100644 --- a/docs/rules/comment-directive.md +++ b/docs/rules/comment-directive.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/comment-directive" +title: "svelte/comment-directive" description: "support comment-directives in HTML template" since: "v0.0.13" --- -# @ota-meshi/svelte/comment-directive +# svelte/comment-directive > support comment-directives in HTML template -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/base"` and `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/base"` and `"plugin:svelte/recommended"`. Sole purpose of this rule is to provide `eslint-disable` functionality in the template HTML. It supports usage of the following comments: @@ -36,7 +36,7 @@ This rule sends all `eslint-disable`-like comments to the post-process of the `. ```svelte @@ -53,7 +53,7 @@ The `eslint-disable`-like comments can include descriptions to explain why the c ```svelte @@ -74,7 +74,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.0.13 +This rule was introduced in eslint-plugin-svelte v0.0.13 ## :mag: Implementation diff --git a/docs/rules/first-attribute-linebreak.md b/docs/rules/first-attribute-linebreak.md index c0887b8ef..b7d02de0a 100644 --- a/docs/rules/first-attribute-linebreak.md +++ b/docs/rules/first-attribute-linebreak.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/first-attribute-linebreak" +title: "svelte/first-attribute-linebreak" description: "enforce the location of first attribute" since: "v0.6.0" --- -# @ota-meshi/svelte/first-attribute-linebreak +# svelte/first-attribute-linebreak > enforce the location of first attribute @@ -23,7 +23,7 @@ This rule aims to enforce a consistent location for the first attribute. ```svelte @@ -50,7 +50,7 @@ This rule aims to enforce a consistent location for the first attribute. ```json { - "@ota-meshi/svelte/first-attribute-linebreak": [ + "svelte/first-attribute-linebreak": [ "error", { "multiline": "below", // or "beside" @@ -69,13 +69,13 @@ This rule aims to enforce a consistent location for the first attribute. ## :couple: Related Rules -- [@ota-meshi/svelte/max-attributes-per-line] +- [svelte/max-attributes-per-line] -[@ota-meshi/svelte/max-attributes-per-line]: ./max-attributes-per-line.md +[svelte/max-attributes-per-line]: ./max-attributes-per-line.md ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.6.0 +This rule was introduced in eslint-plugin-svelte v0.6.0 ## :mag: Implementation diff --git a/docs/rules/html-quotes.md b/docs/rules/html-quotes.md index a74f71c2b..98bcee22d 100644 --- a/docs/rules/html-quotes.md +++ b/docs/rules/html-quotes.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/html-quotes" +title: "svelte/html-quotes" description: "enforce quotes style of HTML attributes" since: "v0.5.0" --- -# @ota-meshi/svelte/html-quotes +# svelte/html-quotes > enforce quotes style of HTML attributes @@ -29,7 +29,7 @@ This rule enforces the quotes style of HTML attributes. ```svelte @@ -49,7 +49,7 @@ This rule enforces the quotes style of HTML attributes. ```json { - "@ota-meshi/svelte/html-quotes": [ + "svelte/html-quotes": [ "error", { "prefer": "double", // or "single" @@ -69,7 +69,7 @@ This rule enforces the quotes style of HTML attributes. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.5.0 +This rule was introduced in eslint-plugin-svelte v0.5.0 ## :mag: Implementation diff --git a/docs/rules/indent.md b/docs/rules/indent.md index 6d6104664..0d5a59101 100644 --- a/docs/rules/indent.md +++ b/docs/rules/indent.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/indent" +title: "svelte/indent" description: "enforce consistent indentation" since: "v0.3.0" --- -# @ota-meshi/svelte/indent +# svelte/indent > enforce consistent indentation @@ -26,7 +26,7 @@ This rule enforces a consistent indentation style in `.svelte`. The default styl ```svelte @@ -63,7 +63,7 @@ This rule only checks `.svelte` files and does not interfere with other `.js` fi { "files": ["*.svelte"], "rules": { - "@ota-meshi/svelte/indent": "error", + "svelte/indent": "error", "indent": "off" } } @@ -75,7 +75,7 @@ This rule only checks `.svelte` files and does not interfere with other `.js` fi ```json { - "@ota-meshi/svelte/indent": [ + "svelte/indent": [ "error", { "indent": 2, @@ -94,7 +94,7 @@ This rule only checks `.svelte` files and does not interfere with other `.js` fi ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.3.0 +This rule was introduced in eslint-plugin-svelte v0.3.0 ## :mag: Implementation diff --git a/docs/rules/max-attributes-per-line.md b/docs/rules/max-attributes-per-line.md index 297e80366..ac4b6a7d2 100644 --- a/docs/rules/max-attributes-per-line.md +++ b/docs/rules/max-attributes-per-line.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/max-attributes-per-line" +title: "svelte/max-attributes-per-line" description: "enforce the maximum number of attributes per line" since: "v0.2.0" --- -# @ota-meshi/svelte/max-attributes-per-line +# svelte/max-attributes-per-line > enforce the maximum number of attributes per line @@ -28,7 +28,7 @@ There is a configurable number of attributes that are acceptable in one-line cas ```svelte @@ -64,7 +64,7 @@ There is a configurable number of attributes that are acceptable in one-line cas ```json { - "@ota-meshi/svelte/max-attributes-per-line": [ + "svelte/max-attributes-per-line": [ "error", { "multiline": 1, @@ -79,13 +79,13 @@ There is a configurable number of attributes that are acceptable in one-line cas ## :couple: Related Rules -- [@ota-meshi/svelte/first-attribute-linebreak] +- [svelte/first-attribute-linebreak] -[@ota-meshi/svelte/first-attribute-linebreak]: ./first-attribute-linebreak.md +[svelte/first-attribute-linebreak]: ./first-attribute-linebreak.md ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.2.0 +This rule was introduced in eslint-plugin-svelte v0.2.0 ## :mag: Implementation diff --git a/docs/rules/mustache-spacing.md b/docs/rules/mustache-spacing.md index 25a86fe72..be21b9952 100644 --- a/docs/rules/mustache-spacing.md +++ b/docs/rules/mustache-spacing.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/mustache-spacing" +title: "svelte/mustache-spacing" description: "enforce unified spacing in mustache" since: "v0.15.0" --- -# @ota-meshi/svelte/mustache-spacing +# svelte/mustache-spacing > enforce unified spacing in mustache @@ -23,7 +23,7 @@ This rule aims at enforcing unified spacing in mustaches. ```svelte @@ -65,7 +65,7 @@ This rule aims at enforcing unified spacing in mustaches. ```json { - "@ota-meshi/svelte/mustache-spacing": [ + "svelte/mustache-spacing": [ "error", { "textExpressions": "never", // or "always" @@ -90,7 +90,7 @@ This rule aims at enforcing unified spacing in mustaches. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.15.0 +This rule was introduced in eslint-plugin-svelte v0.15.0 ## :mag: Implementation diff --git a/docs/rules/no-at-debug-tags.md b/docs/rules/no-at-debug-tags.md index 96a564f5e..fb7efe3d4 100644 --- a/docs/rules/no-at-debug-tags.md +++ b/docs/rules/no-at-debug-tags.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-at-debug-tags" +title: "svelte/no-at-debug-tags" description: "disallow the use of `{@debug}`" since: "v0.0.1" --- -# @ota-meshi/svelte/no-at-debug-tags +# svelte/no-at-debug-tags > disallow the use of `{@debug}` -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. ## :book: Rule Details @@ -24,7 +24,7 @@ The `{@debug}` should be removed when you no longer need it after you use it for ```svelte @@ -45,7 +45,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.0.1 +This rule was introduced in eslint-plugin-svelte v0.0.1 ## :mag: Implementation diff --git a/docs/rules/no-at-html-tags.md b/docs/rules/no-at-html-tags.md index 7ac24660d..bf9e764ec 100644 --- a/docs/rules/no-at-html-tags.md +++ b/docs/rules/no-at-html-tags.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-at-html-tags" +title: "svelte/no-at-html-tags" description: "disallow use of `{@html}` to prevent XSS attack" since: "v0.0.1" --- -# @ota-meshi/svelte/no-at-html-tags +# svelte/no-at-html-tags > disallow use of `{@html}` to prevent XSS attack -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. ## :book: Rule Details @@ -22,7 +22,7 @@ This rule reports all uses of `{@html}` in order to reduce the risk of injecting ```svelte @@ -48,7 +48,7 @@ If you are certain the content passed to `{@html}` is sanitized HTML you can dis ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.0.1 +This rule was introduced in eslint-plugin-svelte v0.0.1 ## :mag: Implementation diff --git a/docs/rules/no-dupe-else-if-blocks.md b/docs/rules/no-dupe-else-if-blocks.md index e16340c7d..528a75c2a 100644 --- a/docs/rules/no-dupe-else-if-blocks.md +++ b/docs/rules/no-dupe-else-if-blocks.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-dupe-else-if-blocks" +title: "svelte/no-dupe-else-if-blocks" description: "disallow duplicate conditions in `{#if}` / `{:else if}` chains" since: "v0.0.1" --- -# @ota-meshi/svelte/no-dupe-else-if-blocks +# svelte/no-dupe-else-if-blocks > disallow duplicate conditions in `{#if}` / `{:else if}` chains -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. ## :book: Rule Details @@ -22,7 +22,7 @@ This rule disallows duplicate conditions in the same `{#if}` / `{:else if}` chai ```svelte @@ -65,7 +65,7 @@ This rule can also detect some cases where the conditions are not identical, but ```svelte @@ -124,7 +124,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.0.1 +This rule was introduced in eslint-plugin-svelte v0.0.1 ## :mag: Implementation diff --git a/docs/rules/no-dupe-style-properties.md b/docs/rules/no-dupe-style-properties.md index fbd380561..d0bb2a45a 100644 --- a/docs/rules/no-dupe-style-properties.md +++ b/docs/rules/no-dupe-style-properties.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-dupe-style-properties" +title: "svelte/no-dupe-style-properties" description: "disallow duplicate style properties" since: "v0.31.0" --- -# @ota-meshi/svelte/no-dupe-style-properties +# svelte/no-dupe-style-properties > disallow duplicate style properties -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. ## :book: Rule Details @@ -22,7 +22,7 @@ This rule reports duplicate style properties. ```svelte @@ -43,7 +43,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.31.0 +This rule was introduced in eslint-plugin-svelte v0.31.0 ## :mag: Implementation diff --git a/docs/rules/no-dynamic-slot-name.md b/docs/rules/no-dynamic-slot-name.md index 31dc34033..303a319a4 100644 --- a/docs/rules/no-dynamic-slot-name.md +++ b/docs/rules/no-dynamic-slot-name.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-dynamic-slot-name" +title: "svelte/no-dynamic-slot-name" description: "disallow dynamic slot name" since: "v0.14.0" --- -# @ota-meshi/svelte/no-dynamic-slot-name +# svelte/no-dynamic-slot-name > disallow dynamic slot name -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. - :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. ## :book: Rule Details @@ -26,7 +26,7 @@ The auto-fix of this rule can be replaced with a static `` name if the exp ```svelte @@ -45,7 +45,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.14.0 +This rule was introduced in eslint-plugin-svelte v0.14.0 ## :mag: Implementation diff --git a/docs/rules/no-inner-declarations.md b/docs/rules/no-inner-declarations.md index 4d8bf06f6..b8df8f03c 100644 --- a/docs/rules/no-inner-declarations.md +++ b/docs/rules/no-inner-declarations.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-inner-declarations" +title: "svelte/no-inner-declarations" description: "disallow variable or `function` declarations in nested blocks" since: "v0.0.8" --- -# @ota-meshi/svelte/no-inner-declarations +# svelte/no-inner-declarations > disallow variable or `function` declarations in nested blocks -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. ## :book: Rule Details @@ -27,7 +27,7 @@ This rule supports [svelte-eslint-parser]'s AST. ```svelte @@ -44,13 +44,13 @@ Nothing. ## :couple: Related Rules -- [@ota-meshi/svelte/no-not-function-handler] +- [svelte/no-not-function-handler] -[@ota-meshi/svelte/no-not-function-handler]: ./no-not-function-handler.md +[svelte/no-not-function-handler]: ./no-not-function-handler.md ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.5.0 +This rule was introduced in eslint-plugin-svelte v0.5.0 ## :mag: Implementation diff --git a/docs/rules/no-shorthand-style-property-overrides.md b/docs/rules/no-shorthand-style-property-overrides.md index cbeeb8415..974459c85 100644 --- a/docs/rules/no-shorthand-style-property-overrides.md +++ b/docs/rules/no-shorthand-style-property-overrides.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-shorthand-style-property-overrides" +title: "svelte/no-shorthand-style-property-overrides" description: "disallow shorthand style properties that override related longhand properties" since: "v0.31.0" --- -# @ota-meshi/svelte/no-shorthand-style-property-overrides +# svelte/no-shorthand-style-property-overrides > disallow shorthand style properties that override related longhand properties -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. ## :book: Rule Details @@ -24,7 +24,7 @@ This rule was inspired by [Stylelint's declaration-block-no-shorthand-property-o ```svelte @@ -53,7 +53,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.31.0 +This rule was introduced in eslint-plugin-svelte v0.31.0 ## :mag: Implementation diff --git a/docs/rules/no-target-blank.md b/docs/rules/no-target-blank.md index bd42a39c0..6ca6e5d2e 100644 --- a/docs/rules/no-target-blank.md +++ b/docs/rules/no-target-blank.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-target-blank" +title: "svelte/no-target-blank" description: "disallow `target=\"_blank\"` attribute without `rel=\"noopener noreferrer\"`" since: "v0.0.4" --- -# @ota-meshi/svelte/no-target-blank +# svelte/no-target-blank > disallow `target="_blank"` attribute without `rel="noopener noreferrer"` @@ -20,7 +20,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor ```svelte @@ -36,7 +36,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor ```json { - "@ota-meshi/svelte/no-target-blank": [ + "svelte/no-target-blank": [ "error", { "allowReferrer": true, @@ -57,7 +57,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor ```svelte @@ -77,7 +77,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor ```svelte @@ -97,7 +97,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor ```svelte @@ -117,7 +117,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor ```svelte @@ -131,7 +131,7 @@ This rule disallows using `target="_blank"` attribute without `rel="noopener nor ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.0.4 +This rule was introduced in eslint-plugin-svelte v0.0.4 ## :mag: Implementation diff --git a/docs/rules/no-unknown-style-directive-property.md b/docs/rules/no-unknown-style-directive-property.md index 1f1ae89e1..d9fa03d59 100644 --- a/docs/rules/no-unknown-style-directive-property.md +++ b/docs/rules/no-unknown-style-directive-property.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-unknown-style-directive-property" +title: "svelte/no-unknown-style-directive-property" description: "disallow unknown `style:property`" since: "v0.31.0" --- -# @ota-meshi/svelte/no-unknown-style-directive-property +# svelte/no-unknown-style-directive-property > disallow unknown `style:property` -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. ## :book: Rule Details @@ -26,7 +26,7 @@ Note that this rule only checks the `style:property` directive. If you want to c ```svelte @@ -46,7 +46,7 @@ Note that this rule only checks the `style:property` directive. If you want to c ```json { - "@ota-meshi/svelte/no-unknown-style-directive-property": [ + "svelte/no-unknown-style-directive-property": [ "error", { "ignoreProperties": [], @@ -67,7 +67,7 @@ Note that this rule only checks the `style:property` directive. If you want to c ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.31.0 +This rule was introduced in eslint-plugin-svelte v0.31.0 ## :mag: Implementation diff --git a/docs/rules/no-unused-svelte-ignore.md b/docs/rules/no-unused-svelte-ignore.md index 043e7a632..a5dab01ab 100644 --- a/docs/rules/no-unused-svelte-ignore.md +++ b/docs/rules/no-unused-svelte-ignore.md @@ -1,16 +1,16 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-unused-svelte-ignore" +title: "svelte/no-unused-svelte-ignore" description: "disallow unused svelte-ignore comments" since: "v0.19.0" --- -# @ota-meshi/svelte/no-unused-svelte-ignore +# svelte/no-unused-svelte-ignore > disallow unused svelte-ignore comments -- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`. +- :gear: This rule is included in `"plugin:svelte/recommended"`. ## :book: Rule Details @@ -22,7 +22,7 @@ This rule warns unnecessary `svelte-ignore` comments. ```svelte @@ -46,7 +46,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.19.0 +This rule was introduced in eslint-plugin-svelte v0.19.0 ## :mag: Implementation diff --git a/docs/rules/no-useless-mustaches.md b/docs/rules/no-useless-mustaches.md index 44fb1cce8..bc183f877 100644 --- a/docs/rules/no-useless-mustaches.md +++ b/docs/rules/no-useless-mustaches.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/no-useless-mustaches" +title: "svelte/no-useless-mustaches" description: "disallow unnecessary mustache interpolations" since: "v0.0.4" --- -# @ota-meshi/svelte/no-useless-mustaches +# svelte/no-useless-mustaches > disallow unnecessary mustache interpolations @@ -23,7 +23,7 @@ The mustache interpolation with a string literal value can be changed to a stati ```svelte @@ -44,7 +44,7 @@ Lorem ipsum {foo} ```json { - "@ota-meshi/svelte/no-useless-mustaches": [ + "svelte/no-useless-mustaches": [ "error", { "ignoreIncludesComment": false, @@ -65,7 +65,7 @@ Lorem ipsum {foo} ```svelte @@ -91,7 +91,7 @@ Lorem ipsum {foo} ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.0.4 +This rule was introduced in eslint-plugin-svelte v0.0.4 ## :mag: Implementation diff --git a/docs/rules/prefer-class-directive.md b/docs/rules/prefer-class-directive.md index b6a542b7c..34f6c05cb 100644 --- a/docs/rules/prefer-class-directive.md +++ b/docs/rules/prefer-class-directive.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/prefer-class-directive" +title: "svelte/prefer-class-directive" description: "require class directives instead of ternary expressions" since: "v0.0.1" --- -# @ota-meshi/svelte/prefer-class-directive +# svelte/prefer-class-directive > require class directives instead of ternary expressions @@ -22,7 +22,7 @@ This rule aims to replace a class with ternary operator with the class directive ```svelte @@ -44,9 +44,9 @@ Nothing. ## :couple: Related Rules -- [@ota-meshi/svelte/prefer-style-directive] +- [svelte/prefer-style-directive] -[@ota-meshi/svelte/prefer-style-directive]: ./prefer-style-directive.md +[svelte/prefer-style-directive]: ./prefer-style-directive.md ## :books: Further Reading @@ -54,7 +54,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.0.1 +This rule was introduced in eslint-plugin-svelte v0.0.1 ## :mag: Implementation diff --git a/docs/rules/prefer-style-directive.md b/docs/rules/prefer-style-directive.md index 96313b3d7..bb369ebf9 100644 --- a/docs/rules/prefer-style-directive.md +++ b/docs/rules/prefer-style-directive.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/prefer-style-directive" +title: "svelte/prefer-style-directive" description: "require style directives instead of style attribute" since: "v0.22.0" --- -# @ota-meshi/svelte/prefer-style-directive +# svelte/prefer-style-directive > require style directives instead of style attribute @@ -25,7 +25,7 @@ Style directive were added in Svelte v3.46. ```svelte @@ -62,9 +62,9 @@ Nothing. ## :couple: Related Rules -- [@ota-meshi/svelte/prefer-class-directive] +- [svelte/prefer-class-directive] -[@ota-meshi/svelte/prefer-class-directive]: ./prefer-class-directive.md +[svelte/prefer-class-directive]: ./prefer-class-directive.md ## :books: Further Reading @@ -72,7 +72,7 @@ Nothing. ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.22.0 +This rule was introduced in eslint-plugin-svelte v0.22.0 ## :mag: Implementation diff --git a/docs/rules/require-optimized-style-attribute.md b/docs/rules/require-optimized-style-attribute.md index f844f30b5..2cbe11b6b 100644 --- a/docs/rules/require-optimized-style-attribute.md +++ b/docs/rules/require-optimized-style-attribute.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/require-optimized-style-attribute" +title: "svelte/require-optimized-style-attribute" description: "require style attributes that can be optimized" since: "v0.32.0" --- -# @ota-meshi/svelte/require-optimized-style-attribute +# svelte/require-optimized-style-attribute > require style attributes that can be optimized @@ -77,7 +77,7 @@ Examples: ```svelte @@ -41,7 +41,7 @@ This rule enforces the use of the shorthand syntax in attribute. ```json { - "@ota-meshi/svelte/shorthand-attribute": [ + "svelte/shorthand-attribute": [ "error", { "prefer": "always" // "never" @@ -56,13 +56,13 @@ This rule enforces the use of the shorthand syntax in attribute. ## :couple: Related Rules -- [@ota-meshi/svelte/shorthand-directive] +- [svelte/shorthand-directive] -[@ota-meshi/svelte/shorthand-directive]: ./shorthand-directive.md +[svelte/shorthand-directive]: ./shorthand-directive.md ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.5.0 +This rule was introduced in eslint-plugin-svelte v0.5.0 ## :mag: Implementation diff --git a/docs/rules/shorthand-directive.md b/docs/rules/shorthand-directive.md index edc7493cd..f05cfb691 100644 --- a/docs/rules/shorthand-directive.md +++ b/docs/rules/shorthand-directive.md @@ -1,12 +1,12 @@ --- pageClass: "rule-details" sidebarDepth: 0 -title: "@ota-meshi/svelte/shorthand-directive" +title: "svelte/shorthand-directive" description: "enforce use of shorthand syntax in directives" since: "v0.24.0" --- -# @ota-meshi/svelte/shorthand-directive +# svelte/shorthand-directive > enforce use of shorthand syntax in directives @@ -23,7 +23,7 @@ This rule enforces the use of the shorthand syntax in directives. ```svelte @@ -41,7 +41,7 @@ Note that we exclude reports for some checks, such as `missing-declaration`, and ```json { - "@ota-meshi/svelte/valid-compile": [ + "svelte/valid-compile": [ "error", { "ignoreWarnings": false @@ -58,7 +58,7 @@ Note that we exclude reports for some checks, such as `missing-declaration`, and ```svelte @@ -70,7 +70,7 @@ Note that we exclude reports for some checks, such as `missing-declaration`, and ## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte v0.7.0 +This rule was introduced in eslint-plugin-svelte v0.7.0 ## :mag: Implementation diff --git a/docs/user-guide.md b/docs/user-guide.md index 452f8af9b..094593e26 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -3,7 +3,7 @@ ## :cd: Installation ```bash -npm install --save-dev eslint @ota-meshi/eslint-plugin-svelte svelte +npm install --save-dev eslint eslint-plugin-svelte svelte ``` ::: tip Requirements @@ -28,25 +28,25 @@ module.exports = { extends: [ // add more generic rule sets here, such as: // 'eslint:recommended', - "plugin:@ota-meshi/svelte/recommended", + "plugin:svelte/recommended", ], rules: { // override/add rules settings here, such as: - // '@ota-meshi/svelte/rule-name': 'error' + // 'svelte/rule-name': 'error' }, } ``` This plugin provides configs: -- `plugin:@ota-meshi/svelte/base` ... Configuration to enable correct Svelte parsing. -- `plugin:@ota-meshi/svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior. +- `plugin:svelte/base` ... Configuration to enable correct Svelte parsing. +- `plugin:svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior. See [the rule list](./rules.md) to get the `rules` that this plugin provides. ::: warning ❗ Attention -The `@ota-meshi/eslint-plugin-svelte` can not be used with the [eslint-plugin-svelte3]. +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 @@ -66,7 +66,7 @@ For example, if you are using the `"@babel/eslint-parser"`, configure it as foll ```js module.exports = { // ... - extends: ["plugin:@ota-meshi/svelte/recommended"], + extends: ["plugin:svelte/recommended"], // ... parser: "@babel/eslint-parser", // Add an `overrides` section to add a parser configuration for svelte. @@ -86,7 +86,7 @@ For example, if you are using the `"@typescript-eslint/parser"`, and if you want ```js module.exports = { // ... - extends: ["plugin:@ota-meshi/svelte/recommended"], + extends: ["plugin:svelte/recommended"], // ... parser: "@typescript-eslint/parser", parserOptions: { @@ -135,13 +135,13 @@ module.exports = { See also [https://github.com/ota-meshi/svelte-eslint-parser#readme](https://github.com/ota-meshi/svelte-eslint-parser#readme). -#### settings["@ota-meshi/svelte"] +#### settings.svelte You can change the behavior of this plugin with some settings. - `ignoreWarnings` (optional) ... Specifies an array of rules that ignore reports in the template. For example, set rules on the template that cannot avoid false positives. -- `compileOptions` (optional) ... Specifies options for Svelte compile. Effects rules that use Svelte compile. The target rules are [@ota-meshi/svelte/valid-compile](./rules/valid-compile.md) and [@ota-meshi/svelte/no-unused-svelte-ignore](./rules/no-unused-svelte-ignore.md). **Note that it has no effect on ESLint's custom parser**. +- `compileOptions` (optional) ... Specifies options for Svelte compile. Effects rules that use Svelte compile. The target rules are [svelte/valid-compile](./rules/valid-compile.md) and [svelte/no-unused-svelte-ignore](./rules/no-unused-svelte-ignore.md). **Note that it has no effect on ESLint's custom parser**. - `postcss` (optional) ... Specifies options related to PostCSS. You can disable the PostCSS process by specifying `false`. - `configFilePath` (optional) ... Specifies the path of the directory containing the PostCSS configuration. @@ -151,7 +151,7 @@ e.g. module.exports = { // ... settings: { - "@ota-meshi/svelte": { + svelte: { ignoreWarnings: [ "@typescript-eslint/no-unsafe-assignment", "@typescript-eslint/no-unsafe-member-access", diff --git a/package.json b/package.json index 40cf2bcaf..c9bb076d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@ota-meshi/eslint-plugin-svelte", - "version": "0.34.1", + "name": "eslint-plugin-svelte", + "version": "2.0.0", "publishConfig": { "access": "public" }, @@ -12,25 +12,27 @@ "engines": { "node": "^14.17.0 || >=16.0.0" }, + "packageManager": "yarn@1.22.0", "scripts": { - "prebuild": "npm run -s clean", - "build": "npm run build:ts", + "prebuild": "yarn clean", + "build": "yarn build:ts", "build:ts": "tsc --project ./tsconfig.build.json", - "clean": "rimraf .nyc_output dist coverage", + "clean": "rimraf .nyc_output lib coverage build .svelte-kit svelte.config-dist.js", "pretest:base": "cross-env DEBUG=eslint-plugin-svelte*", "test": "mocha --require ts-node/register \"tests/src/**/*.ts\" --reporter dot --timeout 60000", - "cover": "nyc --reporter=lcov npm run test", + "cover": "nyc --reporter=lcov yarn test", "debug": "mocha --require ts-node/register/transpile-only \"tests/src/**/*.ts\" --reporter dot --timeout 60000", "lint": "eslint .", "eslint-fix": "eslint . --fix", - "update": "ts-node --transpile-only ./tools/update.ts && npm run format-for-gen-file", + "update": "ts-node --transpile-only ./tools/update.ts && yarn format-for-gen-file", "format-for-gen-file": "eslint src/types-for-node.ts src/utils/rules.ts src/configs --fix", "new": "ts-node --transpile-only ./tools/new-rule.ts", "docs:watch": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js dev", "docs:build": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js build", "docs:preview": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js preview", - "preversion": "npm test && git add .", - "version": "env-cmd -e version npm run update && git add ." + "preversion": "yarn test && git add .", + "version": "env-cmd -e version yarn update && git add .", + "prepublishOnly": "yarn clean && yarn build" }, "repository": { "type": "git", @@ -44,6 +46,9 @@ "sveltejs" ], "author": "Yosuke Ota (https://github.com/ota-meshi)", + "contributors": [ + "JounQin (https://github.com/JounQin)" + ], "funding": "https://github.com/sponsors/ota-meshi", "license": "MIT", "bugs": { @@ -76,7 +81,6 @@ "@babel/types": "^7.16.0", "@fontsource/fira-mono": "^4.5.0", "@ota-meshi/eslint-plugin": "^0.10.0", - "@ota-meshi/eslint-plugin-svelte": "^0.34.0", "@sindresorhus/slugify": "^2.1.0", "@sveltejs/adapter-static": "^1.0.0-next.26", "@sveltejs/kit": "^1.0.0-next.240", @@ -109,6 +113,7 @@ "eslint-plugin-node-dependencies": "^0.8.0", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-regexp": "^1.0.0", + "eslint-plugin-svelte": "link:.", "eslint-plugin-yml": "^1.0.0", "estree-walker": "^3.0.0", "less": "^4.1.2", diff --git a/src/configs/base.ts b/src/configs/base.ts index 7735c1c3b..8719cea7c 100644 --- a/src/configs/base.ts +++ b/src/configs/base.ts @@ -1,5 +1,5 @@ export = { - plugins: ["@ota-meshi/svelte"], + plugins: ["svelte"], overrides: [ { files: ["*.svelte"], @@ -9,9 +9,9 @@ export = { "no-inner-declarations": "off", // The AST generated by svelte-eslint-parser will false positives in it rule because the root node of the script is not the `Program`. // "no-irregular-whitespace": "off", - // @ota-meshi/eslint-plugin-svelte rules - "@ota-meshi/svelte/comment-directive": "error", - "@ota-meshi/svelte/system": "error", + // eslint-plugin-svelte rules + "svelte/comment-directive": "error", + "svelte/system": "error", }, }, ], diff --git a/src/configs/recommended.ts b/src/configs/recommended.ts index 49d84a5b6..b513c4b65 100644 --- a/src/configs/recommended.ts +++ b/src/configs/recommended.ts @@ -1,24 +1,24 @@ import path from "path" const base = require.resolve("./base") const baseExtend = - path.extname(`${base}`) === ".ts" ? "plugin:@ota-meshi/svelte/base" : base + path.extname(`${base}`) === ".ts" ? "plugin:svelte/base" : base export = { extends: [baseExtend], rules: { - // @ota-meshi/eslint-plugin-svelte rules - "@ota-meshi/svelte/comment-directive": "error", - "@ota-meshi/svelte/no-at-debug-tags": "warn", - "@ota-meshi/svelte/no-at-html-tags": "error", - "@ota-meshi/svelte/no-dupe-else-if-blocks": "error", - "@ota-meshi/svelte/no-dupe-style-properties": "error", - "@ota-meshi/svelte/no-dynamic-slot-name": "error", - "@ota-meshi/svelte/no-inner-declarations": "error", - "@ota-meshi/svelte/no-not-function-handler": "error", - "@ota-meshi/svelte/no-object-in-text-mustaches": "error", - "@ota-meshi/svelte/no-shorthand-style-property-overrides": "error", - "@ota-meshi/svelte/no-unknown-style-directive-property": "error", - "@ota-meshi/svelte/no-unused-svelte-ignore": "error", - "@ota-meshi/svelte/system": "error", - "@ota-meshi/svelte/valid-compile": "error", + // eslint-plugin-svelte rules + "svelte/comment-directive": "error", + "svelte/no-at-debug-tags": "warn", + "svelte/no-at-html-tags": "error", + "svelte/no-dupe-else-if-blocks": "error", + "svelte/no-dupe-style-properties": "error", + "svelte/no-dynamic-slot-name": "error", + "svelte/no-inner-declarations": "error", + "svelte/no-not-function-handler": "error", + "svelte/no-object-in-text-mustaches": "error", + "svelte/no-shorthand-style-property-overrides": "error", + "svelte/no-unknown-style-directive-property": "error", + "svelte/no-unused-svelte-ignore": "error", + "svelte/system": "error", + "svelte/valid-compile": "error", }, } diff --git a/src/rules/comment-directive.ts b/src/rules/comment-directive.ts index b288f9439..eb4d2a6e3 100644 --- a/src/rules/comment-directive.ts +++ b/src/rules/comment-directive.ts @@ -55,7 +55,7 @@ export default createRule("comment-directive", { options.reportUnusedDisableDirectives, ) const directives = shared.newCommentDirectives({ - ruleId: "@ota-meshi/svelte/comment-directive", + ruleId: "svelte/comment-directive", reportUnusedDisableDirectives, }) diff --git a/src/rules/system.ts b/src/rules/system.ts index 09d13e1c6..9a2724a6a 100644 --- a/src/rules/system.ts +++ b/src/rules/system.ts @@ -18,16 +18,14 @@ export default createRule("system", { if (!shared) return {} const directives = shared.newCommentDirectives({ - ruleId: "@ota-meshi/svelte/system", + ruleId: "svelte/system", }) - const ignoreWarnings = - context.settings?.["@ota-meshi/svelte"]?.ignoreWarnings + const ignoreWarnings = context.settings?.svelte?.ignoreWarnings if (ignoreWarnings && !Array.isArray(ignoreWarnings)) { context.report({ loc: { line: 1, column: 0 }, - message: - 'The settings["@ota-meshi/svelte"].ignoreWarnings must be an array.', + message: "The `settings.svelte.ignoreWarnings` must be an array.", }) return {} } @@ -39,7 +37,7 @@ export default createRule("system", { context.report({ loc: { line: 1, column: 0 }, message: - 'The array element in the settings["@ota-meshi/svelte"].ignoreWarnings must be a string.', + "The array element in the `settings.svelte.ignoreWarnings` must be a string.", }) return {} } diff --git a/src/shared/svelte-compile-warns/transform/postcss.ts b/src/shared/svelte-compile-warns/transform/postcss.ts index 365f0c0a9..19ada33a7 100644 --- a/src/shared/svelte-compile-warns/transform/postcss.ts +++ b/src/shared/svelte-compile-warns/transform/postcss.ts @@ -11,8 +11,7 @@ export function transform( node: AST.SvelteStyleElement, context: RuleContext, ): TransformResult | null { - const postcssConfig = - context.settings?.["@ota-meshi/svelte"]?.compileOptions?.postcss + const postcssConfig = context.settings?.svelte?.compileOptions?.postcss if (postcssConfig === false) { return null } diff --git a/src/types.ts b/src/types.ts index e89d50da3..97036fdc4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -100,7 +100,7 @@ export type RuleContext = { // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ignore options: any[] settings?: { - ["@ota-meshi/svelte"]?: { + ["svelte"]?: { ignoreWarnings?: unknown compileOptions?: { babel?: boolean diff --git a/src/utils/index.ts b/src/utils/index.ts index 25def5211..107819dc5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -15,7 +15,7 @@ export function createRule( docs: { ...rule.meta.docs, url: `https://ota-meshi.github.io/eslint-plugin-svelte/rules/${ruleName}/`, - ruleId: `@ota-meshi/svelte/${ruleName}`, + ruleId: `svelte/${ruleName}`, ruleName, }, }, diff --git a/tests/fixtures/rules/no-unused-svelte-ignore/valid/.eslintrc.js b/tests/fixtures/rules/no-unused-svelte-ignore/valid/.eslintrc.js new file mode 100644 index 000000000..ac738ac81 --- /dev/null +++ b/tests/fixtures/rules/no-unused-svelte-ignore/valid/.eslintrc.js @@ -0,0 +1,12 @@ +"use strict" + +module.exports = { + overrides: [ + { + files: ["style-lang07-input.svelte"], + rules: { + "prettier/prettier": "off", + }, + }, + ], +} diff --git a/tests/src/rules/comment-directive.ts b/tests/src/rules/comment-directive.ts index ff9726132..b80c2cf2e 100644 --- a/tests/src/rules/comment-directive.ts +++ b/tests/src/rules/comment-directive.ts @@ -9,19 +9,19 @@ import plugin from "../../../src/index" // Initialize linter. const linter = new eslint.ESLint({ plugins: { - "@ota-meshi/svelte": plugin as never, + svelte: plugin as never, }, baseConfig: { parser: require.resolve("svelte-eslint-parser"), parserOptions: { ecmaVersion: 2020, }, - plugins: ["@ota-meshi/svelte"], + plugins: ["svelte"], rules: { "no-undef": "error", "space-infix-ops": "error", - "@ota-meshi/svelte/no-at-html-tags": "error", - "@ota-meshi/svelte/comment-directive": "error", + "svelte/no-at-html-tags": "error", + "svelte/comment-directive": "error", }, }, useEslintrc: false, @@ -49,10 +49,7 @@ describe("comment-directive", () => { const messages = result[0].messages assert.strictEqual(messages.length, 3) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[2].ruleId, "no-undef") }) @@ -68,10 +65,7 @@ describe("comment-directive", () => { const messages = result[0].messages assert.strictEqual(messages.length, 4) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[0].line, 5) assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[1].line, 5) @@ -83,7 +77,7 @@ describe("comment-directive", () => { it("enable specific rules if ", async () => { const code = ` - + {@html a+b} {@html a+b} @@ -119,9 +113,9 @@ describe("comment-directive", () => { assert.strictEqual(messages[0].ruleId, "no-undef") }) - it("disable specific rules if ", async () => { + it("disable specific rules if ", async () => { const code = ` - + {@html a+b} ` const result = await linter.lintText(code, { filePath: "test.svelte" }) @@ -152,10 +146,7 @@ describe("comment-directive", () => { const messages = result[0].messages assert.strictEqual(messages.length, 3) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[2].ruleId, "no-undef") }) @@ -170,10 +161,7 @@ describe("comment-directive", () => { const messages = result[0].messages assert.strictEqual(messages.length, 4) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[2].ruleId, "space-infix-ops") assert.strictEqual(messages[3].ruleId, "no-undef") @@ -201,10 +189,7 @@ describe("comment-directive", () => { const messages = result[0].messages assert.strictEqual(messages.length, 3) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[2].ruleId, "no-undef") }) @@ -221,10 +206,7 @@ describe("comment-directive", () => { assert.strictEqual(messages.length, 4) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[0].line, 4) assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[1].line, 4) @@ -236,7 +218,7 @@ describe("comment-directive", () => { it("should affect only the next line", async () => { const code = ` - + {@html a+b} {@html a+b} ` @@ -249,10 +231,7 @@ describe("comment-directive", () => { assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[1].line, 3) - assert.strictEqual( - messages[2].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[2].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[2].line, 4) assert.strictEqual(messages[3].ruleId, "no-undef") assert.strictEqual(messages[3].line, 4) @@ -286,10 +265,7 @@ describe("comment-directive", () => { const messages = result[0].messages assert.strictEqual(messages.length, 4) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[0].line, 5) assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[1].line, 5) @@ -301,7 +277,7 @@ describe("comment-directive", () => { it("enable specific rules if ", async () => { const code = ` - + {@html a+b} {@html a+b} @@ -340,10 +316,7 @@ describe("comment-directive", () => { const messages = result[0].messages assert.strictEqual(messages.length, 3) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[2].ruleId, "no-undef") }) @@ -368,10 +341,7 @@ describe("comment-directive", () => { const messages = result[0].messages assert.strictEqual(messages.length, 3) - assert.strictEqual( - messages[0].ruleId, - "@ota-meshi/svelte/no-at-html-tags", - ) + assert.strictEqual(messages[0].ruleId, "svelte/no-at-html-tags") assert.strictEqual(messages[1].ruleId, "no-undef") assert.strictEqual(messages[2].ruleId, "no-undef") }) @@ -390,7 +360,7 @@ describe("comment-directive", () => { // "error", // { reportUnusedDisableDirectives: true }, // ], - // "@ota-meshi/svelte/no-at-html-tags": "error", + // "svelte/no-at-html-tags": "error", // "space-infix-ops": "error", // }, // useEslintrc: false, @@ -450,10 +420,10 @@ describe("comment-directive", () => { // assert.strictEqual(messages[0].column, 11) // }) - // it("report unused ", () => { + // it("report unused ", () => { // const code = ` // // ` @@ -473,16 +443,16 @@ describe("comment-directive", () => { // assert.strictEqual(messages[1].ruleId, "vue/comment-directive") // assert.strictEqual( // messages[1].message, - // "Unused eslint-disable directive (no problems were reported from '@ota-meshi/svelte/no-at-html-tags').", + // "Unused eslint-disable directive (no problems were reported from 'svelte/no-at-html-tags').", // ) // assert.strictEqual(messages[1].line, 3) // assert.strictEqual(messages[1].column, 60) // }) - // it("report unused ", () => { + // it("report unused ", () => { // const code = ` // @@ -503,24 +473,24 @@ describe("comment-directive", () => { // assert.strictEqual(messages[1].ruleId, "vue/comment-directive") // assert.strictEqual( // messages[1].message, - // "Unused eslint-disable-next-line directive (no problems were reported from '@ota-meshi/svelte/no-at-html-tags').", + // "Unused eslint-disable-next-line directive (no problems were reported from 'svelte/no-at-html-tags').", // ) // assert.strictEqual(messages[1].line, 3) // assert.strictEqual(messages[1].column, 70) // assert.strictEqual( // messages[2].ruleId, - // "@ota-meshi/svelte/no-at-html-tags", + // "svelte/no-at-html-tags", // ) // assert.strictEqual(messages[2].line, 5) // assert.strictEqual(messages[3].ruleId, "space-infix-ops") // assert.strictEqual(messages[3].line, 5) // }) - // it("dont report used ", () => { + // it("dont report used ", () => { // const code = ` // // ` @@ -534,8 +504,8 @@ describe("comment-directive", () => { // const code = ` // // ` // const messages = linter.executeOnText(code, "test.vue").results[0] diff --git a/tests/src/settings/ignore-warnings.ts b/tests/src/settings/ignore-warnings.ts index 04140fbc2..33ae31832 100644 --- a/tests/src/settings/ignore-warnings.ts +++ b/tests/src/settings/ignore-warnings.ts @@ -14,27 +14,27 @@ describe("ignore-warnings", () => { const linter = new eslint.ESLint({ plugins: { - "@ota-meshi/svelte": plugin as never, + svelte: plugin as never, }, baseConfig: { parser: require.resolve("svelte-eslint-parser"), parserOptions: { ecmaVersion: 2020, }, - plugins: ["@ota-meshi/svelte"], + plugins: ["svelte"], rules: { "no-undef": "error", "space-infix-ops": "error", - "@ota-meshi/svelte/no-at-html-tags": "error", - "@ota-meshi/svelte/no-at-debug-tags": "error", - "@ota-meshi/svelte/system": "error", + "svelte/no-at-html-tags": "error", + "svelte/no-at-debug-tags": "error", + "svelte/system": "error", }, settings: { - "@ota-meshi/svelte": { + svelte: { ignoreWarnings: [ "no-undef", "space-infix-ops", - "@ota-meshi/svelte/no-at-debug-tags", + "svelte/no-at-debug-tags", ], }, }, @@ -48,7 +48,7 @@ describe("ignore-warnings", () => { messages.map((m) => ({ ruleId: m.ruleId, line: m.line })), [ { - ruleId: "@ota-meshi/svelte/no-at-html-tags", + ruleId: "svelte/no-at-html-tags", line: 2, }, { @@ -77,23 +77,23 @@ describe("ignore-warnings", () => { const linter = new eslint.ESLint({ plugins: { - "@ota-meshi/svelte": plugin as never, + svelte: plugin as never, }, baseConfig: { parser: require.resolve("svelte-eslint-parser"), parserOptions: { ecmaVersion: 2020, }, - plugins: ["@ota-meshi/svelte"], + plugins: ["svelte"], rules: { "no-undef": "error", "space-infix-ops": "error", - "@ota-meshi/svelte/no-at-html-tags": "error", - "@ota-meshi/svelte/no-at-debug-tags": "error", - "@ota-meshi/svelte/system": "error", + "svelte/no-at-html-tags": "error", + "svelte/no-at-debug-tags": "error", + "svelte/system": "error", }, settings: { - "@ota-meshi/svelte": { + svelte: { ignoreWarnings: ["no-undef", "/debug/", "/^space/"], }, }, @@ -108,7 +108,7 @@ describe("ignore-warnings", () => { [ { line: 2, - ruleId: "@ota-meshi/svelte/no-at-html-tags", + ruleId: "svelte/no-at-html-tags", }, { ruleId: "no-undef", @@ -137,16 +137,16 @@ describe("ignore-warnings", () => { const linter = new eslint.ESLint({ plugins: { - "@ota-meshi/svelte": plugin as never, + svelte: plugin as never, }, baseConfig: { parser: require.resolve("svelte-eslint-parser"), parserOptions: { ecmaVersion: 2020, }, - plugins: ["@ota-meshi/svelte"], + plugins: ["svelte"], rules: { - "@ota-meshi/svelte/system": "error", + "svelte/system": "error", }, }, useEslintrc: false, diff --git a/tools/lib/load-rules.ts b/tools/lib/load-rules.ts index 934c75918..918a6b057 100644 --- a/tools/lib/load-rules.ts +++ b/tools/lib/load-rules.ts @@ -12,7 +12,7 @@ function readRules() { .readdirSync(rulesLibRoot) .filter((n) => n.endsWith(".ts"))) { const ruleName = name.replace(/\.ts$/u, "") - const ruleId = `@ota-meshi/svelte/${ruleName}` + const ruleId = `svelte/${ruleName}` // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports -- ignore const rule = require(path.join(rulesLibRoot, name)).default diff --git a/tools/new-rule.ts b/tools/new-rule.ts index 6ae1dd327..9c3782bb7 100644 --- a/tools/new-rule.ts +++ b/tools/new-rule.ts @@ -6,7 +6,7 @@ const logger = console // main ;((ruleId) => { if (ruleId == null) { - logger.error("Usage: npm run new ") + logger.error("Usage: yarn new ") process.exitCode = 1 return } @@ -72,7 +72,7 @@ tester.run("${ruleId}", rule as any, loadTestCases("${ruleId}")) ) fs.writeFileSync( docFile, - `# (@ota-meshi/svelte/${ruleId}) + `# (svelte/${ruleId}) > description @@ -86,7 +86,7 @@ This rule reports ???. \`\`\`svelte @@ -101,7 +101,7 @@ This rule reports ???. \`\`\`json { - "@ota-meshi/svelte/${ruleId}": ["error", { + "svelte/${ruleId}": ["error", { }] } diff --git a/tools/render-rules.ts b/tools/render-rules.ts index 913ad6c2b..bae1bebb1 100644 --- a/tools/render-rules.ts +++ b/tools/render-rules.ts @@ -67,7 +67,7 @@ export default function renderRulesTableContent( )})` const replacedRules = rule.meta.replacedBy || [] const replacedBy = replacedRules - .map((name) => `[@ota-meshi/svelte/${name}](${buildRulePath(name)})`) + .map((name) => `[svelte/${name}](${buildRulePath(name)})`) .join(", ") return `| ${link} | ${replacedBy || "(no replacement)"} |` diff --git a/tools/update-docs-rules-index.ts b/tools/update-docs-rules-index.ts index f650d2e33..cdaa27bb8 100644 --- a/tools/update-docs-rules-index.ts +++ b/tools/update-docs-rules-index.ts @@ -13,7 +13,7 @@ sidebarDepth: 0 # Available Rules The \`--fix\` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below. -The rules with the following star :star: are included in the \`plugin:@ota-meshi/svelte/recommended\` config. +The rules with the following star :star: are included in the \`plugin:svelte/recommended\` config. ${renderRulesTableContent()}`, diff --git a/tools/update-docs.ts b/tools/update-docs.ts index 04eb0f872..816cba6a9 100644 --- a/tools/update-docs.ts +++ b/tools/update-docs.ts @@ -75,7 +75,7 @@ class DocFile { if (deprecated) { if (replacedBy) { const replacedRules = replacedBy.map( - (name) => `[@ota-meshi/svelte/${name}](${name}.md) rule`, + (name) => `[svelte/${name}](${name}.md) rule`, ) notes.push( `- :warning: This rule was **deprecated** and replaced by ${formatItems( @@ -89,11 +89,11 @@ class DocFile { if (recommended) { if (recommended === "base") { notes.push( - '- :gear: This rule is included in `"plugin:@ota-meshi/svelte/base"` and `"plugin:@ota-meshi/svelte/recommended"`.', + '- :gear: This rule is included in `"plugin:svelte/base"` and `"plugin:svelte/recommended"`.', ) } else { notes.push( - '- :gear: This rule is included in `"plugin:@ota-meshi/svelte/recommended"`.', + '- :gear: This rule is included in `"plugin:svelte/recommended"`.', ) } } @@ -137,7 +137,7 @@ class DocFile { this.since ? `## :rocket: Version -This rule was introduced in @ota-meshi/eslint-plugin-svelte ${this.since} +This rule was introduced in eslint-plugin-svelte ${this.since} ` : "" diff --git a/tools/update-readme.ts b/tools/update-readme.ts index 320dd108b..ce6145a6b 100644 --- a/tools/update-readme.ts +++ b/tools/update-readme.ts @@ -23,11 +23,11 @@ const docsReadmeFilePath = path.resolve(__dirname, "../docs/README.md") fs.writeFileSync( docsReadmeFilePath, `--- -title: "@ota-meshi/eslint-plugin-svelte" +title: "eslint-plugin-svelte" --- ${newReadme - .replace("# @ota-meshi/eslint-plugin-svelte\n", "# Introduction\n") + .replace("# eslint-plugin-svelte\n", "# Introduction\n") .replace( /[\s\S]*/u, "See [Available Rules](./rules.md).", diff --git a/tools/update-rulesets.ts b/tools/update-rulesets.ts index 435bde2fb..8a055eec5 100644 --- a/tools/update-rulesets.ts +++ b/tools/update-rulesets.ts @@ -3,7 +3,7 @@ import fs from "fs" import { rules } from "./lib/load-rules" const baseContent = `export = { - plugins: ["@ota-meshi/svelte"], + plugins: ["svelte"], overrides: [ { files: ["*.svelte"], @@ -13,7 +13,7 @@ const baseContent = `export = { "no-inner-declarations": "off", // The AST generated by svelte-eslint-parser will false positives in it rule because the root node of the script is not the \`Program\`. // "no-irregular-whitespace": "off", - // @ota-meshi/eslint-plugin-svelte rules + // eslint-plugin-svelte rules ${rules .filter( (rule) => @@ -38,11 +38,11 @@ fs.writeFileSync(baseFilePath, baseContent) const recommendedContent = `import path from "path" const base = require.resolve("./base") const baseExtend = - path.extname(\`\${base}\`) === ".ts" ? "plugin:@ota-meshi/svelte/base" : base + path.extname(\`\${base}\`) === ".ts" ? "plugin:svelte/base" : base export = { extends: [baseExtend], rules: { - // @ota-meshi/eslint-plugin-svelte rules + // eslint-plugin-svelte rules ${rules .filter((rule) => rule.meta.docs.recommended && !rule.meta.deprecated) .map((rule) => {