https://github.com/fsubal/eslint-plugin-classnames
Warn and formats long classNames usage in JSX
https://github.com/fsubal/eslint-plugin-classnames
classnames eslint eslint-plugin
Last synced: about 1 year ago
JSON representation
Warn and formats long classNames usage in JSX
- Host: GitHub
- URL: https://github.com/fsubal/eslint-plugin-classnames
- Owner: fsubal
- License: mit
- Created: 2021-07-02T14:57:17.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-05-05T15:02:32.000Z (about 1 year ago)
- Last Synced: 2025-05-05T16:22:22.926Z (about 1 year ago)
- Topics: classnames, eslint, eslint-plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/eslint-plugin-classnames
- Size: 394 KB
- Stars: 20
- Watchers: 3
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-classnames
Warn and formats long classNames usage in JSX
## Installation
You'll first need to install [ESLint](http://eslint.org):
```
$ npm i eslint --save-dev
```
Next, install `eslint-plugin-classnames`:
```
$ npm install eslint-plugin-classnames --save-dev
```
## Usage
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
}
}
```
## Supported Rules
✔: Enabled in the [`recommended`](#recommended) configuration.\
🔧: Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).
| ✔ | 🔧 | Rule | Description |
| :-: | :-: | :-------------------------------------------------------------------------------- | :------------------------------------------------------------------------------ |
| ✔ | 🔧 | [classnames/prefer-classnames-function](docs/rules/prefer-classnames-function.md) | suggest using className() or clsx() in JSX className |
| ✔ | 🔧 | [classnames/one-by-one-arguments](docs/rules/one-by-one-arguments.md) | suggest not to include multiple classes in an argument of className() or clsx() |