37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
import js from "@eslint/js";
|
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
import prettier from "eslint-config-prettier/flat";
|
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
import reactRefresh from "eslint-plugin-react-refresh";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
export default defineConfig([
|
|
globalIgnores(["dist/**", "coverage/**", "node_modules/**"]),
|
|
{
|
|
files: ["**/*.{ts,tsx}"],
|
|
extends: [js.configs.recommended, tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked],
|
|
languageOptions: { parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname } },
|
|
rules: {
|
|
"@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }],
|
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
"@typescript-eslint/no-unnecessary-condition": "off",
|
|
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
|
|
"@typescript-eslint/prefer-nullish-coalescing": ["error", { ignorePrimitives: { string: true } }],
|
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
"no-debugger": "error",
|
|
curly: ["error", "all"],
|
|
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
},
|
|
},
|
|
{
|
|
files: ["src/**/*.{ts,tsx}"],
|
|
plugins: { "react-hooks": { rules: reactHooks.rules }, "react-refresh": reactRefresh },
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
"react-hooks/exhaustive-deps": "error",
|
|
"react-refresh/only-export-components": ["error", { allowConstantExport: true }],
|
|
},
|
|
},
|
|
prettier,
|
|
]);
|