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 Sep 20, 2021
1 parent 6aa7eea commit 6787dcb
Show file tree
Hide file tree
Showing 49 changed files with 204 additions and 206 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
33 changes: 16 additions & 17 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
steps:
- uses: actions/checkout@v2

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

- name: Validate cache
Expand All @@ -36,9 +36,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -50,9 +50,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -67,14 +67,14 @@ 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.0.0-0']
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.4.0
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
Expand All @@ -86,8 +86,7 @@ jobs:
run: yarn test --coverage
env:
CI: true
- uses: codecov/codecov-action@v2.0.3
if: always()
- uses: codecov/codecov-action@v2
test-os:
name: Test on ${{ matrix.os }} using Node.js LTS
needs: prepare-yarn-cache
Expand All @@ -99,9 +98,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -116,9 +115,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand All @@ -139,9 +138,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.4.0
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: install
run: yarn
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
]
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^4.0.1"
"@typescript-eslint/experimental-utils": "^5.0.0-0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
Expand All @@ -95,18 +95,18 @@
"@types/jest": "^27.0.0",
"@types/node": "^14.0.0",
"@types/prettier": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^5.0.0-0",
"@typescript-eslint/parser": "^5.0.0-0",
"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-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"husky": "^7.0.2",
"is-ci": "^3.0.0",
Expand All @@ -123,8 +123,8 @@
"typescript": "^4.4.0"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": ">= 4",
"eslint": ">=6"
"@typescript-eslint/eslint-plugin": "^4.0.0 || ^5.0.0-0",
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.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'>>;
};

// can be removed once we've on v3: https://github.com/typescript-eslint/typescript-eslint/issues/2060
declare module '@typescript-eslint/experimental-utils/dist/ts-eslint/Rule' {
export interface RuleMetaDataDocs {
suggestion?: boolean;
}
}

// 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/lowercase-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,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/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 @@ -65,7 +65,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
2 changes: 1 addition & 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 All @@ -47,6 +46,7 @@ export default createRule({
},
schema: [],
type: 'suggestion',
hasSuggestions: true,
},
defaultOptions: [],
create(context) {
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
2 changes: 1 addition & 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 All @@ -49,6 +48,7 @@ export default createRule({
},
schema: [],
type: 'suggestion',
hasSuggestions: true,
},
defaultOptions: [],
create: context => ({
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
Loading

0 comments on commit 6787dcb

Please sign in to comment.