|
| 1 | +/** @type {import('eslint').Linter.Config} */ |
| 2 | +const config = { |
| 3 | + root: true, |
| 4 | + parser: '@typescript-eslint/parser', |
| 5 | + plugins: ['@typescript-eslint', 'unicorn', 'import'], |
| 6 | + extends: ['eslint:recommended'], |
| 7 | + env: { |
| 8 | + node: true, |
| 9 | + es6: true, |
| 10 | + }, |
| 11 | + parserOptions: { |
| 12 | + ecmaVersion: 2020, |
| 13 | + sourceType: 'module', |
| 14 | + }, |
| 15 | + rules: { |
| 16 | + quotes: ['error', 'single', { avoidEscape: true }], |
| 17 | + camelcase: ['error', { properties: 'never' }], |
| 18 | + semi: ['error', 'never'], |
| 19 | + indent: [2, 2], |
| 20 | + eqeqeq: ['error', 'always'], |
| 21 | + |
| 22 | + 'prefer-const': 'error', |
| 23 | + 'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }], |
| 24 | + 'array-bracket-spacing': ['error', 'never'], |
| 25 | + 'brace-style': ['error', '1tbs', { allowSingleLine: true }], |
| 26 | + 'comma-spacing': ['error', { before: false, after: true }], |
| 27 | + 'no-lonely-if': 'error', |
| 28 | + 'dot-notation': 'error', |
| 29 | + 'no-else-return': 'error', |
| 30 | + 'no-tabs': 'error', |
| 31 | + 'no-trailing-spaces': [ |
| 32 | + 'error', |
| 33 | + { |
| 34 | + skipBlankLines: false, |
| 35 | + ignoreComments: false, |
| 36 | + }, |
| 37 | + ], |
| 38 | + 'no-var': 'error', |
| 39 | + 'unicode-bom': ['error', 'never'], |
| 40 | + curly: ['error', 'all'], |
| 41 | + 'object-curly-spacing': ['error', 'always'], |
| 42 | + 'keyword-spacing': ['error'], |
| 43 | + 'require-atomic-updates': 0, |
| 44 | + 'linebreak-style': ['error', 'unix'], |
| 45 | + 'unicorn/prefer-node-protocol': ['error'], |
| 46 | + 'import/extensions': ['error', 'ignorePackages'], |
| 47 | + 'no-restricted-syntax': [ |
| 48 | + 'error', |
| 49 | + 'IfStatement > ExpressionStatement > AssignmentExpression', |
| 50 | + ], |
| 51 | + 'unicorn/prefer-ternary': 'error', |
| 52 | + }, |
| 53 | + overrides: [ |
| 54 | + { |
| 55 | + files: ['*.ts'], |
| 56 | + rules: { |
| 57 | + // see https://stackoverflow.com/questions/55280555/typescript-eslint-eslint-plugin-error-route-is-defined-but-never-used-no-un |
| 58 | + 'no-unused-vars': 'off', |
| 59 | + '@typescript-eslint/no-unused-vars': 'error', |
| 60 | + '@typescript-eslint/consistent-type-imports': 'error', |
| 61 | + 'no-undef': 'off', |
| 62 | + // allow overloads |
| 63 | + 'no-redeclare': 'off', |
| 64 | + }, |
| 65 | + }, |
| 66 | + { |
| 67 | + files: ['*.test.ts'], |
| 68 | + rules: { |
| 69 | + 'dot-notation': 'off', |
| 70 | + }, |
| 71 | + }, |
| 72 | + ], |
| 73 | +} |
| 74 | + |
| 75 | +module.exports = config |
0 commit comments