Skip to content
Permalink
Browse files
chore: test on both eslint 5 and 6
  • Loading branch information
SimenB authored and G-Rath committed Oct 27, 2019
1 parent 7fafcd2 commit 6de136a4119a587f9e455aeecf260402dff60523
Showing with 227 additions and 99 deletions.
  1. +3 −2 .eslintrc.js
  2. +8 −3 .github/workflows/nodejs.yml
  3. +2 −1 package.json
  4. +2 −1 src/rules/__tests__/consistent-test-it.test.ts
  5. +2 −1 src/rules/__tests__/expect-expect.test.ts
  6. +2 −1 src/rules/__tests__/lowercase-name.test.ts
  7. +3 −1 src/rules/__tests__/no-commented-out-tests.test.ts
  8. +3 −1 src/rules/__tests__/no-disabled-tests.test.ts
  9. +2 −1 src/rules/__tests__/no-duplicate-hooks.test.ts
  10. +2 −1 src/rules/__tests__/no-expect-resolves.test.ts
  11. +2 −1 src/rules/__tests__/no-export.test.ts
  12. +2 −1 src/rules/__tests__/no-hooks.test.ts
  13. +2 −1 src/rules/__tests__/no-identical-title.test.ts
  14. +2 −1 src/rules/__tests__/no-if.test.ts
  15. +7 −1 src/rules/__tests__/no-jest-import.test.ts
  16. +2 −1 src/rules/__tests__/no-large-snapshots.test.ts
  17. +7 −1 src/rules/__tests__/no-mocks-import.test.ts
  18. +2 −1 src/rules/__tests__/no-standalone-expect-test.ts
  19. +2 −1 src/rules/__tests__/no-test-callback.test.ts
  20. +2 −1 src/rules/__tests__/no-test-return-statement.test.ts
  21. +2 −1 src/rules/__tests__/prefer-expect-assertions.test.ts
  22. +2 −1 src/rules/__tests__/prefer-hooks-on-top.test.ts
  23. +2 −1 src/rules/__tests__/prefer-spy-on.test.ts
  24. +1 −1 src/rules/__tests__/prefer-to-be-null.test.ts
  25. +1 −1 src/rules/__tests__/prefer-to-be-undefined.test.ts
  26. +1 −1 src/rules/__tests__/prefer-to-contain.test.ts
  27. +2 −1 src/rules/__tests__/prefer-to-have-length.test.ts
  28. +2 −1 src/rules/__tests__/prefer-todo.test.ts
  29. +2 −1 src/rules/__tests__/require-top-level-describe.test.ts
  30. +2 −1 src/rules/__tests__/require-tothrow-message.test.ts
  31. +2 −1 src/rules/__tests__/valid-describe.test.ts
  32. +2 −1 src/rules/__tests__/valid-expect-in-promise.test.ts
  33. +2 −1 src/rules/__tests__/valid-expect.test.ts
  34. +2 −1 src/rules/__tests__/valid-title.test.ts
  35. +143 −62 yarn.lock
@@ -3,7 +3,7 @@
const globals = require('./src/globals.json');

