eslint-plugin-idiomatic-jsx-u v1.1.4
eslint-plugin-idiomatic-jsx
This is just an updated version of the plugin that works with eslint v7.1.0. All the credits to danrigsby that created the original project.
ESLint jsx plugin to bring more idiomatic control over JSX elements.
These rules allow you to create idiomatic styling over JSX in your projects. For instance, enforcing or preventing certain attributes on JSX elements. The goal is to extend the rule sets provided by eslint-plugin-react and eslint-plugin-jsx-a11y to give you more control over how JSX is used.
Some Possible Use Cases
- Require
idtags on components likeaandinputfor easier automated tests - Prevent
onClickbeing used ondivorspancomponents - Prevent use of
buttoncomponents in favor of a customButtoncomponents
Installation
You'll first need to install ESLint:
# npm
npm install eslint --save-dev
# yarn
yarn add eslint --devNext, install eslint-plugin-idiomatic-jsx:
# npm
npm install eslint-plugin-idiomatic-jsx-u --save-dev
# yarn
yarn add eslint-plugin-idiomatic-jsx-u --devNote: If you installed ESLint globally then you must also install eslint-plugin-idiomatic-jsx globally.
Configuration
Add idiomatic-jsx to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix
{
"plugins": [
"idiomatic-jsx-u"
]
}Configure the rules you want to use under the rules section.
{
"rules": {
"idiomatic-jsx-u/rule-name": [ 2, {
// options
} ]
}
}List of Supported Rules
- prevent-attributes: Prevent specified
attributeson specifiedcomponentsfrom being used. - prevent-components: Prevent specified
componentsfrom being used. - require-attributes: Require specified
attributeson specifiedcomponentsto be defined.
License
eslint-plugin-idiomatic-jsx is licensed under the MIT License.