Skip to content

Commit

Permalink
feat: support ESLint 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Oct 12, 2021
1 parent fac5e4b commit 554c000
Show file tree
Hide file tree
Showing 49 changed files with 131 additions and 245 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ module.exports = {
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'eslint-comments/no-unused-disable': 'error',
'eslint-plugin/require-meta-fixable': [
'error',
{ catchNoFixerButFixableProperty: true },
],
'eslint-plugin/require-meta-has-suggestions': 'error',
'eslint-plugin/test-case-property-ordering': 'error',
'no-else-return': 'error',
'no-negated-condition': 'error',
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn

- name: Validate cache
Expand All @@ -38,7 +38,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -52,7 +52,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -67,8 +67,8 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [12.x, 14.x, 16.x]
eslint-version: [6, 7]
node-version: [12, 14, 16]
eslint-version: [6, 7, 8]
ts-eslint-plugin-version: [4, 5]
runs-on: ubuntu-latest

Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -123,7 +123,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -146,7 +146,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@
"babel-jest": "^27.0.0",
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"dedent": "^0.7.0",
"eslint": "^6.0.0 || ^7.0.0",
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0-0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-config": "^2.0.0",
"eslint-plugin-eslint-plugin": "^3.5.3",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-eslint-plugin": "^4.0.0-0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.2",
"is-ci": "^3.0.0",
"jest": "^27.0.0",
Expand All @@ -124,7 +124,7 @@
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^4.0.0 || ^5.0.0",
"eslint": "^6.0.0 || ^7.0.0"
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"peerDependenciesMeta": {
"@typescript-eslint/eslint-plugin": {
Expand Down
7 changes: 0 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ type RuleModule = TSESLint.RuleModule<string, unknown[]> & {
meta: Required<Pick<TSESLint.RuleMetaData<string>, 'docs'>>;
};

// v5 of `@typescript-eslint/experimental-utils` removed this
declare module '@typescript-eslint/experimental-utils/dist/ts-eslint/Rule' {
export interface RuleMetaDataDocs {
category: 'Best Practices' | 'Possible Errors';
}
}

// copied from https://github.com/babel/babel/blob/d8da63c929f2d28c401571e2a43166678c555bc4/packages/babel-helpers/src/helpers.js#L602-L606
/* istanbul ignore next */
const interopRequireDefault = (obj: any): { default: any } =>
Expand Down
1 change: 0 additions & 1 deletion src/rules/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const rule = createRule({
name: __filename,
meta: {
docs: {
category: 'Possible Errors',
description: 'Fake rule for testing AST guards',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/consistent-test-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Have control over `test` and `it` usages',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/expect-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Enforce assertion to be made in a test body',
recommended: 'warn',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/max-nested-describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Enforces a maximum depth to nested describe calls',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-alias-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow alias methods',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-commented-out-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow commented out tests',
recommended: 'warn',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-conditional-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default createRule({
meta: {
docs: {
description: 'Prevent calling `expect` conditionally',
category: 'Best Practices',
recommended: 'error',
},
messages: {
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-deprecated-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow use of deprecated functions',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-disabled-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow disabled tests',
recommended: 'warn',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-done-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Avoid using a callback in asynchronous tests and hooks',
recommended: 'error',
suggestion: true,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-duplicate-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow duplicate setup and teardown hooks',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow using `exports` in files containing tests',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-focused-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow focused tests',
recommended: 'error',
suggestion: true,
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow setup and teardown hooks',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-identical-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow identical titles',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-if.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default createRule({
meta: {
docs: {
description: 'Disallow conditional logic',
category: 'Best Practices',
recommended: false,
},
messages: {
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-interpolation-in-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow string interpolation inside snapshots',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-jasmine-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow Jasmine globals',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-jest-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default createRule({
type: 'problem',
docs: {
description: 'Disallow importing Jest',
category: 'Best Practices',
recommended: 'error',
},
messages: {
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-large-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export default createRule<[RuleOptions], MessageId>({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'disallow large snapshots',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-mocks-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default createRule({
meta: {
type: 'problem',
docs: {
category: 'Best Practices',
description: 'Disallow manually importing from `__mocks__`',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-restricted-matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow specific matchers & modifiers',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-standalone-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default createRule<
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow using `expect` outside of `it` or `test` blocks',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-test-prefixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Use `.only` and `.skip` over `f` and `x`',
recommended: 'error',
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/no-test-return-statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Disallow explicitly returning from tests',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/prefer-called-with.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description:
'Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()`',
recommended: false,
Expand Down
1 change: 0 additions & 1 deletion src/rules/prefer-expect-assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export default createRule<[RuleOptions], MessageIds>({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description:
'Suggest using `expect.assertions()` OR `expect.hasAssertions()`',
recommended: false,
Expand Down
1 change: 0 additions & 1 deletion src/rules/prefer-expect-resolves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description:
'Prefer `await expect(...).resolves` over `expect(await ...)` syntax',
recommended: false,
Expand Down
1 change: 0 additions & 1 deletion src/rules/prefer-hooks-on-top.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Suggest having hooks before any test cases',
recommended: false,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/prefer-lowercase-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export default createRule<
type: 'suggestion',
docs: {
description: 'Enforce lowercase test names',
category: 'Best Practices',
recommended: false,
},
fixable: 'code',
Expand Down
1 change: 0 additions & 1 deletion src/rules/prefer-spy-on.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Suggest using `jest.spyOn()`',
recommended: false,
},
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-strict-equal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Suggest using `toStrictEqual()`',
recommended: false,
suggestion: true,
Expand All @@ -20,6 +19,7 @@ export default createRule({
suggestReplaceWithStrictEqual: 'Replace with `toStrictEqual()`',
},
type: 'suggestion',
hasSuggestions: true,
schema: [],
hasSuggestions: true,
},
Expand Down
1 change: 0 additions & 1 deletion src/rules/prefer-to-be.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export default createRule({
name: __filename,
meta: {
docs: {
category: 'Best Practices',
description: 'Suggest using `toBe()` for primitive literals',
recommended: false,
},
Expand Down
Loading

0 comments on commit 554c000

Please sign in to comment.