|
| 1 | +// eslint.config.cjs — CJS flat config compatible with ESLint v9 + TS-ESLint v8 |
| 2 | + |
| 3 | +const js = require("@eslint/js"); |
| 4 | +const tseslint = require("typescript-eslint"); |
| 5 | +const prettier = require("eslint-config-prettier"); |
| 6 | +const noInstanceOf = require("eslint-plugin-no-instanceof"); |
| 7 | +const importPlugin = require("eslint-plugin-import"); |
| 8 | + |
| 9 | +module.exports = [ |
| 10 | + js.configs.recommended, |
| 11 | + prettier, |
| 12 | + ...tseslint.configs.recommended, |
| 13 | + |
| 14 | + { |
| 15 | + files: ["src/**/*.{ts,js,tsx,jsx}"], |
| 16 | + |
| 17 | + ignores: [ |
| 18 | + "src/utils/@cfworker", |
| 19 | + "src/utils/fast-json-patch", |
| 20 | + "src/utils/js-sha1", |
| 21 | + ".eslintrc.cjs", |
| 22 | + "scripts", |
| 23 | + "node_modules", |
| 24 | + "dist", |
| 25 | + "dist-cjs", |
| 26 | + "*.js", |
| 27 | + "*.cjs", |
| 28 | + "*.d.ts", |
| 29 | + ], |
| 30 | + |
| 31 | + languageOptions: { |
| 32 | + ecmaVersion: "latest", |
| 33 | + sourceType: "module", |
| 34 | + parser: tseslint.parser, // ✅ correct parser object |
| 35 | + parserOptions: { |
| 36 | + project: "./tsconfig.json", |
| 37 | + }, |
| 38 | + }, |
| 39 | + |
| 40 | + plugins: { |
| 41 | + "@typescript-eslint": tseslint.plugin, // ✅ correct plugin object |
| 42 | + "no-instanceof": noInstanceOf, |
| 43 | + import: importPlugin, |
| 44 | + }, |
| 45 | + |
| 46 | + rules: { |
| 47 | + "no-process-env": 2, |
| 48 | + "no-instanceof/no-instanceof": 2, |
| 49 | + |
| 50 | + "@typescript-eslint/explicit-module-boundary-types": 0, |
| 51 | + "@typescript-eslint/no-empty-function": 0, |
| 52 | + "@typescript-eslint/no-shadow": 0, |
| 53 | + "@typescript-eslint/no-empty-interface": 0, |
| 54 | + "@typescript-eslint/no-use-before-define": [ |
| 55 | + "error", |
| 56 | + { functions: false, classes: true, variables: true }, |
| 57 | + ], |
| 58 | + "@typescript-eslint/no-unused-vars": ["warn", { args: "none" }], |
| 59 | + "@typescript-eslint/no-floating-promises": "error", |
| 60 | + "@typescript-eslint/no-misused-promises": "error", |
| 61 | + |
| 62 | + camelcase: 0, |
| 63 | + "class-methods-use-this": 0, |
| 64 | + "import/extensions": [2, "ignorePackages"], |
| 65 | + "import/no-extraneous-dependencies": [ |
| 66 | + "error", |
| 67 | + { devDependencies: ["**/*.test.ts"] }, |
| 68 | + ], |
| 69 | + "import/no-unresolved": 0, |
| 70 | + "import/prefer-default-export": 0, |
| 71 | + |
| 72 | + "keyword-spacing": "error", |
| 73 | + "max-classes-per-file": 0, |
| 74 | + "max-len": 0, |
| 75 | + "no-await-in-loop": 0, |
| 76 | + "no-bitwise": 0, |
| 77 | + "no-console": 0, |
| 78 | + "no-restricted-syntax": 0, |
| 79 | + "no-shadow": 0, |
| 80 | + "no-continue": 0, |
| 81 | + "no-void": 0, |
| 82 | + "no-underscore-dangle": 0, |
| 83 | + "no-use-before-define": 0, |
| 84 | + "no-useless-constructor": 0, |
| 85 | + "no-return-await": 0, |
| 86 | + "consistent-return": 0, |
| 87 | + "no-else-return": 0, |
| 88 | + "func-names": 0, |
| 89 | + "no-lonely-if": 0, |
| 90 | + "prefer-rest-params": 0, |
| 91 | + "new-cap": ["error", { properties: false, capIsNew: false }], |
| 92 | + }, |
| 93 | + }, |
| 94 | +]; |
0 commit comments