@@ -7,6 +7,8 @@ const js = require("@eslint/js");
77const importPlugin = require ( "eslint-plugin-import" ) ;
88const jsxA11y = require ( "eslint-plugin-jsx-a11y" ) ;
99const prettier = require ( "eslint-plugin-prettier" ) ;
10+ const eslintPluginPrettier = require ( "eslint-config-prettier" ) ;
11+ const eslintPluginReactHooks = require ( "eslint-plugin-react-hooks" ) ;
1012
1113module . exports = [
1214 js . configs . recommended ,
@@ -31,6 +33,8 @@ module.exports = [
3133 import : importPlugin ,
3234 "jsx-a11y" : jsxA11y ,
3335 prettier,
36+ eslintPluginPrettier,
37+ "react-hooks" : eslintPluginReactHooks ,
3438 } ,
3539 settings : {
3640 react : {
@@ -51,6 +55,12 @@ module.exports = [
5155 "react/jsx-no-useless-fragment" : "off" ,
5256 "react/require-default-props" : "off" ,
5357 "react/jsx-props-no-spreading" : "off" ,
58+ "react/jsx-uses-vars" : "error" , // Marks JSX variables as used
59+ "react/jsx-uses-react" : "error" , // Marks React as used in JSX files
60+
61+ // React Hooks rules
62+ "react-hooks/rules-of-hooks" : "error" ,
63+ "react-hooks/exhaustive-deps" : "warn" ,
5464
5565 // Import rules
5666 "import/no-relative-packages" : "off" ,
@@ -74,7 +84,8 @@ module.exports = [
7484 "no-console" : 1 ,
7585 "no-unused-vars" : [ "warn" , {
7686 argsIgnorePattern : "^_" ,
77- varsIgnorePattern : "^(React|_)" ,
87+ varsIgnorePattern : "^(React|_|expect|test|describe|it|beforeEach|afterEach|beforeAll|afterAll|jest|vi|fixture|page)$" ,
88+ ignoreRestSiblings : true ,
7889 } ] ,
7990 "no-undef" : "off" , // Disable for config files and test files
8091
@@ -110,6 +121,7 @@ module.exports = [
110121 import : importPlugin ,
111122 "jsx-a11y" : jsxA11y ,
112123 prettier,
124+ "react-hooks" : eslintPluginReactHooks ,
113125 } ,
114126 settings : {
115127 react : {
@@ -141,11 +153,16 @@ module.exports = [
141153 extensions : [ ".js" , ".jsx" , ".ts" , ".tsx" ] ,
142154 } ] ,
143155 "@typescript-eslint/ban-ts-comment" : [ "warn" ] ,
144- "no-unused-vars" : "off" ,
156+ "no-unused-vars" : [ "warn" , {
157+ argsIgnorePattern : "^_" ,
158+ varsIgnorePattern : "^(React|_|expect|test|describe|it|beforeEach|afterEach|beforeAll|afterAll|jest|vi|fixture|page)$" ,
159+ ignoreRestSiblings : true ,
160+ } ] ,
145161 "react/require-default-props" : "off" ,
146- "@typescript-eslint/no-unused-vars" : [ "error " , {
162+ "@typescript-eslint/no-unused-vars" : [ "warn " , {
147163 argsIgnorePattern : "^_" ,
148- varsIgnorePattern : "^(React|_)" ,
164+ varsIgnorePattern : "^(React|_|expect|test|describe|it|beforeEach|afterEach|beforeAll|afterAll|jest|vi|fixture|page)$" ,
165+ ignoreRestSiblings : true ,
149166 } ] ,
150167 "@typescript-eslint/no-empty-function" : "off" ,
151168
@@ -160,6 +177,12 @@ module.exports = [
160177 "no-promise-executor-return" : "off" ,
161178 "default-param-last" : "off" ,
162179 "react/jsx-props-no-spreading" : "off" ,
180+ "react/jsx-uses-vars" : "error" , // Marks JSX variables as used
181+ "react/jsx-uses-react" : "error" , // Marks React as used in JSX files
182+
183+ // React Hooks rules
184+ "react-hooks/rules-of-hooks" : "error" ,
185+ "react-hooks/exhaustive-deps" : "warn" ,
163186 "prettier/prettier" : [ "error" , { } , {
164187 usePrettierrc : true ,
165188 } ] ,
0 commit comments