|
| 1 | +import eslint from "@eslint/js"; |
| 2 | +import neostandard from "neostandard"; |
| 3 | +import tseslint from "typescript-eslint"; |
| 4 | + |
| 5 | +export default tseslint.config( |
| 6 | + // Base |
| 7 | + eslint.configs.recommended, |
| 8 | + |
| 9 | + // Standard |
| 10 | + ...neostandard({ noStyle: true }), |
| 11 | + |
| 12 | + // TypeScript |
| 13 | + ...tseslint.configs.strictTypeChecked, |
| 14 | + ...tseslint.configs.stylisticTypeChecked, |
| 15 | + { |
| 16 | + languageOptions: { |
| 17 | + parserOptions: { |
| 18 | + project: "./tsconfig.json", |
| 19 | + }, |
| 20 | + }, |
| 21 | + }, |
| 22 | + { |
| 23 | + ignores: ["dist/*"], |
| 24 | + }, |
| 25 | + |
| 26 | + // Custom rules |
| 27 | + { |
| 28 | + rules: { |
| 29 | + "@typescript-eslint/strict-boolean-expressions": [ |
| 30 | + "error", |
| 31 | + { |
| 32 | + allowString: false, |
| 33 | + allowNumber: false, |
| 34 | + allowNullableObject: false, |
| 35 | + allowNullableBoolean: false, |
| 36 | + allowNullableString: false, |
| 37 | + allowNullableNumber: false, |
| 38 | + allowAny: false, |
| 39 | + }, |
| 40 | + ], |
| 41 | + "@typescript-eslint/consistent-type-imports": [ |
| 42 | + "error", |
| 43 | + { |
| 44 | + fixStyle: "inline-type-imports", |
| 45 | + }, |
| 46 | + ], |
| 47 | + }, |
| 48 | + }, |
| 49 | + |
| 50 | + // Node's builtin test runner "describe" and "it" functions return promises but |
| 51 | + // it's fine not to await them |
| 52 | + { |
| 53 | + files: ["test/**/*.test.ts"], |
| 54 | + rules: { |
| 55 | + "@typescript-eslint/no-floating-promises": "off", |
| 56 | + }, |
| 57 | + }, |
| 58 | + |
| 59 | + // Disable type-aware linting for config files |
| 60 | + { |
| 61 | + files: ["*.config.[j|t]s", "*.config.mjs"], |
| 62 | + extends: [tseslint.configs.disableTypeChecked], |
| 63 | + }, |
| 64 | +); |
| 65 | + |
0 commit comments