|
| 1 | +module.exports = { |
| 2 | + root: true, |
| 3 | + plugins: ['@typescript-eslint', 'jest', 'import'], |
| 4 | + env: { |
| 5 | + es6: true, |
| 6 | + node: true |
| 7 | + }, |
| 8 | + parserOptions: { |
| 9 | + sourceType: 'module', |
| 10 | + ecmaVersion: 11, |
| 11 | + ecmaFeatures: { |
| 12 | + jsx: false |
| 13 | + } |
| 14 | + }, |
| 15 | + extends: ['eslint:recommended', 'prettier'], |
| 16 | + rules: { |
| 17 | + // disallow non-import statements appearing before import statements |
| 18 | + 'import/first': 'error', |
| 19 | + // Forbid import of modules using absolute paths |
| 20 | + 'import/no-absolute-path': 'error', |
| 21 | + // disallow AMD require/define |
| 22 | + 'import/no-amd': 'error', |
| 23 | + // Forbid mutable exports |
| 24 | + 'import/no-mutable-exports': 'error', |
| 25 | + // Prevent importing the default as if it were named |
| 26 | + 'import/no-named-default': 'error', |
| 27 | + // Forbid a module from importing itself |
| 28 | + 'import/no-self-import': 'error' |
| 29 | + |
| 30 | + // Enable after https://github.com/benmosher/eslint-plugin-import/issues/1650 is fixed |
| 31 | + // Forbid the use of extraneous packages |
| 32 | + // 'import/no-extraneous-dependencies': [ |
| 33 | + // 'error', |
| 34 | + // {devDependencies: ['**/*.test.js']} |
| 35 | + // ] |
| 36 | + }, |
| 37 | + overrides: [ |
| 38 | + { |
| 39 | + files: ['*.ts'], |
| 40 | + parser: '@typescript-eslint/parser', |
| 41 | + extends: [ |
| 42 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 43 | + 'plugin:@typescript-eslint/recommended', |
| 44 | + 'prettier/@typescript-eslint' |
| 45 | + ], |
| 46 | + rules: { |
| 47 | + '@typescript-eslint/no-unused-vars': 'off', |
| 48 | + '@typescript-eslint/no-use-before-define': 'off', |
| 49 | + '@typescript-eslint/no-explicit-any': 'off', |
| 50 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 51 | + '@typescript-eslint/no-var-requires': 'off', |
| 52 | + '@typescript-eslint/no-inferrable-types': 'off', |
| 53 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 54 | + |
| 55 | + // TODO: enable those rules? |
| 56 | + 'no-empty': 'off', |
| 57 | + 'no-var': 'off' |
| 58 | + } |
| 59 | + }, |
| 60 | + { |
| 61 | + files: ['*.test.ts', '*.test.js'], |
| 62 | + env: { |
| 63 | + jest: true |
| 64 | + }, |
| 65 | + extends: ['plugin:jest/recommended'], |
| 66 | + rules: { |
| 67 | + '@typescript-eslint/no-explicit-any': 'off', |
| 68 | + '@typescript-eslint/no-var-requires': 'off', |
| 69 | + // disallow non-import statements appearing before import statements |
| 70 | + 'import/first': 'off' |
| 71 | + } |
| 72 | + } |
| 73 | + ] |
| 74 | +}; |
0 commit comments