@10stars/oxlint-plugin-react-hooks
v1.1.0
Published
Readme
@10stars/oxlint-plugin-react-hooks
Oxlint JS plugin for React hooks exhaustive-deps rule with enhanced configuration options.
Fork of eslint-plugin-react-hooks & eslint-plugin-react-hooks-configurable adapted for oxlint's JS plugin system.
Installation
bun add @10stars/oxlint-plugin-react-hooksOxlint Configuration
{
"jsPlugins": ["@10stars/oxlint-plugin-react-hooks"],
"rules": {
"react/exhaustive-deps": "off",
"@10stars/react-hooks/exhaustive-deps": "warn"
}
}Built-in Defaults
The rule ships with opinionated defaults so you don't have to repeat them in every config:
ignoreThisDependency:"always"additionalHooks:(useUpdateEffect|useIsomorphicLayoutEffect|useDeepCompareEffect|useShallowCompareEffect|useCustomCompareEffect)additionalStableHooks:{ "useToggle": [false, true] }
Any option you pass is merged on top of these defaults and takes precedence. Built-in entries can be overridden per key (e.g. set useToggle to false) but cannot be removed.
Rule Options
ignoreThisDependency
Control how this references (like props.doSomething()) are handled in dependency arrays.
Valid options: "never", "props", "always" (default: "always")
{
"@10stars/react-hooks/exhaustive-deps": [
"warn",
{
"ignoreThisDependency": "always"
}
]
}additionalHooks
Validate dependencies of custom hooks. Supports position configuration for where the callback argument is located.
{
"additionalHooks": {
"(useMyCustomHook|useMyOtherCustomHook)": 0,
"useMyImperativeHandle": 1
}
}additionalStableHooks
Mark custom hooks as returning stable values (fully or partially).
{
"additionalStableHooks": {
"use.+Ref": true,
"useMyCustomUseState": [false, true],
"useMyQuery": { "data": false, "refetch": true }
}
}