CSFlorin / eslint-plugin-classnames

Warn and formats long classNames usage in JSX

Home Page:https://www.npmjs.com/package/eslint-plugin-classnames

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eslint-plugin-classnames

Warn and formats long classNames usage in JSX

Installation

You'll first need to install ESLint:

$ 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:

{
  "plugins": ["classnames"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "classnames/prefer-classnames-function": 2
  }
}

Supported Rules

βœ”: 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()

About

Warn and formats long classNames usage in JSX

https://www.npmjs.com/package/eslint-plugin-classnames

License:MIT License


Languages

Language:JavaScript 100.0%