|
| 1 | +module.exports = { |
| 2 | + parser: '@typescript-eslint/parser', |
| 3 | + globals: { |
| 4 | + NodeJS: true, |
| 5 | + FileSystemFileHandle: true, |
| 6 | + FileSystemHandle: true, |
| 7 | + FileSystemDirectoryHandle: true, |
| 8 | + FileSystemPermissionMode: true, |
| 9 | + FileSystemHandlePermissionDescriptor: true, |
| 10 | + FileSystemWritableFileStream: true, |
| 11 | + globalThis: 'readonly', |
| 12 | + }, |
| 13 | + extends: [ |
| 14 | + 'eslint-config-airbnb-base', |
| 15 | + 'plugin:jest/recommended', |
| 16 | + 'prettier', |
| 17 | + ], |
| 18 | + parserOptions: { |
| 19 | + ecmaVersion: 'latest', |
| 20 | + sourceType: 'module', |
| 21 | + }, |
| 22 | + settings: { |
| 23 | + 'import/resolver': { |
| 24 | + typescript: { |
| 25 | + project: true, |
| 26 | + }, |
| 27 | + node: { |
| 28 | + project: true, |
| 29 | + extensions: ['.js', '.jsx', '.ts', '.tsx'], |
| 30 | + }, |
| 31 | + }, |
| 32 | + }, |
| 33 | + ignorePatterns: ['build/**/*', 'dist/**/*', 'coverage/**/*'], |
| 34 | + plugins: [ |
| 35 | + '@typescript-eslint', |
| 36 | + 'eslint-comments', |
| 37 | + 'unused-imports', |
| 38 | + 'no-barrel-files', |
| 39 | + ], |
| 40 | + rules: { |
| 41 | + // TypeScript rules |
| 42 | + '@typescript-eslint/no-empty-object-type': 'error', |
| 43 | + '@typescript-eslint/no-explicit-any': 'error', |
| 44 | + '@typescript-eslint/no-require-imports': 'error', |
| 45 | + // Handled by "unused-imports/no-unused-vars" instead. |
| 46 | + '@typescript-eslint/no-unused-vars': 'off', |
| 47 | + '@typescript-eslint/no-floating-promises': 'error', |
| 48 | + 'no-barrel-files/no-barrel-files': 'error', |
| 49 | + // Import rules |
| 50 | + 'import/extensions': [ |
| 51 | + 'error', |
| 52 | + 'never', |
| 53 | + { |
| 54 | + json: 'always', |
| 55 | + }, |
| 56 | + ], |
| 57 | + 'import/named': 'error', |
| 58 | + 'import/no-cycle': 'error', |
| 59 | + 'import/no-extraneous-dependencies': [ |
| 60 | + 'error', |
| 61 | + { |
| 62 | + devDependencies: true, |
| 63 | + packageDir: ['.', '../..'], // Include the workspace root package.json |
| 64 | + }, |
| 65 | + ], |
| 66 | + 'import/no-default-export': 'error', |
| 67 | + 'import/no-unresolved': [ |
| 68 | + 'error', |
| 69 | + { |
| 70 | + ignore: ['^@factory/'], |
| 71 | + }, |
| 72 | + ], |
| 73 | + 'import/order': [ |
| 74 | + 'error', |
| 75 | + { |
| 76 | + groups: [ |
| 77 | + 'builtin', |
| 78 | + 'external', |
| 79 | + 'internal', |
| 80 | + ['parent', 'sibling'], |
| 81 | + 'index', |
| 82 | + 'type', |
| 83 | + ], |
| 84 | + pathGroups: [ |
| 85 | + { |
| 86 | + pattern: '@/**', |
| 87 | + group: 'parent', |
| 88 | + }, |
| 89 | + ], |
| 90 | + distinctGroup: false, |
| 91 | + 'newlines-between': 'always', |
| 92 | + alphabetize: { |
| 93 | + order: 'asc', |
| 94 | + caseInsensitive: true, |
| 95 | + }, |
| 96 | + }, |
| 97 | + ], |
| 98 | + 'eslint-comments/no-unused-disable': 'error', |
| 99 | + 'no-void': [ |
| 100 | + 'error', |
| 101 | + { |
| 102 | + allowAsStatement: true, |
| 103 | + }, |
| 104 | + ], |
| 105 | + 'unused-imports/no-unused-imports': 'error', |
| 106 | + 'unused-imports/no-unused-vars': [ |
| 107 | + 'error', |
| 108 | + { |
| 109 | + vars: 'all', |
| 110 | + varsIgnorePattern: '^_', |
| 111 | + args: 'after-used', |
| 112 | + argsIgnorePattern: '^_', |
| 113 | + ignoreRestSiblings: false, |
| 114 | + caughtErrorsIgnorePattern: '^_', |
| 115 | + }, |
| 116 | + ], |
| 117 | + 'prefer-arrow-callback': ['error', { allowNamedFunctions: true }], |
| 118 | + // General rules |
| 119 | + 'class-methods-use-this': 'error', |
| 120 | + 'default-case': 'error', |
| 121 | + 'no-console': 'error', |
| 122 | + 'no-constant-condition': [ |
| 123 | + 'error', |
| 124 | + { |
| 125 | + checkLoops: false, |
| 126 | + }, |
| 127 | + ], |
| 128 | + 'no-param-reassign': [ |
| 129 | + 'error', |
| 130 | + { |
| 131 | + props: false, |
| 132 | + }, |
| 133 | + ], |
| 134 | + 'no-restricted-globals': 'error', |
| 135 | + 'no-promise-executor-return': 'error', |
| 136 | + 'prefer-promise-reject-errors': 'error', |
| 137 | + 'jest/expect-expect': 'error', |
| 138 | + // Covered by unused-imports |
| 139 | + 'no-unused-vars': 'off', |
| 140 | + }, |
| 141 | +}; |
0 commit comments