|
| 1 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 2 | +import eslint from "@eslint/js"; |
| 3 | +import comments from "@eslint-community/eslint-plugin-eslint-comments"; |
| 4 | +import prettierConfig from "eslint-config-prettier"; |
| 5 | +import prettierPlugin from "eslint-plugin-prettier"; |
| 6 | +import simpleImportSort from "eslint-plugin-simple-import-sort"; |
| 7 | +import tseslint from "typescript-eslint"; |
| 8 | + |
| 9 | +const compat = new FlatCompat({ baseDirectory: __dirname }); |
| 10 | + |
| 11 | +export default tseslint.config( |
| 12 | + eslint.configs.recommended, |
| 13 | + ...tseslint.configs.recommended, |
| 14 | + ...compat.extends("plugin:prettier/recommended"), |
| 15 | + prettierConfig, |
| 16 | + { |
| 17 | + languageOptions: { |
| 18 | + parser: tseslint.parser, |
| 19 | + parserOptions: { |
| 20 | + ecmaVersion: "latest", |
| 21 | + sourceType: "module", |
| 22 | + project: ["./tsconfig.json", "./tsconfig.eslint.json", "./src/*/tsconfig.json"], |
| 23 | + ecmaFeatures: { jsx: true }, |
| 24 | + }, |
| 25 | + }, |
| 26 | + plugins: { |
| 27 | + "@typescript-eslint": tseslint.plugin, |
| 28 | + prettier: prettierPlugin, |
| 29 | + "simple-import-sort": simpleImportSort, |
| 30 | + "eslint-comments": comments, |
| 31 | + }, |
| 32 | + rules: { |
| 33 | + // off |
| 34 | + "@typescript-eslint/explicit-function-return-type": "off", |
| 35 | + "@typescript-eslint/explicit-module-boundary-types": "off", |
| 36 | + "@typescript-eslint/no-empty-function": "off", |
| 37 | + "@typescript-eslint/no-empty-interface": "off", |
| 38 | + "@typescript-eslint/no-namespace": "off", |
| 39 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 40 | + "@typescript-eslint/no-use-before-define": "off", |
| 41 | + "no-debugger": "off", |
| 42 | + "no-extra-boolean-cast": "off", |
| 43 | + |
| 44 | + // warn |
| 45 | + "@typescript-eslint/no-unused-expressions": "warn", |
| 46 | + "@typescript-eslint/no-unused-vars": "warn", |
| 47 | + "eslint-comments/disable-enable-pair": ["warn", { allowWholeFile: true }], |
| 48 | + "eslint-comments/no-unused-disable": "warn", |
| 49 | + "eslint-comments/require-description": "warn", |
| 50 | + "no-console": "warn", |
| 51 | + "no-undef-init": "warn", |
| 52 | + "prefer-const": ["warn", { destructuring: "all" }], |
| 53 | + "prettier/prettier": "warn", |
| 54 | + "simple-import-sort/exports": "warn", |
| 55 | + "simple-import-sort/imports": "warn", |
| 56 | + curly: ["warn", "multi-line", "consistent"], |
| 57 | + |
| 58 | + // error |
| 59 | + "@typescript-eslint/array-type": ["error", { default: "generic", readonly: "generic" }], |
| 60 | + "@typescript-eslint/no-deprecated": "error", |
| 61 | + "@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }], |
| 62 | + "@typescript-eslint/no-require-imports": "error", |
| 63 | + "no-constant-condition": ["error", { checkLoops: false }], |
| 64 | + "no-restricted-imports": ["error", { patterns: [".*"] }], |
| 65 | + }, |
| 66 | + }, |
| 67 | + { |
| 68 | + ignores: ["node_modules/", "tests/", "out/", "coverage/", "devlink/"], |
| 69 | + }, |
| 70 | +); |
0 commit comments