diff --git a/.eslintrc.yml b/.eslintrc.yml index e0fed89..087f576 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,4 +1,4 @@ root: true extends: - - plugin:@eslint-community/mysticatea/es2015 - - plugin:@eslint-community/mysticatea/+eslint-plugin + - plugin:@eslint-community/mysticatea/es2015 + - plugin:@eslint-community/mysticatea/+eslint-plugin diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bb85b6f..41744f8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,11 @@ version: 2 updates: - - package-ecosystem: github-actions - directory: / - schedule: - interval: daily + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily - - package-ecosystem: npm - directory: / - schedule: - interval: daily + - package-ecosystem: npm + directory: / + schedule: + interval: daily diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b95eb85..3dcabbb 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,122 +1,121 @@ name: CI on: - push: - branches: - # default semantic-release branches - - +([0-9])?(.{+([0-9]),x}).x - - main - - next - - next-major - - beta - - alpha - pull_request: - schedule: - - cron: 0 0 * * 0 + push: + branches: + # default semantic-release branches + - +([0-9])?(.{+([0-9]),x}).x + - main + - next + - next-major + - beta + - alpha + pull_request: + schedule: + - cron: 0 0 * * 0 jobs: - lint: - name: โฌฃ Lint - runs-on: ubuntu-latest - steps: - - name: ๐Ÿ›‘ Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 - - - name: โŽ” Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: ๐Ÿ“ฅ Install dependencies - run: npm install - - - name: โ–ถ๏ธ Run lint script - run: npm run lint - - test: - name: - ๐Ÿงช Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{ - matrix.os }}) - strategy: - matrix: - eslint: [6] - node: [12.22.0, 12, 14.17.0, 14, 16, 18] - os: [ubuntu-latest] - include: - # On other platforms - - os: windows-latest - eslint: 6 - node: 18 - - os: macos-latest - eslint: 6 - node: 18 - # On the minimum supported ESLint/Node.js version - - eslint: 6.6.0 - node: 12.22.0 - os: ubuntu-latest - runs-on: ${{ matrix.os }} - steps: - - name: ๐Ÿ›‘ Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 - - - name: โŽ” Setup Node v${{ matrix.node }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - - - name: ๐Ÿ“ฅ Install dependencies - run: npm install - - # - name: ๐Ÿ“ฅ Install ESLint v${{ matrix.eslint }} - # run: npm install --save-dev eslint@${{ matrix.eslint }} - - - name: โ–ถ๏ธ Run test script - run: npm run test - - - name: โฌ†๏ธ Upload coverage report - uses: codecov/codecov-action@v3 - - release: - name: ๐Ÿš€ Release - needs: [lint, test] - runs-on: ubuntu-latest - if: - github.repository == 'eslint-community/eslint-plugin-mysticatea' && - contains('refs/heads/main,refs/heads/next,refs/heads/beta,refs/heads/alpha', - github.ref) && github.event_name == 'push' - steps: - - name: ๐Ÿ›‘ Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - - - name: โฌ‡๏ธ Checkout repo - uses: actions/checkout@v3 - - - name: โŽ” Setup node - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: ๐Ÿ“ฅ Install dependencies - run: npm install - - - name: ๐Ÿš€ Release - uses: cycjimmy/semantic-release-action@v3 - with: - semantic_version: 19 - branches: | - [ - '+([0-9])?(.{+([0-9]),x}).x', - 'main', - 'next', - 'next-major', - {name: 'beta', prerelease: true}, - {name: 'alpha', prerelease: true} - ] - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + lint: + name: โฌฃ Lint + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: ๐Ÿ“ฅ Install dependencies + run: npm install + + - name: โ–ถ๏ธ Run lint script + run: npm run lint + + test: + name: + ๐Ÿงช Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{ + matrix.os }}) + strategy: + matrix: + eslint: [6] + node: [12.22.0, 12, 14.17.0, 14, 16, 18] + os: [ubuntu-latest] + include: + # On other platforms + - os: windows-latest + eslint: 6 + node: 18 + - os: macos-latest + eslint: 6 + node: 18 + # On the minimum supported ESLint/Node.js version + - eslint: 6.6.0 + node: 12.22.0 + os: ubuntu-latest + runs-on: ${{ matrix.os }} + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup Node v${{ matrix.node }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + + - name: ๐Ÿ“ฅ Install dependencies + run: npm install + + # - name: ๐Ÿ“ฅ Install ESLint v${{ matrix.eslint }} + # run: npm install --save-dev eslint@${{ matrix.eslint }} + + - name: โ–ถ๏ธ Run test script + run: npm run test + + - name: โฌ†๏ธ Upload coverage report + uses: codecov/codecov-action@v3 + + release: + name: ๐Ÿš€ Release + needs: [lint, test] + runs-on: ubuntu-latest + if: github.repository == 'eslint-community/eslint-plugin-mysticatea' && + contains('refs/heads/main,refs/heads/next,refs/heads/beta,refs/heads/alpha', + github.ref) && github.event_name == 'push' + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: ๐Ÿ“ฅ Install dependencies + run: npm install + + - name: ๐Ÿš€ Release + uses: cycjimmy/semantic-release-action@v3 + with: + semantic_version: 19 + branches: | + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'main', + 'next', + 'next-major', + {name: 'beta', prerelease: true}, + {name: 'alpha', prerelease: true} + ] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/no-response.yml b/.github/workflows/no-response.yml index bd7d207..2ebee13 100644 --- a/.github/workflows/no-response.yml +++ b/.github/workflows/no-response.yml @@ -1,29 +1,29 @@ name: ๐Ÿฅบ No Response on: - schedule: - # Schedule for five minutes after the hour, every hour - - cron: "5 * * * *" + schedule: + # Schedule for five minutes after the hour, every hour + - cron: "5 * * * *" permissions: - issues: write - pull-requests: write + issues: write + pull-requests: write jobs: - stale: - if: github.repository == 'eslint-community/eslint-plugin-mysticatea' - runs-on: ubuntu-latest - steps: - - name: ๐Ÿฅบ Handle Ghosting - uses: actions/stale@v6 - with: - close-issue-message: > - This issue has been automatically closed because we haven't received a - response from the original author ๐Ÿ™ˆ. This automation helps keep the issue - tracker clean from issues that aren't actionable. Please reach out if you - have more information for us! ๐Ÿ™‚ - close-pr-message: > - This PR has been automatically closed because we haven't received a - response from the original author ๐Ÿ™ˆ. This automation helps keep the issue - tracker clean from PRs that aren't actionable. Please reach out if you - have more information for us! ๐Ÿ™‚ + stale: + if: github.repository == 'eslint-community/eslint-plugin-mysticatea' + runs-on: ubuntu-latest + steps: + - name: ๐Ÿฅบ Handle Ghosting + uses: actions/stale@v6 + with: + close-issue-message: > + This issue has been automatically closed because we haven't received a + response from the original author ๐Ÿ™ˆ. This automation helps keep the issue + tracker clean from issues that aren't actionable. Please reach out if you + have more information for us! ๐Ÿ™‚ + close-pr-message: > + This PR has been automatically closed because we haven't received a + response from the original author ๐Ÿ™ˆ. This automation helps keep the issue + tracker clean from PRs that aren't actionable. Please reach out if you + have more information for us! ๐Ÿ™‚ diff --git a/.nycrc.yml b/.nycrc.yml index 5bf9a3c..95d8164 100644 --- a/.nycrc.yml +++ b/.nycrc.yml @@ -1,7 +1,7 @@ include: -- lib + - lib exclude: -- lib/processors/vue.js + - lib/processors/vue.js reporter: -- text-summary -- lcov + - text-summary + - lcov diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..c60295a --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,5 @@ +module.exports = { + tabWidth: 4, + semi: false, + trailingComma: "es5", +} diff --git a/README.md b/README.md index 828b5f5..3e3e150 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ npm install --save-dev eslint @eslint-community/eslint-plugin-mysticatea ### Requirements -- Node.js `^12.22.0 || ^14.17.0 || >=16.0.0` or newer versions. -- ESLint `^6.6.0` or newer versions. +- Node.js `^12.22.0 || ^14.17.0 || >=16.0.0` or newer versions. +- ESLint `^6.6.0` or newer versions. ## ๐Ÿ“– Usage @@ -25,33 +25,33 @@ Write in your ESLint configurations: http://eslint.org/docs/user-guide/configuri ### Configs -- `plugin:@eslint-community/mysticatea/es2022` ... Basic configuration for ES2022. -- `plugin:@eslint-community/mysticatea/es2021` ... Basic configuration for ES2021. -- `plugin:@eslint-community/mysticatea/es2020` ... Basic configuration for ES2020. -- `plugin:@eslint-community/mysticatea/es2019` ... Basic configuration for ES2019. -- `plugin:@eslint-community/mysticatea/es2018` ... Basic configuration for ES2018. -- `plugin:@eslint-community/mysticatea/es2017` ... Basic configuration for ES2017. -- `plugin:@eslint-community/mysticatea/es2016` ... Basic configuration for ES2016. -- `plugin:@eslint-community/mysticatea/es2015` ... Basic configuration for ES2015. -- `plugin:@eslint-community/mysticatea/es5` ... Basic configuration for ES5. -- `plugin:@eslint-community/mysticatea/+modules` ... Additional configuration for ES modules. -- `plugin:@eslint-community/mysticatea/+browser` ... Additional configuration for browser environment. -- `plugin:@eslint-community/mysticatea/+node` ... Additional configuration for Node.js environment. -- `plugin:@eslint-community/mysticatea/+eslint-plugin` ... Additional configuration for ESLint plugins. This includes `plugin:@eslint-community/mysticatea/+node` setting. +- `plugin:@eslint-community/mysticatea/es2022` ... Basic configuration for ES2022. +- `plugin:@eslint-community/mysticatea/es2021` ... Basic configuration for ES2021. +- `plugin:@eslint-community/mysticatea/es2020` ... Basic configuration for ES2020. +- `plugin:@eslint-community/mysticatea/es2019` ... Basic configuration for ES2019. +- `plugin:@eslint-community/mysticatea/es2018` ... Basic configuration for ES2018. +- `plugin:@eslint-community/mysticatea/es2017` ... Basic configuration for ES2017. +- `plugin:@eslint-community/mysticatea/es2016` ... Basic configuration for ES2016. +- `plugin:@eslint-community/mysticatea/es2015` ... Basic configuration for ES2015. +- `plugin:@eslint-community/mysticatea/es5` ... Basic configuration for ES5. +- `plugin:@eslint-community/mysticatea/+modules` ... Additional configuration for ES modules. +- `plugin:@eslint-community/mysticatea/+browser` ... Additional configuration for browser environment. +- `plugin:@eslint-community/mysticatea/+node` ... Additional configuration for Node.js environment. +- `plugin:@eslint-community/mysticatea/+eslint-plugin` ... Additional configuration for ESLint plugins. This includes `plugin:@eslint-community/mysticatea/+node` setting. #### Details The main configurations `plugin:@eslint-community/mysticatea/es*` does: -- detect bug-like code by ESLint rules. -- enforce whitespace style by Prettier. -- handle the `.ts` files as TypeScript then check by `typescript-eslint-parser` and `eslint-plugin-typescript`. -- handle the `.vue` files as Vue.js SFC then check by `vue-eslint-parser` and `eslint-plugin-vue`. -- handle the files in `test`/`tests` directory as `mocha`'s test code. -- handle the files in `scripts` directory as Node.js environment. -- handle the `.eslintrc.js` file as a Node.js script. -- handle the `webpack.config.js` file as a Node.js script. -- handle the `rollup.config.js` file as an ES module. +- detect bug-like code by ESLint rules. +- enforce whitespace style by Prettier. +- handle the `.ts` files as TypeScript then check by `typescript-eslint-parser` and `eslint-plugin-typescript`. +- handle the `.vue` files as Vue.js SFC then check by `vue-eslint-parser` and `eslint-plugin-vue`. +- handle the files in `test`/`tests` directory as `mocha`'s test code. +- handle the files in `scripts` directory as Node.js environment. +- handle the `.eslintrc.js` file as a Node.js script. +- handle the `webpack.config.js` file as a Node.js script. +- handle the `rollup.config.js` file as an ES module. You can use combination of a main configuration and some additional configurations. For examples: @@ -109,27 +109,26 @@ This plugin has some original rules and foreign rules. #### Original rules -- [@eslint-community/mysticatea/arrow-parens](docs/rules/arrow-parens.md) enforces parens of argument lists (excludes too redundant parens) (fixable). -- [@eslint-community/mysticatea/block-scoped-var](docs/rules/block-scoped-var.md) handles variables which are declared by `var` declaration as block-scoped. It disallows redeclarations, uses from outside of the scope, shadowing. -- [@eslint-community/mysticatea/no-instanceof-array](docs/rules/no-instanceof-array.md) disallows 'instanceof' for Array (fixable). -- [@eslint-community/mysticatea/no-instanceof-wrapper](docs/rules/no-instanceof-wrapper.md) disallows 'instanceof' for wrapper objects (fixable). -- [@eslint-community/mysticatea/no-literal-call](docs/rules/no-literal-call.md) disallows a call of a literal. -- [@eslint-community/mysticatea/no-this-in-static](docs/rules/no-this-in-static.md) disallows `this`/`super` in static methods. -- [@eslint-community/mysticatea/no-use-ignored-vars](docs/rules/no-use-ignored-vars.md) disallows a use of ignored variables. -- [@eslint-community/mysticatea/no-useless-rest-spread](docs/rules/no-useless-rest-spread.md) disallows unnecessary rest/spread operators (fixable). -- [@eslint-community/mysticatea/prefer-for-of](docs/rules/prefer-for-of.md) requires `for-of` statements instead of `Array#forEach` or something like (fixable). +- [@eslint-community/mysticatea/arrow-parens](docs/rules/arrow-parens.md) enforces parens of argument lists (excludes too redundant parens) (fixable). +- [@eslint-community/mysticatea/block-scoped-var](docs/rules/block-scoped-var.md) handles variables which are declared by `var` declaration as block-scoped. It disallows redeclarations, uses from outside of the scope, shadowing. +- [@eslint-community/mysticatea/no-instanceof-array](docs/rules/no-instanceof-array.md) disallows 'instanceof' for Array (fixable). +- [@eslint-community/mysticatea/no-instanceof-wrapper](docs/rules/no-instanceof-wrapper.md) disallows 'instanceof' for wrapper objects (fixable). +- [@eslint-community/mysticatea/no-literal-call](docs/rules/no-literal-call.md) disallows a call of a literal. +- [@eslint-community/mysticatea/no-this-in-static](docs/rules/no-this-in-static.md) disallows `this`/`super` in static methods. +- [@eslint-community/mysticatea/no-use-ignored-vars](docs/rules/no-use-ignored-vars.md) disallows a use of ignored variables. +- [@eslint-community/mysticatea/no-useless-rest-spread](docs/rules/no-useless-rest-spread.md) disallows unnecessary rest/spread operators (fixable). +- [@eslint-community/mysticatea/prefer-for-of](docs/rules/prefer-for-of.md) requires `for-of` statements instead of `Array#forEach` or something like (fixable). #### Foreign rules -- All `@eslint-community/mysticatea/eslint-comments/*` rules are imported from [eslint-plugin-eslint-comments](https://www.npmjs.com/package/eslint-plugin-eslint-comments). -- All `@eslint-community/mysticatea/eslint-plugin/*` rules are imported from [eslint-plugin-eslint-plugin](https://www.npmjs.com/package/eslint-plugin-eslint-plugin). -- All `@eslint-community/mysticatea/node/*` rules are imported from [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node). -- All `@eslint-community/mysticatea/ts/*` rules are imported from [eslint-plugin-typescript](https://www.npmjs.com/package/eslint-plugin-typescript). -- All `@eslint-community/mysticatea/vue/*` rules are imported from [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue). -- The `@eslint-community/mysticatea/prettier` rule is imported from [eslint-plugin-prettier](https://www.npmjs.com/package/eslint-plugin-prettier). +- All `@eslint-community/mysticatea/eslint-comments/*` rules are imported from [eslint-plugin-eslint-comments](https://www.npmjs.com/package/eslint-plugin-eslint-comments). +- All `@eslint-community/mysticatea/eslint-plugin/*` rules are imported from [eslint-plugin-eslint-plugin](https://www.npmjs.com/package/eslint-plugin-eslint-plugin). +- All `@eslint-community/mysticatea/node/*` rules are imported from [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node). +- All `@eslint-community/mysticatea/ts/*` rules are imported from [eslint-plugin-typescript](https://www.npmjs.com/package/eslint-plugin-typescript). +- All `@eslint-community/mysticatea/vue/*` rules are imported from [eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue). +- The `@eslint-community/mysticatea/prettier` rule is imported from [eslint-plugin-prettier](https://www.npmjs.com/package/eslint-plugin-prettier). -> **Q:** Why don't you use those plugins directly?
-> **A:** The combination with shareable configs and plugins has some problems because shareable configs were not designed to be used with plugins. @nzakas illustrated a way to use plugins as shareable configs together with other plugins in the discussion [eslint/eslint#3458](https://github.com/eslint/eslint/issues/3458#issuecomment-257161846). This is the way. +> **Q:** Why don't you use those plugins directly?
> **A:** The combination with shareable configs and plugins has some problems because shareable configs were not designed to be used with plugins. @nzakas illustrated a way to use plugins as shareable configs together with other plugins in the discussion [eslint/eslint#3458](https://github.com/eslint/eslint/issues/3458#issuecomment-257161846). This is the way. ## ๐Ÿšฅ Semantic Versioning Policy @@ -137,7 +136,7 @@ This plugin follows [semantic versioning](http://semver.org/) and [ESLint's Sema ## ๐Ÿ“ฐ Changelog -- [GitHub Releases](https://github.com/eslint-community/eslint-plugin-mysticatea/releases) +- [GitHub Releases](https://github.com/eslint-community/eslint-plugin-mysticatea/releases) ## โค๏ธ Contributing @@ -147,8 +146,8 @@ Please use GitHub's Issues/PRs. ### Development Tools -- `npm test` runs tests and measures coverage. -- `npm run clean` removes the coverage result of `npm test` command. -- `npm run coverage` shows the coverage result of `npm test` command. -- `npm run update` updates auto-generated files. -- `npm run watch` runs tests and measures coverage when source code are changed. +- `npm test` runs tests and measures coverage. +- `npm run clean` removes the coverage result of `npm test` command. +- `npm run coverage` shows the coverage result of `npm test` command. +- `npm run update` updates auto-generated files. +- `npm run watch` runs tests and measures coverage when source code are changed. diff --git a/docs/rules/arrow-parens.md b/docs/rules/arrow-parens.md index 9054b31..24cbfa3 100644 --- a/docs/rules/arrow-parens.md +++ b/docs/rules/arrow-parens.md @@ -12,39 +12,45 @@ This rule ignores arrow functions that there is a open paren before itself. ### The following patterns are considered warnings: ```js -const twice = x => 2 * x; +const twice = x => 2 * x ``` ```js const obj = { - twich: x => 2 * x -}; + twich: x => 2 * x, +} ``` ```js -p.then(x => 2 * x, err => console.error(err)); +p.then( + x => 2 * x, + err => console.error(err) +) ``` ### The following patterns are not considered warnings: ```js -const twice = (x) => 2 * x; -const twice = (x => 2 * x); +const twice = (x) => 2 * x +const twice = (x => 2 * x) ``` ```js const obj = { - twich: (x) => 2 * x -}; + twich: (x) => 2 * x, +} const obj2 = { - twich: (x => 2 * x) -}; + twich: (x) => 2 * x, +} ``` ```js -xs.map(x => 2 * x); +xs.map((x) => 2 * x) ``` ```js -p.then(x => 2 * x, (err) => console.error(err)); +p.then( + (x) => 2 * x, + (err) => console.error(err) +) ``` diff --git a/docs/rules/block-scoped-var.md b/docs/rules/block-scoped-var.md index e66b9a2..461b4df 100644 --- a/docs/rules/block-scoped-var.md +++ b/docs/rules/block-scoped-var.md @@ -8,54 +8,53 @@ Please turn `no-redeclare` rule off if you use this rule. This rule aims to flag below about variables which are defined with `var` declaration: -- References from outside of the block which declare the variable. -- Re-declarations in a same block. -- Shadowing in a same function scope. +- References from outside of the block which declare the variable. +- Re-declarations in a same block. +- Shadowing in a same function scope. ### The following patterns are considered warnings: ```js { - var a = 0; + var a = 0 } -console.log(a); // not defined. +console.log(a) // not defined. ``` ```js -for (var a = 0;;) { -} -console.log(a); // not defined. +for (var a = 0; ; ) {} +console.log(a) // not defined. ``` ```js -var a = 0; -var a = 0; // already defined. +var a = 0 +var a = 0 // already defined. ``` ```js -for (var a = 0;;) { - var a = 0; // already defined. +for (var a = 0; ; ) { + var a = 0 // already defined. } ``` ```js function foo(a) { - var a = 0; // already defined. + var a = 0 // already defined. } ``` ```js -var a = 0; +var a = 0 { - var a = 0; // already defined in the upper scope. + var a = 0 // already defined in the upper scope. } ``` ```js function foo(a) { - if (Math.random() < 0.5) { - var a = 0; // already defined in the upper scope. - } + if (Math.random() < 0.5) { + var a = 0 // already defined in the upper scope. + } } ``` @@ -63,11 +62,10 @@ function foo(a) { ```js if (Math.random() < 0.5) { - var a = 0; - console.log(a); -} -else { - var a = 1; - console.log(a); + var a = 0 + console.log(a) +} else { + var a = 1 + console.log(a) } ``` diff --git a/docs/rules/no-literal-call.md b/docs/rules/no-literal-call.md index 733ede7..d649ef7 100644 --- a/docs/rules/no-literal-call.md +++ b/docs/rules/no-literal-call.md @@ -1,4 +1,4 @@ -# Disallow a call of a literal (no-literal-call) +# Disallow a call of a literal (no-literal-call) A call of a literal is a valid syntax, but it would cause a runtime error. @@ -9,8 +9,8 @@ Examples of **incorrect** code for this rule: ```js /*eslint no-literal-call: "error"*/ -123(); -"hello"(); +123() +"hello"() ``` Examples of **correct** code for this rule: @@ -18,6 +18,6 @@ Examples of **correct** code for this rule: ```js /*eslint no-literal-call: "error"*/ -foo(); -(function() {})(); +foo() +;(function () {})() ``` diff --git a/docs/rules/no-this-in-static.md b/docs/rules/no-this-in-static.md index 7a7d64b..efb4dc0 100644 --- a/docs/rules/no-this-in-static.md +++ b/docs/rules/no-this-in-static.md @@ -19,13 +19,13 @@ class A { } static bar() { - this.foo() //ERROR: Unexpected 'this'. + this.foo() //ERROR: Unexpected 'this'. } } class B extends A { static foo() { - super.foo() //ERROR: Unexpected 'super'. + super.foo() //ERROR: Unexpected 'super'. } } ``` diff --git a/docs/rules/no-use-ignored-vars.md b/docs/rules/no-use-ignored-vars.md index e63a63c..aea7c08 100644 --- a/docs/rules/no-use-ignored-vars.md +++ b/docs/rules/no-use-ignored-vars.md @@ -13,11 +13,11 @@ Examples of **incorrect** code for this rule: ```js /*eslint no-use-ignored-vars: "error"*/ -let _foo = 0; -doSomething(_foo); +let _foo = 0 +doSomething(_foo) function foo(_a) { - doSomething(_a); + doSomething(_a) } ``` @@ -26,10 +26,10 @@ Examples of **correct** code for this rule: ```js /*eslint no-use-ignored-vars: "error"*/ -let _foo = 0; +let _foo = 0 function foo(_a) { - doSomething(); + doSomething() } ``` diff --git a/docs/rules/no-useless-rest-spread.md b/docs/rules/no-useless-rest-spread.md index ca1e48b..ebcb001 100644 --- a/docs/rules/no-useless-rest-spread.md +++ b/docs/rules/no-useless-rest-spread.md @@ -25,11 +25,10 @@ Examples of **correct** code for this rule: /*eslint no-useless-rest-spread: "error"*/ let list = [a, b, c, d] -let obj = {a, b, c, d} +let obj = { a, b, c, d } foo(a, b, c) -let [a, b, c, d] = list; -let {a, b, c, d} = obj; -function foo(a, b, c, d) { -} +let [a, b, c, d] = list +let { a, b, c, d } = obj +function foo(a, b, c, d) {} ``` diff --git a/docs/rules/prefer-for-of.md b/docs/rules/prefer-for-of.md index 79144dd..64a9780 100644 --- a/docs/rules/prefer-for-of.md +++ b/docs/rules/prefer-for-of.md @@ -10,7 +10,7 @@ It's more readable than `Array#forEach` since it does not require closures. ```js /*eslint prefer-for-of: "error"*/ -list.forEach(value => { +list.forEach((value) => { doSomething(value) }) diff --git a/package.json b/package.json index fdf06c5..9e56584 100644 --- a/package.json +++ b/package.json @@ -1,72 +1,73 @@ { - "name": "@eslint-community/eslint-plugin-mysticatea", - "version": "0.0.0-semantically-released", - "description": "Additional ESLint rules.", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "main": "index.js", - "files": [ - "lib" - ], - "peerDependencies": { - "eslint": ">=6.6.0" - }, - "dependencies": { - "@typescript-eslint/eslint-plugin": "^2.34.0", - "@typescript-eslint/parser": "^2.34.0", - "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-eslint-plugin": "^2.3.0", - "eslint-plugin-node": "^10.0.0", - "eslint-plugin-prettier": "^3.4.1", - "eslint-plugin-vue": "^6.2.2", - "prettier": "^2.7.1", - "vue-eslint-parser": "^7.11.0" - }, - "devDependencies": { - "@eslint-community/eslint-plugin-mysticatea": "file:.", - "eslint": "^6.8.0", - "fs-extra": "^8.1.0", - "globals": "^12.4.0", - "mocha": "^9.2.2", - "npm-run-all": "^4.1.5", - "nyc": "^15.1.0", - "opener": "^1.5.2", - "rimraf": "^3.0.2", - "typescript": "^4.8.4" - }, - "scripts": { - "clean": "rimraf .nyc_output coverage", - "coverage": "opener coverage/lcov-report/index.html", - "lint": "eslint lib scripts tests", - "test": "nyc mocha \"tests/lib/**/*.js\" --reporter dot", - "update": "node scripts/generate-browser-globals && node scripts/generate-configs && node scripts/generate-rules", - "preversion": "run-s clean update test", - "version": "eslint lib/rules --fix && git add lib", - "postversion": "git push && git push --tags", - "watch": "mocha \"tests/lib/**/*.js\" --reporter dot --watch --growl" - }, - "repository": { - "type": "git", - "url": "https://github.com/eslint-community/eslint-plugin-mysticatea" - }, - "keywords": [ - "eslint", - "eslintplugin", - "block", - "scope", - "instanceof", - "isArray", - "static", - "this", - "rest", - "spread", - "ignore" - ], - "author": "Toru Nagashima", - "license": "MIT", - "bugs": { - "url": "https://github.com/eslint-community/eslint-plugin-mysticatea/issues" - }, - "homepage": "https://github.com/eslint-community/eslint-plugin-mysticatea#readme" + "name": "@eslint-community/eslint-plugin-mysticatea", + "version": "0.0.0-semantically-released", + "description": "Additional ESLint rules.", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "main": "index.js", + "files": [ + "lib" + ], + "peerDependencies": { + "eslint": ">=6.6.0" + }, + "dependencies": { + "@typescript-eslint/eslint-plugin": "^2.34.0", + "@typescript-eslint/parser": "^2.34.0", + "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-eslint-plugin": "^2.3.0", + "eslint-plugin-node": "^10.0.0", + "eslint-plugin-prettier": "^3.4.1", + "eslint-plugin-vue": "^6.2.2", + "prettier": "^2.7.1", + "vue-eslint-parser": "^7.11.0" + }, + "devDependencies": { + "@eslint-community/eslint-plugin-mysticatea": "file:.", + "eslint": "^6.8.0", + "fs-extra": "^8.1.0", + "globals": "^12.4.0", + "mocha": "^9.2.2", + "npm-run-all": "^4.1.5", + "nyc": "^15.1.0", + "opener": "^1.5.2", + "rimraf": "^3.0.2", + "typescript": "^4.8.4" + }, + "scripts": { + "clean": "rimraf .nyc_output coverage", + "coverage": "opener coverage/lcov-report/index.html", + "format": "prettier -w .", + "lint": "eslint lib scripts tests", + "test": "nyc mocha \"tests/lib/**/*.js\" --reporter dot", + "update": "node scripts/generate-browser-globals && node scripts/generate-configs && node scripts/generate-rules", + "preversion": "run-s clean update test", + "version": "eslint lib/rules --fix && git add lib", + "postversion": "git push && git push --tags", + "watch": "mocha \"tests/lib/**/*.js\" --reporter dot --watch --growl" + }, + "repository": { + "type": "git", + "url": "https://github.com/eslint-community/eslint-plugin-mysticatea" + }, + "keywords": [ + "eslint", + "eslintplugin", + "block", + "scope", + "instanceof", + "isArray", + "static", + "this", + "rest", + "spread", + "ignore" + ], + "author": "Toru Nagashima", + "license": "MIT", + "bugs": { + "url": "https://github.com/eslint-community/eslint-plugin-mysticatea/issues" + }, + "homepage": "https://github.com/eslint-community/eslint-plugin-mysticatea#readme" }