eslint-plugin-react-ts
ESLint plugin for React and Preact function components with TypeScript, built from scratch (almost).
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
Installation
npm install --save-dev eslint-plugin-react-ts
pnpm add --save-dev eslint-plugin-react-ts
yarn add --dev eslint-plugin-react-ts
bun add --dev eslint-plugin-react-ts
Usage
{
"extends": [
"plugin:react-ts/recommended"
],
"rules": {
"react-ts/<rule-name>": "error"
}
}
import reactTsRecommended from "eslint-plugin-react-ts/configs/recommended";
export default [
reactTsRecommended,
{
rules: {
"react-ts/<rule-name>": "error",
},
},
];
Rules
💼 Configurations enabled in.
⚠️ Configurations set to warn in.
👍 Set in the recommended
configuration.
🔍 Set in the recommended-type-checked
configuration.
debug
jsx
naming-convention
react
Rules status
Work in progress
Planned (will be added in the future)
Philosophy
- Focus on code rather than style.
- Linting errors are better than runtime crashes.
- Types are the fundamental unit of correctness.
Rule introduction or modification principles
- TypeScript first. If a behavior can already be enforced by TypeScript built-in checker, don't reimplement it.
- Formatting independent. Rules should check for correctness, not style. We recommend using style focused tools for formatting (e.g. dprint or eslint-stylistic).
- Sensible defaults. Rules should be easy to setup and use with minimal configuration and sensible defaults.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Inspiration