0.3.0 ā€¢ Published 1 year ago

enhanced-eslint-plugin-classnames v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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.

āœ”šŸ”§RuleDescription
āœ”šŸ”§classnames/prefer-classnames-functionsuggest using className() or clsx() in JSX className
āœ”šŸ”§classnames/one-by-one-argumentssuggest not to include multiple classes in an argument of className() or clsx()