|
| 1 | +const js = require("@eslint/js"); |
| 2 | +const tsParser = require("@typescript-eslint/parser"); |
| 3 | +const tsPlugin = require("@typescript-eslint/eslint-plugin"); |
| 4 | +const simpleImportSort = require("eslint-plugin-simple-import-sort"); |
| 5 | +const unusedImports = require("eslint-plugin-unused-imports"); |
| 6 | +const prettier = require("eslint-config-prettier"); |
| 7 | + |
| 8 | +module.exports = [ |
| 9 | + { ignores: ["**/dist/**", "**/node_modules/**", "**/coverage/**"] }, |
| 10 | + js.configs.recommended, |
| 11 | + { |
| 12 | + languageOptions: { |
| 13 | + parser: tsParser, |
| 14 | + ecmaVersion: "latest", |
| 15 | + sourceType: "module", |
| 16 | + globals: { |
| 17 | + console: "readonly", |
| 18 | + process: "readonly", |
| 19 | + Buffer: "readonly", |
| 20 | + __dirname: "readonly", |
| 21 | + __filename: "readonly", |
| 22 | + module: "readonly", |
| 23 | + require: "readonly", |
| 24 | + exports: "readonly", |
| 25 | + setTimeout: "readonly", |
| 26 | + clearTimeout: "readonly", |
| 27 | + setInterval: "readonly", |
| 28 | + clearInterval: "readonly", |
| 29 | + Promise: "readonly", |
| 30 | + URL: "readonly", |
| 31 | + URLSearchParams: "readonly", |
| 32 | + fetch: "readonly", |
| 33 | + Headers: "readonly", |
| 34 | + Request: "readonly", |
| 35 | + Response: "readonly", |
| 36 | + AbortController: "readonly", |
| 37 | + AbortSignal: "readonly", |
| 38 | + TextEncoder: "readonly", |
| 39 | + TextDecoder: "readonly", |
| 40 | + describe: "readonly", |
| 41 | + it: "readonly", |
| 42 | + expect: "readonly", |
| 43 | + beforeEach: "readonly", |
| 44 | + afterEach: "readonly", |
| 45 | + beforeAll: "readonly", |
| 46 | + afterAll: "readonly", |
| 47 | + jest: "readonly" |
| 48 | + } |
| 49 | + }, |
| 50 | + plugins: { |
| 51 | + "@typescript-eslint": tsPlugin, |
| 52 | + "simple-import-sort": simpleImportSort, |
| 53 | + "unused-imports": unusedImports |
| 54 | + }, |
| 55 | + rules: { |
| 56 | + ...tsPlugin.configs.recommended.rules, |
| 57 | + indent: ["error", 2], |
| 58 | + quotes: ["error", "single", { avoidEscape: true, allowTemplateLiterals: true }], |
| 59 | + "quote-props": ["error", "as-needed"], |
| 60 | + semi: ["error", "always"], |
| 61 | + "simple-import-sort/imports": "warn", |
| 62 | + "simple-import-sort/exports": "warn", |
| 63 | + "unused-imports/no-unused-imports": "warn", |
| 64 | + "@typescript-eslint/no-unused-vars": [ |
| 65 | + "warn", |
| 66 | + { argsIgnorePattern: "React|res|next|^_" } |
| 67 | + ], |
| 68 | + "@typescript-eslint/no-explicit-any": "off", |
| 69 | + "@typescript-eslint/no-var-requires": "off", |
| 70 | + "@typescript-eslint/no-require-imports": "off", |
| 71 | + "no-console": "off", |
| 72 | + "@typescript-eslint/ban-ts-comment": "off", |
| 73 | + "prefer-const": "off", |
| 74 | + "no-case-declarations": "off", |
| 75 | + "no-implicit-globals": "off", |
| 76 | + "@typescript-eslint/no-unsafe-declaration-merging": "off" |
| 77 | + } |
| 78 | + }, |
| 79 | + { |
| 80 | + files: ["**/*.config.js", "eslint.config.js", "jest.config.js", "**/jest.config.js"], |
| 81 | + languageOptions: { |
| 82 | + globals: { |
| 83 | + module: "readonly", |
| 84 | + require: "readonly" |
| 85 | + } |
| 86 | + }, |
| 87 | + rules: { |
| 88 | + "@typescript-eslint/no-require-imports": "off", |
| 89 | + "no-undef": "off" |
| 90 | + } |
| 91 | + }, |
| 92 | + prettier |
| 93 | +]; |
0 commit comments