1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| import type { Linter } from "eslint"; import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; import js from "@eslint/js"; import tseslint from "typescript-eslint"; import prettierConfig from "eslint-config-prettier"; import prettierPlugin from "eslint-plugin-prettier";
const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename);
export default [ { ignores: [ "node_modules/**", "dist/**", "build/**", "coverage/**", "*.config.js", "*.config.ts", ], },
js.configs.recommended, ...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked,
{ languageOptions: { parser: tseslint.parser, parserOptions: { project: true, tsconfigRootDir: __dirname, }, }, plugins: { "@typescript-eslint": tseslint.plugin, }, rules: { quotes: ["error", "double", { avoidEscape: true }], "@typescript-eslint/quotes": ["error", "double"], "@typescript-eslint/indent": ["error", 4], "@typescript-eslint/semi": ["error", "always"], "@typescript-eslint/comma-dangle": ["error", "always-multiline"],
"@typescript-eslint/no-explicit-any": "error", "@typescript-eslint/explicit-function-return-type": [ "error", { allowExpressions: true, allowTypedFunctionExpressions: true }, ], "@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
"@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-unused-vars": [ "error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, ], "import/no-cycle": "error",
"no-consle": "off",
"@typescript-eslint/no-non-null-assertion": "error", "@typescript-eslint/restrict-template-expressions": "off", }, },
prettierConfig, { plugins: { prettier: prettierPlugin }, rules: { "prettier/prettier": "error", "arrow-body-style": "off", "prefer-arrow-callback": "off", }, }, ] as Linter.Config[];
|