Warn and formats long classNames usage in JSX
npm install eslint-plugin-classnamesWarn and formats long classNames usage in JSX
You'll first need to install ESLint:
```
$ npm i eslint --save-dev
Next, install eslint-plugin-classnames:
``
$ npm install eslint-plugin-classnames --save-dev
Add classnames to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
`json`
{
"plugins": ["classnames"]
}
Then configure the rules you want to use under the rules section.
`json`
{
"rules": {
"classnames/prefer-classnames-function": 2
}
}
ā: Enabled in the recommended configuration.\
š§: Fixable with eslint --fix`.
| ā | š§ | Rule | Description |
| :-: | :-: | :-------------------------------------------------------------------------------- | :------------------------------------------------------------------------------ |
| ā | š§ | classnames/prefer-classnames-function | suggest using className() or clsx() in JSX className |
| ā | š§ | classnames/one-by-one-arguments | suggest not to include multiple classes in an argument of className() or clsx() |