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 95a45c9 commit be5bb93
Show file tree
Hide file tree
Showing 50 changed files with 129 additions and 187 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Expand Up @@ -34,6 +34,10 @@ 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/test-case-property-ordering': 'error',
'no-else-return': 'error',
'no-negated-condition': 'error',
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/nodejs.yml
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,9 +67,12 @@ 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]
exclude:
- eslint-version: 8
ts-eslint-plugin-version: 4
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -104,7 +107,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 +126,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 +149,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
12 changes: 6 additions & 6 deletions package.json
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",
"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-eslint-plugin": "^4.0.0-0",
"eslint-plugin-import": "^2.25.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.4.1",
"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 @@ -123,7 +123,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
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
14 changes: 14 additions & 0 deletions src/rules/__tests__/no-jasmine-globals.test.ts
Expand Up @@ -21,6 +21,7 @@ ruleTester.run('no-jasmine-globals', rule, {
invalid: [
{
code: 'spyOn(some, "object")',
output: null,
errors: [
{
messageId: 'illegalGlobal',
Expand All @@ -32,6 +33,7 @@ ruleTester.run('no-jasmine-globals', rule, {
},
{
code: 'spyOnProperty(some, "object")',
output: null,
errors: [
{
messageId: 'illegalGlobal',
Expand All @@ -43,10 +45,12 @@ ruleTester.run('no-jasmine-globals', rule, {
},
{
code: 'fail()',
output: null,
errors: [{ messageId: 'illegalFail', column: 1, line: 1 }],
},
{
code: 'pending()',
output: null,
errors: [{ messageId: 'illegalPending', column: 1, line: 1 }],
},
{
Expand All @@ -56,10 +60,12 @@ ruleTester.run('no-jasmine-globals', rule, {
},
{
code: 'jasmine.DEFAULT_TIMEOUT_INTERVAL = function() {}',
output: null,
errors: [{ messageId: 'illegalJasmine', column: 1, line: 1 }],
},
{
code: 'jasmine.addMatchers(matchers)',
output: null,
errors: [
{
messageId: 'illegalMethod',
Expand All @@ -71,6 +77,7 @@ ruleTester.run('no-jasmine-globals', rule, {
},
{
code: 'jasmine.createSpy()',
output: null,
errors: [
{
messageId: 'illegalMethod',
Expand Down Expand Up @@ -151,30 +158,37 @@ ruleTester.run('no-jasmine-globals', rule, {
},
{
code: 'jasmine.getEnv()',
output: null,
errors: [{ messageId: 'illegalJasmine', column: 1, line: 1 }],
},
{
code: 'jasmine.empty()',
output: null,
errors: [{ messageId: 'illegalJasmine', column: 1, line: 1 }],
},
{
code: 'jasmine.falsy()',
output: null,
errors: [{ messageId: 'illegalJasmine', column: 1, line: 1 }],
},
{
code: 'jasmine.truthy()',
output: null,
errors: [{ messageId: 'illegalJasmine', column: 1, line: 1 }],
},
{
code: 'jasmine.arrayWithExactContents()',
output: null,
errors: [{ messageId: 'illegalJasmine', column: 1, line: 1 }],
},
{
code: 'jasmine.clock()',
output: null,
errors: [{ messageId: 'illegalJasmine', column: 1, line: 1 }],
},
{
code: 'jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH = 42',
output: null,
errors: [{ messageId: 'illegalJasmine', column: 1, line: 1 }],
},
],
Expand Down
1 change: 0 additions & 1 deletion src/rules/__tests__/utils.test.ts
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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

0 comments on commit be5bb93

Please sign in to comment.