Skip to content

Commit

Permalink
Target ESLint 9 (#357)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <[email protected]>
  • Loading branch information
TylerVigario and sindresorhus committed May 3, 2024
1 parent 990f069 commit b5561e4
Show file tree
Hide file tree
Showing 33 changed files with 111 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [^14.17, ^16.4]
node-version: [^18.18]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/assertion-arguments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce passing correct arguments to assertions (`ava/assertion-arguments`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/hooks-order.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce test hook ordering (`ava/hooks-order`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/max-asserts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce a limit on the number of assertions in a test (`ava/max-asserts`)

🚫 This rule is _disabled_ in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
🚫 This rule is _disabled_ in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-async-fn-without-await.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure that async tests use `await` (`ava/no-async-fn-without-await`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-duplicate-modifiers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure tests do not have duplicate modifiers (`ava/no-duplicate-modifiers`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-identical-title.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure no tests have the same title (`ava/no-identical-title`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-ignored-test-files.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure no tests are written in ignored files (`ava/no-ignored-test-files`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-import-test-files.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure no test files are imported anywhere (`ava/no-import-test-files`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-incorrect-deep-equal.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow using `deepEqual` with primitives (`ava/no-incorrect-deep-equal`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-inline-assertions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure assertions are not called from inline arrow functions (`ava/no-inline-assertions`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-nested-tests.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure no tests are nested (`ava/no-nested-tests`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-only-test.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Ensure no `test.only()` are present (`ava/no-only-test`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and 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-skip-assert.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure no assertions are skipped (`ava/no-skip-assert`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-skip-test.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Ensure no tests are skipped (`ava/no-skip-test`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and 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-todo-implementation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure `test.todo()` is not given an implementation function (`ava/no-todo-implementation`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-todo-test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure no `test.todo()` is used (`ava/no-todo-test`)

⚠️ This rule _warns_ in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
⚠️ This rule _warns_ in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unknown-modifiers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow the use of unknown test modifiers (`ava/no-unknown-modifiers`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-async-await.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer using async/await instead of returning a Promise (`ava/prefer-async-await`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-power-assert.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce the use of the asserts that have no [power-assert](https://github.com/power-assert-js/power-assert) alternative (`ava/prefer-power-assert`)

🚫 This rule is _disabled_ in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
🚫 This rule is _disabled_ in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-t-regex.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer using `t.regex()` to test regular expressions (`ava/prefer-t-regex`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/test-title-format.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure test titles have a certain format (`ava/test-title-format`)

🚫 This rule is _disabled_ in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
🚫 This rule is _disabled_ in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/test-title.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure tests have a title (`ava/test-title`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/use-t-throws-async-well.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure that `t.throwsAsync()` and `t.notThrowsAsync()` are awaited (`ava/use-t-throws-async-well`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/use-t-well.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow the incorrect use of `t` (`ava/use-t-well`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/use-t.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure test functions use `t` as their parameter (`ava/use-t`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/use-test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure that AVA is imported with `test` as the variable name (`ava/use-test`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/use-true-false.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ensure that `t.true()`/`t.false()` are used instead of `t.truthy()`/`t.falsy()` (`ava/use-true-false`)

💼 This rule is enabled in the `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config).
💼 This rule is enabled in the following [configs](https://github.com/avajs/eslint-plugin-ava#recommended-config): `flat/recommended`, ✅ `recommended`.

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

Expand Down
72 changes: 42 additions & 30 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,39 @@
const path = require('path');
const importModules = require('import-modules');

const rules = {
'ava/assertion-arguments': 'error',
'ava/hooks-order': 'error',
'ava/max-asserts': [
'off',
5,
],
'ava/no-async-fn-without-await': 'error',
'ava/no-duplicate-modifiers': 'error',
'ava/no-identical-title': 'error',
'ava/no-ignored-test-files': 'error',
'ava/no-import-test-files': 'error',
'ava/no-incorrect-deep-equal': 'error',
'ava/no-inline-assertions': 'error',
'ava/no-nested-tests': 'error',
'ava/no-only-test': 'error',
'ava/no-skip-assert': 'error',
'ava/no-skip-test': 'error',
'ava/no-todo-implementation': 'error',
'ava/no-todo-test': 'warn',
'ava/no-unknown-modifiers': 'error',
'ava/prefer-async-await': 'error',
'ava/prefer-power-assert': 'off',
'ava/prefer-t-regex': 'error',
'ava/test-title': 'error',
'ava/test-title-format': 'off',
'ava/use-t-well': 'error',
'ava/use-t': 'error',
'ava/use-t-throws-async-well': 'error',
'ava/use-test': 'error',
'ava/use-true-false': 'error',
};

module.exports = {
rules: importModules(path.resolve(__dirname, 'rules'), {camelize: false}),
configs: {
Expand All @@ -18,37 +51,16 @@ module.exports = {
'ava',
],
rules: {
'ava/assertion-arguments': 'error',
'ava/hooks-order': 'error',
'ava/max-asserts': [
'off',
5,
],
'ava/no-async-fn-without-await': 'error',
'ava/no-duplicate-modifiers': 'error',
'ava/no-identical-title': 'error',
'ava/no-ignored-test-files': 'error',
'ava/no-import-test-files': 'error',
'ava/no-incorrect-deep-equal': 'error',
'ava/no-inline-assertions': 'error',
'ava/no-nested-tests': 'error',
'ava/no-only-test': 'error',
'ava/no-skip-assert': 'error',
'ava/no-skip-test': 'error',
'ava/no-todo-implementation': 'error',
'ava/no-todo-test': 'warn',
'ava/no-unknown-modifiers': 'error',
'ava/prefer-async-await': 'error',
'ava/prefer-power-assert': 'off',
'ava/prefer-t-regex': 'error',
'ava/test-title': 'error',
'ava/test-title-format': 'off',
'ava/use-t-well': 'error',
'ava/use-t': 'error',
'ava/use-t-throws-async-well': 'error',
'ava/use-test': 'error',
'ava/use-true-false': 'error',
...rules,
},
},
"flat/recommended": {
plugins: {
'ava': 'ava'
},
rules: {
...rules
}
}
},
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"repository": "avajs/eslint-plugin-ava",
"engines": {
"node": ">=14.17 <15 || >=16.4"
"node": "^18.18 || >=20"
},
"scripts": {
"integration": "node ./test/integration/test.js",
Expand Down Expand Up @@ -63,7 +63,7 @@
"xo": "^0.52.4"
},
"peerDependencies": {
"eslint": ">=8.26.0"
"eslint": ">=9"
},
"ava": {
"files": [
Expand Down
Loading

0 comments on commit b5561e4

Please sign in to comment.