https://github.com/danrigsby/eslint-plugin-idiomatic-jsx
Eslint jsx plugin to bring more idiomatic control over jsx
https://github.com/danrigsby/eslint-plugin-idiomatic-jsx
eslint eslint-jsx-plugin jsx react
Last synced: about 1 month ago
JSON representation
Eslint jsx plugin to bring more idiomatic control over jsx
- Host: GitHub
- URL: https://github.com/danrigsby/eslint-plugin-idiomatic-jsx
- Owner: danrigsby
- License: mit
- Created: 2017-05-19T02:29:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-06T16:51:51.000Z (over 6 years ago)
- Last Synced: 2025-03-25T15:50:38.518Z (about 2 months ago)
- Topics: eslint, eslint-jsx-plugin, jsx, react
- Language: JavaScript
- Homepage:
- Size: 46.9 KB
- Stars: 7
- Watchers: 2
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-idiomatic-jsx
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](https://github.com/yannickcr/eslint-plugin-react) and [eslint-plugin-jsx-a11y](https://github.com/evcohen/eslint-plugin-jsx-a11y) to give you more control over how JSX is used.
**Some Possible Use Cases**
- Require `id` tags on components like `a` and `input` for easier automated tests
- Prevent `onClick` being used on `div` or `span` components
- Prevent use of `button` components in favor of a custom `Button` components## Installation
You'll first need to install ESLint:``` sh
# npm
npm install eslint --save-dev# yarn
yarn add eslint --dev
```
Next, install eslint-plugin-idiomatic-jsx:``` sh
# npm
npm install eslint-plugin-idiomatic-jsx --save-dev# yarn
yarn add eslint-plugin-idiomatic-jsx --dev
```Note: 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_```javascript
{
"plugins": [
"idiomatic-jsx"
]
}
```Configure the rules you want to use under the rules section.
```javascript
{
"rules": {
"idiomatic-jsx/rule-name": [ 2, {
// options
} ]
}
}
```## List of Supported Rules
- [prevent-attributes](docs/rules/prevent-attributes.md): Prevent specified `attributes` on specified `components` from being used.
- [prevent-components](docs/rules/prevent-components.md): Prevent specified `components` from being used.
- [require-attributes](docs/rules/require-attributes.md): Require specified `attributes` on specified `components` to be defined.## License
`eslint-plugin-idiomatic-jsx` is licensed under the [MIT License](LICENSE).