67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
import js from "@eslint/js";
|
|
import globals from "globals";
|
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
import reactRefresh from "eslint-plugin-react-refresh";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: [
|
|
"dist",
|
|
"android/**",
|
|
"ios/**",
|
|
"capacitor/**",
|
|
"node_modules/**",
|
|
"*.config.js",
|
|
"*.config.ts",
|
|
"src/archive/**",
|
|
],
|
|
},
|
|
{
|
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
files: ["**/*.{ts,tsx}"],
|
|
languageOptions: {
|
|
ecmaVersion: 2020,
|
|
globals: globals.browser,
|
|
},
|
|
plugins: {
|
|
"react-hooks": reactHooks,
|
|
"react-refresh": reactRefresh,
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
"react-refresh/only-export-components": [
|
|
"warn",
|
|
{ allowConstantExport: true },
|
|
],
|
|
// TypeScript specific rules
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{
|
|
argsIgnorePattern: "^_",
|
|
varsIgnorePattern: "^_",
|
|
},
|
|
],
|
|
"@typescript-eslint/no-explicit-any": "warn",
|
|
"@typescript-eslint/no-inferrable-types": "error",
|
|
|
|
// General JavaScript rules
|
|
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
"no-debugger": "error",
|
|
"no-alert": "error",
|
|
"prefer-const": "error",
|
|
"no-var": "error",
|
|
eqeqeq: ["error", "always"],
|
|
curly: ["error", "all"],
|
|
|
|
// React specific rules
|
|
"react-hooks/exhaustive-deps": "error",
|
|
|
|
// Code quality rules (relaxed for migration period)
|
|
complexity: ["warn", 30],
|
|
"max-depth": ["warn", 6],
|
|
"max-lines-per-function": ["warn", 300],
|
|
},
|
|
}
|
|
);
|