Extra rules for React Hooks.
Install
npm install --save-dev eslint-plugin-react-hooks-extra
Setup
import js from "@eslint/js";
import reactHooksExtra from "eslint-plugin-react-hooks-extra";
import tseslint from "typescript-eslint";
export default tseslint.config({
files: ["**/*.ts", "**/*.tsx"],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooksExtra.configs.recommended,
],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
},
});
Rules
https://eslint-react.xyz/docs/rules/overview#hooks-extra-rules
v1.48.3 (2025-04-17)
🪄 Improvements
- refactor: improve settings handling by @Rel1cx in https://github.com/Rel1cx/eslint-react/pull/1080
- docs: add more examples to
web-api/no-leaked-event-listener
docs by @Rel1cx in https://github.com/Rel1cx/eslint-react/pull/1082
Full Changelog: https://github.com/Rel1cx/eslint-react/compare/v1.48.2...v1.48.3