eslint-plugin-react-naming-convention
v1.17.1
Published
ESLint React's ESLint plugin for naming convention related rules.
Downloads
527,421
Maintainers
Readme
eslint-plugin-react-naming-convention
Naming convention rules.
[!NOTE] This plugin is already included in
@eslint-react/eslint-plugin
. You don't need to install it separately if you are using@eslint-react/eslint-plugin
.
Install
# npm
npm install --save-dev eslint-plugin-react-naming-convention
Setup
// @ts-check
import js from "@eslint/js";
import reactNamingConvention from "eslint-plugin-react-naming-convention";
export default [
js.configs.recommended,
{
files: ["**/*.{ts,tsx}"],
plugins: {
"react-naming-convention": reactNamingConvention,
},
rules: {
// react-naming-convention recommended rules
"react-naming-convention/filename-extension": ["warn", "as-needed"],
"react-naming-convention/use-state": "warn",
},
},
];
Rules
| Rule | Description | 💼 | 💭 | |
| :------------------- | :----------------------------------------------------------------------------------------- | :-: | :-: | :-: |
| component-name
| Enforces naming conventions for components. | 📖 | | |
| filename
| Enforces naming convention for JSX files. | 📖 | | |
| filename-extension
| Enforces consistent use of the JSX file extension. | 📖 | | |
| use-state
| Enforces destructuring and symmetric naming of useState
hook value and setter variables. | 📖 | | |