|
| 1 | +const globals = require('globals'); |
| 2 | +const eslint = require('@eslint/js'); |
| 3 | +const tseslint = require('typescript-eslint'); |
| 4 | +const eslintConfigPrettier = require('eslint-config-prettier'); |
| 5 | +const eslintPluginPrettier = require('eslint-plugin-prettier'); |
| 6 | + |
| 7 | +module.exports = [ |
| 8 | + eslint.configs.recommended, |
| 9 | + eslintConfigPrettier, |
| 10 | + ...tseslint.configs.recommended, |
| 11 | + { |
| 12 | + languageOptions: { |
| 13 | + parser: tseslint.parser, |
| 14 | + globals: { |
| 15 | + ...globals.node, |
| 16 | + ...globals.mocha, |
| 17 | + ...globals.browser |
| 18 | + } |
| 19 | + }, |
| 20 | + settings: { |
| 21 | + react: { |
| 22 | + version: 'detect' |
| 23 | + } |
| 24 | + }, |
| 25 | + plugins: { |
| 26 | + prettier: eslintPluginPrettier, |
| 27 | + '@typescript-eslint': tseslint.plugin |
| 28 | + }, |
| 29 | + rules: { |
| 30 | + '@typescript-eslint/camelcase': 'off', |
| 31 | + '@typescript-eslint/interface-name-prefix': 'off', |
| 32 | + '@typescript-eslint/no-use-before-define': 'off', |
| 33 | + '@typescript-eslint/ban-types': 'off', |
| 34 | + '@typescript-eslint/no-unused-vars': 'error', |
| 35 | + '@typescript-eslint/no-explicit-any': 'error', |
| 36 | + '@typescript-eslint/no-non-null-assertion': 'error' |
| 37 | + } |
| 38 | + }, |
| 39 | + { |
| 40 | + ignores: [ |
| 41 | + 'packages/cli/src/testutils/', |
| 42 | + 'packages/cli/src/**/**/*.test.ts', |
| 43 | + 'packages/reporter-earl/coverage/', |
| 44 | + 'packages/react/examples/', |
| 45 | + '**/dist/', |
| 46 | + '**/fixtures/external/' |
| 47 | + ] |
| 48 | + }, |
| 49 | + { |
| 50 | + files: ['**/*.js'], |
| 51 | + rules: { |
| 52 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 53 | + '@typescript-eslint/no-var-requires': 'off' |
| 54 | + } |
| 55 | + }, |
| 56 | + { |
| 57 | + files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx'], |
| 58 | + rules: { |
| 59 | + '@typescript-eslint/no-empty-function': 'off', |
| 60 | + '@typescript-eslint/no-explicit-any': 'off', |
| 61 | + '@typescript-eslint/no-non-null-assertion': 'off' |
| 62 | + } |
| 63 | + }, |
| 64 | + { |
| 65 | + files: ['packages/cli/**'], |
| 66 | + rules: { |
| 67 | + '@typescript-eslint/no-empty-function': 'off', |
| 68 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 69 | + '@typescript-eslint/explicit-function-return-type': 'off' |
| 70 | + } |
| 71 | + }, |
| 72 | + { |
| 73 | + files: ['packages/cli/**/*.test.ts'], |
| 74 | + languageOptions: { |
| 75 | + globals: { |
| 76 | + ...globals.mocha |
| 77 | + } |
| 78 | + }, |
| 79 | + rules: { |
| 80 | + '@typescript-eslint/no-explicit-any': 'off' |
| 81 | + } |
| 82 | + }, |
| 83 | + { |
| 84 | + files: ['packages/puppeteer/**'], |
| 85 | + rules: { |
| 86 | + '@typescript-eslint/no-explicit-any': 'off', |
| 87 | + '@typescript-eslint/no-use-before-define': 'off' |
| 88 | + } |
| 89 | + }, |
| 90 | + { |
| 91 | + files: ['packages/react/**'], |
| 92 | + languageOptions: { |
| 93 | + sourceType: 'module', |
| 94 | + globals: { |
| 95 | + ...globals.node, |
| 96 | + ...globals.mocha, |
| 97 | + ...globals.browser |
| 98 | + }, |
| 99 | + ecmaVersion: 2018 |
| 100 | + } |
| 101 | + }, |
| 102 | + { |
| 103 | + files: ['packages/react/test/*.js'], |
| 104 | + rules: { |
| 105 | + 'no-var': 'off' |
| 106 | + } |
| 107 | + }, |
| 108 | + { |
| 109 | + files: ['packages/reporter-earl/**'], |
| 110 | + rules: { |
| 111 | + '@typescript-eslint/no-explicit-any': 'off', |
| 112 | + 'no-debugger': 'off', |
| 113 | + 'no-empty-pattern': 'off' |
| 114 | + } |
| 115 | + }, |
| 116 | + { |
| 117 | + files: ['packages/reporter-earl/tests/*.test.ts'], |
| 118 | + languageOptions: { |
| 119 | + globals: { |
| 120 | + jest: true |
| 121 | + } |
| 122 | + } |
| 123 | + }, |
| 124 | + { |
| 125 | + files: ['packages/reporter-earl/src/types.ts'], |
| 126 | + rules: { |
| 127 | + '@typescript-eslint/no-empty-object-type': 'off' |
| 128 | + } |
| 129 | + } |
| 130 | +]; |
0 commit comments