|
| 1 | +const eslintPluginPrettier = require('eslint-plugin-prettier'); |
| 2 | +const eslintPluginImport = require('eslint-plugin-import'); |
| 3 | +const eslintPluginTypeScript = require('@typescript-eslint/eslint-plugin'); |
| 4 | +const tsParser = require('@typescript-eslint/parser'); |
| 5 | + |
| 6 | +module.exports = [ |
| 7 | + { |
| 8 | + files: ['**/*.ts'], |
| 9 | + languageOptions: { |
| 10 | + parser: tsParser, |
| 11 | + parserOptions: { |
| 12 | + project: './tsconfig.json', |
| 13 | + sourceType: 'module', |
| 14 | + ecmaVersion: 2018, |
| 15 | + warnOnUnsupportedTypeScriptVersion: false, |
| 16 | + ecmaFeatures: { |
| 17 | + experimentalObjectRestSpread: true, |
| 18 | + legacyDecorators: true, |
| 19 | + }, |
| 20 | + }, |
| 21 | + }, |
| 22 | + plugins: { |
| 23 | + 'prettier': eslintPluginPrettier, |
| 24 | + 'import': eslintPluginImport, |
| 25 | + '@typescript-eslint': eslintPluginTypeScript, |
| 26 | + }, |
| 27 | + rules: { |
| 28 | + 'prettier/prettier': 'warn', |
| 29 | + 'func-call-spacing': 'off', |
| 30 | + 'jsx-quotes': ['error', 'prefer-single'], |
| 31 | + 'indent': 'off', |
| 32 | + 'no-dupe-class-members': 'error', |
| 33 | + 'no-spaced-func': 'off', |
| 34 | + 'no-unused-vars': 'off', |
| 35 | + 'no-useless-constructor': 'off', |
| 36 | + 'no-use-before-define': 'off', |
| 37 | + '@typescript-eslint/ban-ts-comment': [ |
| 38 | + 'error', |
| 39 | + { |
| 40 | + 'ts-ignore': 'allow-with-description', |
| 41 | + 'minimumDescriptionLength': 5, |
| 42 | + }, |
| 43 | + ], |
| 44 | + '@typescript-eslint/naming-convention': [ |
| 45 | + 'error', |
| 46 | + { |
| 47 | + selector: ['variable'], |
| 48 | + format: ['camelCase'], |
| 49 | + leadingUnderscore: 'allow', |
| 50 | + }, |
| 51 | + { |
| 52 | + selector: 'typeLike', |
| 53 | + format: ['PascalCase'], |
| 54 | + }, |
| 55 | + ], |
| 56 | + '@typescript-eslint/no-explicit-any': 'off', |
| 57 | + '@typescript-eslint/no-unused-vars': [ |
| 58 | + 'error', |
| 59 | + { |
| 60 | + argsIgnorePattern: '^_', |
| 61 | + ignoreRestSiblings: true, |
| 62 | + }, |
| 63 | + ], |
| 64 | + '@typescript-eslint/prefer-optional-chain': 'warn', |
| 65 | + }, |
| 66 | + }, |
| 67 | +]; |
0 commit comments