module.exports = {
parser: '@typescript-eslint/parser',
parser: require.resolve('@typescript-eslint/parser'),
extends: [
'plugin:eslint-plugin/recommended',
'plugin:node/recommended',
@@ -25,10 +25,11 @@ module.exports = {
es6: true,
},
rules: {
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/ban-ts-ignore': 'warn',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'no-else-return': 'error',
'no-negated-condition': 'error',
eqeqeq: ['error', 'smart'],
@@ -12,11 +12,14 @@ on:

jobs:
test-node:
name: Test on Node.js ${{ matrix.node-version }}
name:
# prettier-ignore
Test on Node.js v${{ matrix.node-version }} and eslint v${{matrix.eslint-version }}
strategy:
fail-fast: false
matrix:
node-version: [8.x, 10.x, 12.x, 13.x]
eslint-version: [5, 6]
runs-on: ubuntu-latest

steps:
@@ -25,8 +28,10 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install
run: yarn
- name: install with eslint v${{matrix.eslint-version }}
run: |
yarn
yarn add --dev eslint@${{matrix.eslint-version }}
- name: run prettylint
run: yarn prettylint
- name: run typecheck
@@ -54,7 +54,7 @@
"@typescript-eslint/parser": "^2.5.0",
"babel-jest": "^24.9.0",
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"eslint": "^5.1.0",
"eslint": "^5.1.0 || ^6.0.0",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-eslint-plugin": "^2.0.0",
"eslint-plugin-import": "^2.18.0",
@@ -66,6 +66,7 @@
"lint-staged": "^9.4.2",
"prettier": "^1.10.2",
"prettylint": "^1.0.0",
"resolve-from": "^5.0.0",
"rimraf": "^3.0.0",
"semantic-release": "^15.13.28",
"typescript": "^3.5.3"
@@ -1,9 +1,10 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../consistent-test-it';
import { TestCaseName } from '../utils';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -2,10 +2,11 @@ import {
AST_NODE_TYPES,
TSESLint,
} from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../expect-expect';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -1,9 +1,10 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../lowercase-name';
import { DescribeAlias, TestCaseName } from '../utils';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -1,9 +1,11 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-commented-out-tests';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 2015,
sourceType: 'module',
},
});
@@ -1,9 +1,11 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-disabled-tests';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 2015,
sourceType: 'module',
},
});
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-duplicate-hooks';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-expect-resolves';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 2017,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-export';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 2015,
sourceType: 'module',
@@ -1,9 +1,10 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-hooks';
import { HookName } from '../utils';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-identical-title';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-if';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -1,7 +1,13 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-jest-import';

const ruleTester = new TSESLint.RuleTester();
const ruleTester = new TSESLint.RuleTester({
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
});

ruleTester.run('no-jest-import', rule, {
valid: [
@@ -3,12 +3,13 @@ import {
TSESLint,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-large-snapshots';

const noLargeSnapshots = rule.create.bind(rule);

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 2015,
},
@@ -1,7 +1,13 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-mocks-import';

const ruleTester = new TSESLint.RuleTester();
const ruleTester = new TSESLint.RuleTester({
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
});

ruleTester.run('no-mocks-import', rule, {
valid: [
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-standalone-expect';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 2015,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-test-callback';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 8,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../no-test-return-statement';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: { ecmaVersion: 2015 },
});

@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../prefer-expect-assertions';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../prefer-hooks-on-top';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -2,10 +2,11 @@ import {
AST_NODE_TYPES,
TSESLint,
} from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../prefer-spy-on';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 6,
},
@@ -55,7 +55,7 @@ ruleTester.run('prefer-to-be-null', rule, {
});

new TSESLint.RuleTester({
parser: '@typescript-eslint/parser',
parser: require.resolve('@typescript-eslint/parser'),
}).run('prefer-to-be-null: typescript edition', rule, {
valid: [
"(expect('Model must be bound to an array if the multiple property is true') as any).toHaveBeenTipped()",
@@ -53,7 +53,7 @@ ruleTester.run('prefer-to-be-undefined', rule, {
});

new TSESLint.RuleTester({
parser: '@typescript-eslint/parser',
parser: require.resolve('@typescript-eslint/parser'),
}).run('prefer-to-be-undefined: typescript edition', rule, {
valid: [
"(expect('Model must be bound to an array if the multiple property is true') as any).toHaveBeenTipped()",
@@ -156,7 +156,7 @@ ruleTester.run('prefer-to-contain', rule, {
});

new TSESLint.RuleTester({
parser: '@typescript-eslint/parser',
parser: require.resolve('@typescript-eslint/parser'),
}).run('prefer-to-be-null: typescript edition', rule, {
valid: [
"(expect('Model must be bound to an array if the multiple property is true') as any).toHaveBeenTipped()",
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../prefer-to-have-length';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 2015,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../prefer-todo';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: { ecmaVersion: 2015 },
});

@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../require-top-level-describe';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 2015,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../require-tothrow-message';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 8,
},
@@ -1,8 +1,9 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import resolveFrom from 'resolve-from';
import rule from '../valid-describe';

const ruleTester = new TSESLint.RuleTester({
parser: 'espree',
parser: resolveFrom(require.resolve('eslint'), 'espree'),
parserOptions: {
ecmaVersion: 8,
},

0 comments on commit 6de136a

Please sign in to comment.