Registry / testing / eslint-plugin-react-naming-convention

eslint-plugin-react-naming-convention

JSON →
library4.2.3jsnpmunverified

ESLint plugin providing naming convention rules for React components, hooks, and props. Current stable version 4.2.3, part of the @eslint-react monorepo. Requires ESLint ^10.0.0 and Node >=22.0.0. Ships TypeScript types. Differentiated by its decoupled preset from eslint-plugin-react-x, allowing standalone use without the full react-x plugin. Release cadence is high (multiple betas per month) with breaking changes in v5.x series. Supports custom rules like boolean prop naming. ESM-only, no CJS support.

npm install eslint-plugin-react-naming-convention
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-REAC
E
eslint-plugin-react-naming-convention
testingjavascriptv4.2.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (plugin)
import reactNamingConvention from 'eslint-plugin-react-naming-convention'
const reactNamingConvention = require('eslint-plugin-react-naming-convention')
ESM-only; no CommonJS require supported. The default export is the plugin object containing rules and configs.
rules
import { rules } from 'eslint-plugin-react-naming-convention'
import reactNamingConvention from 'eslint-plugin-react-naming-convention'; const { rules } = reactNamingConvention
Named export for direct rule access, e.g., rules['naming-convention/component-name'].
configs
import { configs } from 'eslint-plugin-react-naming-convention'
import { config } from 'eslint-plugin-react-naming-convention'
Named export for preset configs like 'recommended'. Not 'config'.

Shows how to set up the plugin in flat ESLint config (v9+), enabling component-name and hook-name rules.

// eslint.config.js import reactNamingConvention from 'eslint-plugin-react-naming-convention'; export default [ { files: ['**/*.{ts,tsx,jsx}'], plugins: { 'react-naming-convention': reactNamingConvention, }, rules: { 'react-naming-convention/component-name': ['warn', { allow: ['default'] }], 'react-naming-convention/hook-name': 'error', }, }, ];
Debug
Known issues
breakingv5.x requires ESLint ^10.0.0 and Node >=22.0.0
fix
Upgrade ESLint to ^10.0.0 and Node to >=22.0.0.
affects: >=5.0.0
deprecatedv4.2.3 is the last v4.x; v5.x drops CJS support and renames presets
fix
Migrate to v5.x (currently beta) for continued updates. Switch to ESM imports.
affects: 4.x
gotchaPlugin is ESM-only; require() throws ERR_REQUIRE_ESM
fix
Use import syntax and ensure package.json has 'type': 'module' or use .mjs extension.
affects: >=5.0.0
breakingv5.0.2-beta.0 removed pre-built identifier predicates (is.memo, is.lazy, etc.) from RuleToolkit
fix
Use the *Call variants (e.g., RuleToolkit.is.MemoCall) instead.
affects: >=5.0.2-beta.0
gotchaPeer dependency on TypeScript is required for any type-aware rules
fix
Install typescript in your project even if not using TS directly.
affects: >=4.0.0
breakingv5.5.0-beta.0 removed component-hook-factories rule
fix
Remove rule from config; it was removed upstream.
affects: >=5.5.0-beta.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/eslint-plugin-react-naming-convention/dist/index.js from /path/to/eslint.config.js not supported.
Using CommonJS require() with ESM-only package
fix
Change to import statement: import reactNamingConvention from 'eslint-plugin-react-naming-convention' and ensure parent module is ESM.
Error: Failed to load plugin 'react-naming-convention' declared in 'plugins': Cannot find module 'eslint-plugin-react-naming-convention'
Plugin not installed or ESLint cannot resolve it
fix
Run npm install eslint-plugin-react-naming-convention --save-dev and verify node_modules path.
Error: Rule 'react-naming-convention/component-name' is not loaded correctly. Check plugin configuration.
Misnamed rule property or missing plugin in flat config
fix
Ensure plugin object is assigned under plugins key with correct prefix: plugins: { 'react-naming-convention': reactNamingConvention }
TypeError: Cannot read properties of undefined (reading 'component-name')
Direct access to rules without checking rule exists
fix
Access rules via import { rules } from 'eslint-plugin-react-naming-convention'; rules['component-name']
Upgrade
Version history
4.2.3latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required to run ESLint plugin
typescriptoptionalpeer dependency needed for type-aware rules
Agent activity
2 hits · last 30 days
node
2
Resources