eslint-plugin-react-ts
ESLint plugin to lint React TypeScript apps using the @typescript-eslint ecosystem.
Warning
This plugin is still in early development, and will likely change significantly before reaching a stable version.
Supported Engines
Node.js
- 18.x LTS Hydrogen
- 20.x Current
Bun (planned)
Installation
npm install --save-dev eslint-plugin-react-ts
yarn add --dev eslint-plugin-react-ts
pnpm add --save-dev eslint-plugin-react-ts
Usage
Legacy Config (.eslintrc, .eslintrc.json, etc.)
{
"plugins": ["react-ts"],
"rules": {
"react-ts/prefer-shorthand-attribute": "error"
}
}
Flat Config (eslint.config.js) (requires eslint >= v8.23.0)
import reactTs from "eslint-plugin-react-ts";
export default [
{
plugins: {
reactTs,
},
rules: {
"react-ts/prefer-shorthand-attribute": "error",
},
},
];
Todo
Implemented Rules
Philosophy
The introduction or modification of rules must follow these guidelines:
- TypeScript first - If a behavior can already be enforced by TypeScript built-in checker, it should not be implemented in the plugin.
- Formatting independent - Rules should not be concerned with code style or formatting; leave that to the formatter.
- One rule, one purpose - Each rule should have a single, well-defined purpose that can be described in one sentence, ideally serving as its name, and it's options should be as minimal as possible, preferably none.
License
This project is licensed under the MIT License - see the LICENSE file for details.
THIRD-PARTY-LICENSE
This project uses code from following third-party projects:
- eslint-plugin-perfectionist (MIT)
- eslint-plugin-react (MIT)
- eslint-plugin-solid (MIT)
- @tanstack/eslint-plugin-query (MIT)
- eslint-plugin-filenames-simple (MIT)
Licenses are list in THIRD-PARTY-LICENSE