|
| 1 | +const js = require('@eslint/js') |
| 2 | +const tsParser = require('@typescript-eslint/parser') |
| 3 | +const tsPlugin = require('@typescript-eslint/eslint-plugin') |
| 4 | +const importPlugin = require('eslint-plugin-import') |
| 5 | +const unicorn = require('eslint-plugin-unicorn') |
| 6 | +const prettierConfig = require('eslint-config-prettier') |
| 7 | +const prettierPlugin = require('eslint-plugin-prettier') |
| 8 | + |
| 9 | +module.exports = [ |
| 10 | + { |
| 11 | + ignores: ['node_modules/**', '**/dist/**'] |
| 12 | + }, |
| 13 | + // Base JS config |
| 14 | + { |
| 15 | + ...js.configs.recommended, |
| 16 | + plugins: { |
| 17 | + unicorn, |
| 18 | + import: importPlugin, |
| 19 | + prettier: prettierPlugin |
| 20 | + }, |
| 21 | + languageOptions: { |
| 22 | + ecmaVersion: 2020, |
| 23 | + sourceType: 'module' |
| 24 | + }, |
| 25 | + rules: { |
| 26 | + ...prettierConfig.rules, |
| 27 | + 'prettier/prettier': [ |
| 28 | + 'error', |
| 29 | + { |
| 30 | + bracketSpacing: true, |
| 31 | + semi: false, |
| 32 | + singleQuote: true, |
| 33 | + trailingComma: 'none' |
| 34 | + } |
| 35 | + ], |
| 36 | + quotes: ['error', 'single', { avoidEscape: true }], |
| 37 | + camelcase: ['error', { properties: 'never' }], |
| 38 | + semi: ['error', 'never'], |
| 39 | + eqeqeq: ['error', 'always'], |
| 40 | + 'prefer-const': 'error', |
| 41 | + 'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }], |
| 42 | + 'array-bracket-spacing': ['error', 'never'], |
| 43 | + 'brace-style': ['error', '1tbs', { allowSingleLine: true }], |
| 44 | + 'comma-spacing': ['error', { before: false, after: true }], |
| 45 | + 'no-lonely-if': 'error', |
| 46 | + 'dot-notation': 'error', |
| 47 | + 'no-else-return': 'error', |
| 48 | + 'no-tabs': 'error', |
| 49 | + 'no-trailing-spaces': [ |
| 50 | + 'error', |
| 51 | + { skipBlankLines: false, ignoreComments: false } |
| 52 | + ], |
| 53 | + 'no-var': 'error', |
| 54 | + 'unicode-bom': ['error', 'never'], |
| 55 | + curly: ['error', 'all'], |
| 56 | + 'object-curly-spacing': ['error', 'always'], |
| 57 | + 'keyword-spacing': ['error'], |
| 58 | + 'require-atomic-updates': 0, |
| 59 | + 'linebreak-style': ['error', 'unix'], |
| 60 | + 'import/extensions': ['error', 'ignorePackages'], |
| 61 | + 'no-restricted-syntax': [ |
| 62 | + 'error', |
| 63 | + 'IfStatement > ExpressionStatement > AssignmentExpression' |
| 64 | + ] |
| 65 | + } |
| 66 | + }, |
| 67 | + |
| 68 | + // TypeScript files |
| 69 | + { |
| 70 | + files: ['**/*.ts'], |
| 71 | + plugins: { |
| 72 | + '@typescript-eslint': tsPlugin |
| 73 | + }, |
| 74 | + languageOptions: { |
| 75 | + parser: tsParser |
| 76 | + }, |
| 77 | + rules: { |
| 78 | + '@typescript-eslint/no-unused-vars': [ |
| 79 | + 'error', |
| 80 | + { argsIgnorePattern: '^_' } |
| 81 | + ], |
| 82 | + '@typescript-eslint/consistent-type-imports': 'error', |
| 83 | + 'no-unused-vars': 'off', |
| 84 | + 'no-undef': 'off', |
| 85 | + 'no-redeclare': 'off' |
| 86 | + } |
| 87 | + }, |
| 88 | + |
| 89 | + // TypeScript test files |
| 90 | + { |
| 91 | + files: ['**/*.test.ts'], |
| 92 | + rules: { |
| 93 | + 'dot-notation': 'off' |
| 94 | + } |
| 95 | + } |
| 96 | +] |
0 commit comments