chore: react eslint rules

This commit is contained in:
Mikhailov Anton 2025-12-05 15:31:02 +04:00
parent 9f33ca83a3
commit 7cc181a736
3 changed files with 1251 additions and 0 deletions

View file

@ -1,6 +1,8 @@
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
import js from "@eslint/js";
import prettier from "eslint-config-prettier/flat";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import { defineConfig, globalIgnores } from "eslint/config";
import globals from "globals";
import tseslint from "typescript-eslint";
@ -49,4 +51,31 @@ export default defineConfig([
"@typescript-eslint/no-unused-vars": "off",
},
},
{
files: ["**/use*.{js,jsx,ts,tsx}", "**/*.{jsx,tsx}"],
plugins: {
react: reactPlugin,
"react-hooks": reactHooksPlugin,
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "detect",
},
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs["jsx-runtime"].rules,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": ["warn", { additionalHooks: "(useRenderEffect|useFabric)" }],
"react/no-children-prop": "off",
"react/no-unknown-property": "off",
},
},
]);

View file

@ -15,6 +15,8 @@
"@types/react-dom": "^19.2.3",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1",
"globals": "^16.5.0",
"jiti": "^2.6.1",
"prettier": "^3.7.4",

1220
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff