|
| 1 | +const config = require('@rubensworks/eslint-config'); |
| 2 | + |
| 3 | +module.exports = config([ |
| 4 | + { |
| 5 | + // Exclude performance benchmark scripts from linting |
| 6 | + ignores: [ 'perf/**' ], |
| 7 | + }, |
| 8 | + { |
| 9 | + files: [ '**/*.ts' ], |
| 10 | + languageOptions: { |
| 11 | + parserOptions: { |
| 12 | + tsconfigRootDir: __dirname, |
| 13 | + project: [ './tsconfig.eslint.json' ], |
| 14 | + }, |
| 15 | + }, |
| 16 | + }, |
| 17 | + { |
| 18 | + rules: { |
| 19 | + // Allow importing Node.js built-in modules (used in tests and webpack config) |
| 20 | + 'import/no-nodejs-modules': 'off', |
| 21 | + |
| 22 | + // Allow file extensions in import paths (required for JSON imports) |
| 23 | + 'import/extensions': 'off', |
| 24 | + }, |
| 25 | + }, |
| 26 | + { |
| 27 | + files: [ '**/*.ts' ], |
| 28 | + rules: { |
| 29 | + // This rule requires strictNullChecks, which is not enabled in this project |
| 30 | + 'ts/prefer-nullish-coalescing': 'off', |
| 31 | + |
| 32 | + // Extended naming conventions for this project |
| 33 | + 'ts/naming-convention': [ |
| 34 | + 'error', |
| 35 | + { |
| 36 | + selector: 'default', |
| 37 | + format: [ 'camelCase' ], |
| 38 | + leadingUnderscore: 'forbid', |
| 39 | + trailingUnderscore: 'forbid', |
| 40 | + }, |
| 41 | + { |
| 42 | + selector: 'import', |
| 43 | + format: null, |
| 44 | + }, |
| 45 | + { |
| 46 | + selector: 'variable', |
| 47 | + format: [ 'camelCase', 'UPPER_CASE' ], |
| 48 | + leadingUnderscore: 'forbid', |
| 49 | + trailingUnderscore: 'forbid', |
| 50 | + }, |
| 51 | + { |
| 52 | + selector: 'typeLike', |
| 53 | + format: [ 'PascalCase' ], |
| 54 | + }, |
| 55 | + { |
| 56 | + selector: [ 'typeParameter' ], |
| 57 | + format: [ 'PascalCase' ], |
| 58 | + prefix: [ 'T' ], |
| 59 | + }, |
| 60 | + { |
| 61 | + selector: 'interface', |
| 62 | + format: [ 'PascalCase' ], |
| 63 | + custom: { |
| 64 | + regex: '^I[A-Z]', |
| 65 | + match: true, |
| 66 | + }, |
| 67 | + }, |
| 68 | + { |
| 69 | + // Allow UPPER_CASE for static class properties (e.g., namespace constants) |
| 70 | + selector: 'classProperty', |
| 71 | + modifiers: [ 'static' ], |
| 72 | + format: [ 'camelCase', 'UPPER_CASE' ], |
| 73 | + leadingUnderscore: 'forbid', |
| 74 | + trailingUnderscore: 'forbid', |
| 75 | + }, |
| 76 | + { |
| 77 | + // Allow leading underscore for class methods (e.g., _transform, _flush from Node.js Transform API) |
| 78 | + selector: 'classMethod', |
| 79 | + format: [ 'camelCase' ], |
| 80 | + leadingUnderscore: 'allow', |
| 81 | + trailingUnderscore: 'forbid', |
| 82 | + }, |
| 83 | + { |
| 84 | + // Allow any format for object literal property names (e.g., MIME type keys like 'text/html') |
| 85 | + selector: 'objectLiteralProperty', |
| 86 | + format: null, |
| 87 | + }, |
| 88 | + ], |
| 89 | + }, |
| 90 | + }, |
| 91 | +]); |
0 commit comments