diff --git a/eslint.config.mjs b/eslint.config.mjs index aa4f7d9070a..748f0cf5a12 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -14,6 +14,7 @@ import tseslint from "typescript-eslint"; import localRules from "./lint/rules/index.mjs"; import unusedImports from "eslint-plugin-unused-imports"; import eslintPluginUnicorn from "eslint-plugin-unicorn"; +import reactYouMightNotNeedAnEffect from "eslint-plugin-react-you-might-not-need-an-effect"; export default tseslint.config( globalIgnores([ @@ -36,6 +37,7 @@ export default tseslint.config( react.configs.flat["jsx-runtime"], reactHooks.configs["recommended-latest"], reactRefresh.configs.vite, + reactYouMightNotNeedAnEffect.configs.recommended, { settings: { diff --git a/package-lock.json b/package-lock.json index 1d4e5a950a5..7ab9d5109cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -135,6 +135,7 @@ "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.20", + "eslint-plugin-react-you-might-not-need-an-effect": "^0.5.6", "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-unicorn": "^61.0.2", "eslint-plugin-unused-imports": "^4.2.0", @@ -13979,6 +13980,23 @@ "eslint": ">=8.40" } }, + "node_modules/eslint-plugin-react-you-might-not-need-an-effect": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-you-might-not-need-an-effect/-/eslint-plugin-react-you-might-not-need-an-effect-0.5.6.tgz", + "integrity": "sha512-WZe5XlnsqempwyyLOrVMJWnA9yHC6TxibCwQyz4o9NfGKOh9svoydld10sFfaLVIOi+yO8G7BfYuOmZ6DCRuTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-utils": "^3.0.0", + "globals": "^16.2.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, "node_modules/eslint-plugin-react/node_modules/brace-expansion": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", @@ -14146,6 +14164,35 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10" + } + }, "node_modules/eslint-visitor-keys": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", diff --git a/package.json b/package.json index 2fd918119be..6718f670c5c 100644 --- a/package.json +++ b/package.json @@ -182,6 +182,7 @@ "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.20", + "eslint-plugin-react-you-might-not-need-an-effect": "^0.5.6", "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-unicorn": "^61.0.2", "eslint-plugin-unused-imports": "^4.2.0",