Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 16 days 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 (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T15:00:57.000Z (7 months ago)
- Last Synced: 2024-04-08T18:36:12.165Z (7 months ago)
- Topics: classnames, eslint, eslint-plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/eslint-plugin-classnames
- Size: 578 KB
- Stars: 18
- Watchers: 4
- 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() |