|
| 1 | +import { defineConfig, globalIgnores } from "eslint/config"; |
| 2 | +import tsParser from "@typescript-eslint/parser"; |
| 3 | +import path from "node:path"; |
| 4 | +import { fileURLToPath } from "node:url"; |
| 5 | +import js from "@eslint/js"; |
| 6 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 7 | + |
| 8 | +const __filename = fileURLToPath(import.meta.url); |
| 9 | +const __dirname = path.dirname(__filename); |
| 10 | +const compat = new FlatCompat({ |
| 11 | + baseDirectory: __dirname, |
| 12 | + recommendedConfig: js.configs.recommended, |
| 13 | + allConfig: js.configs.all, |
| 14 | +}); |
| 15 | + |
| 16 | +export default defineConfig([globalIgnores(["**/dist/"]), { |
| 17 | + extends: compat.extends( |
| 18 | + "eslint:recommended", |
| 19 | + "plugin:@typescript-eslint/eslint-recommended", |
| 20 | + "plugin:@typescript-eslint/recommended", |
| 21 | + ), |
| 22 | + |
| 23 | + languageOptions: { |
| 24 | + parser: tsParser, |
| 25 | + ecmaVersion: 2018, |
| 26 | + sourceType: "module", |
| 27 | + }, |
| 28 | + |
| 29 | + rules: { |
| 30 | + quotes: ["error", "double"], |
| 31 | + indent: ["error", 2, { |
| 32 | + SwitchCase: 0, |
| 33 | + }], |
| 34 | + "linebreak-style": ["error", "unix"], |
| 35 | + semi: ["error", "always"], |
| 36 | + "comma-dangle": ["error", "always-multiline"], |
| 37 | + "dot-notation": "error", |
| 38 | + eqeqeq: ["error", "smart"], |
| 39 | + curly: ["error", "all"], |
| 40 | + "brace-style": ["error"], |
| 41 | + "prefer-arrow-callback": "warn", |
| 42 | + "max-len": ["warn", 160], |
| 43 | + "object-curly-spacing": ["error", "always"], |
| 44 | + "@typescript-eslint/no-unused-vars": ["error", { |
| 45 | + caughtErrors: "none", |
| 46 | + }], |
| 47 | + "@typescript-eslint/no-use-before-define": ["error", { |
| 48 | + classes: false, |
| 49 | + enums: false, |
| 50 | + }], |
| 51 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 52 | + "@typescript-eslint/explicit-module-boundary-types": "error", |
| 53 | + }, |
| 54 | +}]); |
0 commit comments