Skip to content

Commit

Permalink
Merge branch 'main'
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Apr 23, 2024
2 parents 30b859c + 95b1980 commit af9a83e
Show file tree
Hide file tree
Showing 80 changed files with 728 additions and 437 deletions.
7 changes: 7 additions & 0 deletions .eslint-doc-generatorrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ module.exports = {
'rules-recommended',
'tests',
'tests-recommended',
'flat/recommended',
'flat/all',
'flat/all-type-checked',
'flat/rules',
'flat/rules-recommended',
'flat/tests',
'flat/tests-recommended',
],
postprocess: async (content, path) =>
prettier.format(content, {
Expand Down
28 changes: 19 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ jobs:
fail-fast: false
matrix:
node-version:
- 21
- 20
- 18
- 16
- 14
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install --force # ts-eslint does not support eslint v9 yet.
- run: npm test

lint:
Expand All @@ -32,18 +31,29 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.x"
- run: npm install
node-version: "lts/*"
- run: npm install --force # ts-eslint does not support eslint v9 yet.
- run: npm run lint

eslint7:
eslint8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.x"
- run: npm install
- run: npm install --save-dev eslint@7
node-version: "lts/*"
- run: npm install --force # ts-eslint does not support eslint v9 yet.
- run: npm install --save-dev eslint@8
- run: npm test

test-remote:
name: eslint-remote-tester
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- run: npm install --force # ts-eslint does not support eslint v9 yet.
- run: npm install --save-dev eslint@8 # eslint-remote-tester does not support eslint v9.
- run: npm run test:remote
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
registry-url: https://registry.npmjs.org
if: ${{ steps.release.outputs.release_created }}
- run: |
npm install
npm install --force
npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,54 @@
* update dependency markdownlint-cli to ^0.38.0 ([#410](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/410)) ([6b53c5b](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/6b53c5b7b8bc9e19dcb86796ab29019f89c449fc))
* update dependency markdownlint-cli to ^0.39.0 ([#431](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/431)) ([f005a2c](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/f005a2c0231b8b77f6862dca81b4a6e3099e0493))

## [6.0.0](https://github.com/eslint-community/eslint-plugin-eslint-plugin/compare/v5.5.1...v6.0.0) (2024-04-10)


### ⚠ BREAKING CHANGES

* change test-case-property-ordering to add supports languageOptions ([#406](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/406))
* add `defaultOptions` to meta-property-ordering ([#461](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/461))
* remove consistent-output from recommended ([#462](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/462))
* Add missing `deprecated`/`replacedBy` properties to `meta-property-ordering` rule ([#320](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/320))
* requires node >= 18 & eslint >= 8.23.0 ([#456](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/456))

### Features

* add `defaultOptions` to meta-property-ordering ([#461](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/461)) ([ff28db3](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/ff28db3dc1a6f06f5eca2225570870904acb5851)), closes [#430](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/430)
* add `name` to flat configs ([#459](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/459)) ([dcb794f](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/dcb794fcad7105e347eacb9c7a60e4c668cab205))
* Add missing `deprecated`/`replacedBy` properties to `meta-property-ordering` rule ([#320](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/320)) ([1692fe2](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/1692fe23cbe707f7d9694ca2b2f10068194b36b5))
* change test-case-property-ordering to add supports languageOptions ([#406](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/406)) ([0dd0857](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/0dd08577147863f923f5587d72e9a67a5c605f9c))
* remove consistent-output from recommended ([#462](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/462)) ([c27e18b](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/c27e18b16c83df011b8a8f997aa7fd0622889694)), closes [#284](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/284)
* requires node >= 18 & eslint >= 8.23.0 ([#456](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/456)) ([4adeb6c](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/4adeb6ccfee488819f7300746a3e2551cf44a961))

## [5.5.1](https://github.com/eslint-community/eslint-plugin-eslint-plugin/compare/v5.5.0...v5.5.1) (2024-04-08)


### Bug Fixes

* improve eslint rule detecting ([#457](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/457)) ([5dccb61](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/5dccb61cc8a732947689e523cfd9dd1adf611ca3))

## [5.5.0](https://github.com/eslint-community/eslint-plugin-eslint-plugin/compare/v5.4.1...v5.5.0) (2024-04-01)


### Features

* re-export flat configs "flat/*" ([#453](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/453)) ([e3b27e2](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/e3b27e26d7d1c864b04a162b38d9384a16bff23a))

## [5.4.1](https://github.com/eslint-community/eslint-plugin-eslint-plugin/compare/v5.4.0...v5.4.1) (2024-03-19)


### Bug Fixes

* false positives in 5.4.0 for functions that aren't ESLint rules ([#451](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/451)) ([f3ec88e](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/f3ec88eedc450b4bab331557e93f7b48a36b5f11))

## [5.4.0](https://github.com/eslint-community/eslint-plugin-eslint-plugin/compare/v5.3.0...v5.4.0) (2024-02-26)


### Features

* support named exports in ESM/TS ([#449](https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/449)) ([aa15471](https://github.com/eslint-community/eslint-plugin-eslint-plugin/commit/aa15471d4a8dc51a574f646f000d665854d15942))

### [5.2.1](https://github.com/eslint-community/eslint-plugin-eslint-plugin/compare/v5.2.0...v5.2.1) (2023-12-11)


Expand Down
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ Here's an example ESLint configuration that:

```json
{
"parserOptions": {
"sourceType": "script"
},
"extends": ["plugin:eslint-plugin/recommended"],
"rules": {
"eslint-plugin/require-meta-docs-description": "error"
Expand All @@ -60,11 +57,10 @@ Here's an example ESLint configuration that:
### <a name='flat'></a>[`eslint.config.js`](https://eslint.org/docs/latest/use/configure/configuration-files-new) (requires eslint>=v8.23.0)

```js
const eslintPluginRecommended = require('eslint-plugin-eslint-plugin/configs/recommended');
const eslintPlugin = require('eslint-plugin-eslint-plugin');
module.exports = [
eslintPluginRecommended,
eslintPlugin.configs['flat/recommended'],
{
languageOptions: { sourceType: 'commonjs' },
rules: {
'eslint-plugin/require-meta-docs-description': 'error',
},
Expand All @@ -79,8 +75,8 @@ module.exports = [
💼 [Configurations](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets) enabled in.\
✅ Set in the `recommended` [configuration](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets).\
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).\
💭 Requires type information.
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).\
💭 Requires [type information](https://typescript-eslint.io/linting/typed-linting).

### Rules

Expand Down Expand Up @@ -113,7 +109,7 @@ module.exports = [

| Name                        | Description | 💼 | 🔧 | 💡 | 💭 |
| :----------------------------------------------------------------------- | :--------------------------------------------------------------------------- | :-- | :-- | :-- | :-- |
| [consistent-output](docs/rules/consistent-output.md) | enforce consistent use of `output` assertions in rule tests | | | | |
| [consistent-output](docs/rules/consistent-output.md) | enforce consistent use of `output` assertions in rule tests | | | | |
| [no-identical-tests](docs/rules/no-identical-tests.md) | disallow identical tests || 🔧 | | |
| [no-only-tests](docs/rules/no-only-tests.md) | disallow the test case property `only` || | 💡 | |
| [prefer-output-null](docs/rules/prefer-output-null.md) | disallow invalid RuleTester test cases where the `output` matches the `code` || 🔧 | | |
Expand All @@ -140,7 +136,16 @@ The list of recommended rules will only change in a major release of this plugin

### <a name='Presetusage'></a>Preset usage

Presets are enabled by adding a line to the `extends` list in your config file. For example, to enable the `recommended` preset, use:
Both flat and eslintrc configs are supported. For example, to enable the `recommended` preset, use:

eslint.config.js

```js
const eslintPlugin = require('eslint-plugin-eslint-plugin');
module.exports = [eslintPlugin.configs['flat/recommended']];
```

.eslintrc.json

```json
{
Expand All @@ -150,6 +155,24 @@ Presets are enabled by adding a line to the `extends` list in your config file.

Or to apply linting only to the appropriate rule or test files:

eslint.config.js

```js
const eslintPlugin = require('eslint-plugin-eslint-plugin');
module.exports = [
{
files: ['lib/rules/*.{js,ts}'],
...eslintPlugin.configs['flat/rules-recommended'],
},
{
files: ['tests/lib/rules/*.{js,ts}'],
...eslintPlugin.configs['flat/tests-recommended'],
},
];
```

.eslintrc.js

```json
{
"overrides": [
Expand Down
12 changes: 7 additions & 5 deletions configs/all-type-checked.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/**
* @deprecated use 'flat/all-type-checked' instead
* @author 唯然<weiran.zsd@outlook.com>
*/

'use strict';

const mod = require('../lib/index.js');
const plugin = require('../lib/index.js');

module.exports = {
plugins: { 'eslint-plugin': mod },
rules: mod.configs['all-type-checked'].rules,
};
module.exports = plugin.configs['flat/all-type-checked'];
8 changes: 3 additions & 5 deletions configs/all.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* @fileoverview the `all` config for `eslint.config.js`
* @deprecated use 'flat/all' instead
* @author 唯然<weiran.zsd@outlook.com>
*/

'use strict';

const mod = require('../lib/index.js');
const plugin = require('../lib/index.js');

module.exports = {
plugins: { 'eslint-plugin': mod },
rules: mod.configs.all.rules,
};
module.exports = plugin.configs['flat/all'];
8 changes: 3 additions & 5 deletions configs/recommended.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* @fileoverview the `recommended` config for `eslint.config.js`
* @deprecated use 'flat/recommended' instead
* @author 唯然<weiran.zsd@outlook.com>
*/

'use strict';

const mod = require('../lib/index.js');
const plugin = require('../lib/index.js');

module.exports = {
plugins: { 'eslint-plugin': mod },
rules: mod.configs.recommended.rules,
};
module.exports = plugin.configs['flat/recommended'];
8 changes: 3 additions & 5 deletions configs/rules-recommended.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* @fileoverview the `rules-recommended` config for `eslint.config.js`
* @deprecated use 'flat/rules-recommended' instead
* @author 唯然<weiran.zsd@outlook.com>
*/

'use strict';

const mod = require('../lib/index.js');
const plugin = require('../lib/index.js');

module.exports = {
plugins: { 'eslint-plugin': mod },
rules: mod.configs['rules-recommended'].rules,
};
module.exports = plugin.configs['flat/rules-recommended'];
8 changes: 3 additions & 5 deletions configs/rules.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* @fileoverview the `rules` config for `eslint.config.js`
* @deprecated use 'flat/rules' instead
* @author 唯然<weiran.zsd@outlook.com>
*/

'use strict';

const mod = require('../lib/index.js');
const plugin = require('../lib/index.js');

module.exports = {
plugins: { 'eslint-plugin': mod },
rules: mod.configs.rules.rules,
};
module.exports = plugin.configs['flat/rules'];
8 changes: 3 additions & 5 deletions configs/tests-recommended.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* @fileoverview the `tests-recommended` config for `eslint.config.js`
* @deprecated use 'flat/tests-recommended' instead
* @author 唯然<weiran.zsd@outlook.com>
*/

'use strict';

const mod = require('../lib/index.js');
const plugin = require('../lib/index.js');

module.exports = {
plugins: { 'eslint-plugin': mod },
rules: mod.configs['tests-recommended'].rules,
};
module.exports = plugin.configs['flat/tests-recommended'];
8 changes: 3 additions & 5 deletions configs/tests.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* @fileoverview the `tests` config for `eslint.config.js`
* @deprecated use 'flat/tests' instead
* @author 唯然<weiran.zsd@outlook.com>
*/

'use strict';

const mod = require('../lib/index.js');
const plugin = require('../lib/index.js');

module.exports = {
plugins: { 'eslint-plugin': mod },
rules: mod.configs.tests.rules,
};
module.exports = plugin.configs['flat/tests'];
2 changes: 0 additions & 2 deletions docs/rules/consistent-output.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Enforce consistent use of `output` assertions in rule tests (`eslint-plugin/consistent-output`)

💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets).

<!-- end auto-generated rule header -->

When writing tests for fixable rules, the `output` property on each test case can be used to assert what autofixed code is produced, or to assert that no autofix is produced using `output: null`.
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/meta-property-ordering.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This rule enforces that meta properties of a rule are placed in a consistent ord

This rule has an array option:

- `['type', 'docs', 'fixable', 'hasSuggestions', 'schema', 'messages', 'deprecated', 'replacedBy']` (default): The order that the properties of `meta` should be placed in.
- `['type', 'docs', 'fixable', 'hasSuggestions', 'deprecated', 'replacedBy', 'schema', 'defaultOptions', 'messages']` (default): The order that the properties of `meta` should be placed in.

Examples of **incorrect** code for this rule:

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-only-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets).

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-property-in-node.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow using `in` to narrow node types instead of looking at properties (`eslint-plugin/no-property-in-node`)

💭 This rule requires type information.
💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/report-message-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
context.report(
node,
'This will get reported, regardless of the value of the {{placeholder}}',
{ placeholder: foo }
{ placeholder: foo },
);
},
};
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/require-meta-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/eslint-community/eslint-plugin-eslint-plugin#presets).

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

<!-- end auto-generated rule header -->

Expand Down
Loading

0 comments on commit af9a83e

Please sign in to comment.