@noctcore/eslint-plugin-react
v0.2.0
Published
General-purpose React architecture and correctness ESLint rules.
Maintainers
Readme
@noctcore/eslint-plugin-react
General-purpose React architecture + correctness rules. Flat-config only, ESLint 9+.
Install
bun add -D @noctcore/eslint-plugin-react # or npm i -D / pnpm add -DUse
// eslint.config.js
import react from '@noctcore/eslint-plugin-react';
export default [
react.configs.recommended,
];Or wire rules individually:
import react from '@noctcore/eslint-plugin-react';
export default [
{
plugins: { 'noctcore-react': react },
rules: {
'noctcore-react/no-prop-drilling': ['error', { maxForwarded: 4 }],
},
},
];Rules
| Rule | Description | 🔧 |
| --- | --- | --- |
| component-props-naming | Require a component's first-param props type to be named <Component>Props. | 🔧 |
| context-value-must-be-memoized | Forbid inline object literals as a context Provider value. | |
| max-hook-return-surface | Cap the return surface of an exported hook (god-controller guard). | |
| max-hooks-per-file | Limit exported use* hooks in a hook/query/mutation file. | |
| max-props-per-component | Cap locally-declared members in a *Props contract. | |
| no-effect-derived-state | Flag an effect that only sets state derived from its dependencies. | |
| no-jsx-computation | Disallow array methods, arithmetic, and chained logic inside JSX {...}. | |
| no-jsx-in-hooks | Forbid a use*-named function from returning JSX. | |
| no-prop-drilling | Flag a bundle of props forwarded unchanged to the same child. | |
| no-state-in-component-body | Keep state/effect/query hooks in the colocated hook file, not the component body. | |
| prefer-lazy-state-init | Wrap an expensive useState initializer call in a lazy function. | 🔧 |
| props-must-be-visual | Disallow auth/identity/credential names in *Props contracts. | |
| require-effect-cancellation | Flag an unguarded setState after an await/.then inside an effect. | |
