|
| 1 | +<p align="center"><img src="./assets/logo.svg" alt="logo" width="150" /></p> |
| 2 | + |
| 3 | +<h1 align="center" alt="title">ESLint React</h1> |
| 4 | + |
| 5 | +[](https://npmjs.com/package/@eslint-react/eslint-plugin) |
| 6 | +[](https://bundlephobia.com/package/@eslint-react/eslint-plugin) |
| 7 | +[](https://npmjs.com/package/@eslint-react/eslint-plugin) |
| 8 | + |
| 9 | +A series of composable ESLint rules for libraries and frameworks that use React as a UI runtime. |
| 10 | + |
| 11 | +## Roadmap |
| 12 | + |
| 13 | +- [Milestone 1.5 ↗](https://eslint-react.xyz/roadmap#milestone-15) |
| 14 | +- [Milestone 2.0 ↗](https://eslint-react.xyz/roadmap#milestone-20) |
| 15 | +- [Milestone 2.5 ↗](https://eslint-react.xyz/roadmap#milestone-25-draft) |
| 16 | + |
| 17 | +## Features |
| 18 | + |
| 19 | +- **Universal** rules for libraries and frameworks that use React as a UI runtime. |
| 20 | +- **Well designed** rule behaviors and sensible defaults. |
| 21 | +- **Maximum flexibility** through minimum configuration options. |
| 22 | + |
| 23 | +## Public packages |
| 24 | + |
| 25 | +### All-in-one packages |
| 26 | + |
| 27 | +- [`@eslint-react/eslint-plugin`](https://www.npmjs.com/package/@eslint-react/eslint-plugin) - The main ESLint plugin package including all rules and config presets in this repository. |
| 28 | + |
| 29 | +### Individual packages (will be available in 2.0) |
| 30 | + |
| 31 | +- `eslint-plugin-react-core` - Core rules (DOM Irrelevant, Render Target Agnostic, Formatting Independent). |
| 32 | +- `eslint-plugin-react-dom` - DOM specific rules for React DOM. |
| 33 | +- `eslint-plugin-react-hooks-extra` - Extra React Hooks rules. |
| 34 | +- `eslint-plugin-react-naming-convention` - Naming convention rules. |
| 35 | + |
| 36 | +## Supported ESLint versions |
| 37 | + |
| 38 | +- 8.57.0 or later |
| 39 | + |
| 40 | +## Supported React versions |
| 41 | + |
| 42 | +- 18.2.0 or later |
| 43 | + |
| 44 | +## Supported engines |
| 45 | + |
| 46 | +### Node.js |
| 47 | + |
| 48 | +- 18.18.0 or later |
| 49 | + |
| 50 | +### Bun |
| 51 | + |
| 52 | +- 1.0.15 or later |
| 53 | + |
| 54 | +### Install |
| 55 | + |
| 56 | +```sh |
| 57 | +# npm |
| 58 | +npm install --save-dev @eslint-react/eslint-plugin |
| 59 | +``` |
| 60 | + |
| 61 | +### Setup |
| 62 | + |
| 63 | +Add the plugin to your `eslint.config.js`: |
| 64 | + |
| 65 | +```js |
| 66 | +// @ts-check |
| 67 | + |
| 68 | +import js from "@eslint/js"; |
| 69 | +import react from "@eslint-react/eslint-plugin"; |
| 70 | + |
| 71 | +export default [ |
| 72 | + js.configs.recommended, |
| 73 | + { |
| 74 | + files: ["**/*.{ts,tsx}"], |
| 75 | + ...react.configs.recommended, |
| 76 | + }, |
| 77 | +]; |
| 78 | +``` |
| 79 | + |
| 80 | +[Full Installation Guide ↗](https://eslint-react.xyz/docs/installation) |
| 81 | + |
| 82 | +## Presets |
| 83 | + |
| 84 | +- **recommended**\ |
| 85 | + Enable rules that are recommended by ESLint React. |
| 86 | +- **recommended-type-checked**\ |
| 87 | + Enable rules that are recommended by ESLint React with additional rules that require type information. |
| 88 | +- **dom**\ |
| 89 | + Enable rules that are specific to React DOM. |
| 90 | +- **off-dom**\ |
| 91 | + Disable rules that are specific to React DOM. |
| 92 | +- **all**\ |
| 93 | + Enable all rules in this plugin except for debug rules. |
| 94 | +- **off**\ |
| 95 | + Disable all rules in this plugin except for debug rules. |
| 96 | + |
| 97 | +[Full Presets List↗](https://eslint-react.xyz/presets/overview) |
| 98 | + |
| 99 | +## Rules |
| 100 | + |
| 101 | +[Rules Overview ↗](https://eslint-react.xyz/rules/overview) |
| 102 | + |
| 103 | +## Contributing |
| 104 | + |
| 105 | +Before you start working on something, it's best to check if there is an existing issue first. It's also a good idea to reach the maintainer and confirm if it makes sense or if someone else is already working on it. |
| 106 | + |
| 107 | +Please make sure to read the [Contributing Guide](./.github/CONTRIBUTING.md) before making a pull request. |
| 108 | + |
| 109 | +Thank you to everyone contributing to ESLint React! |
| 110 | + |
| 111 | +## License |
| 112 | + |
| 113 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 114 | + |
| 115 | +## Inspiration |
| 116 | + |
| 117 | +- [eslint-plugin-solid](https://github.com/solidjs-community/eslint-plugin-solid) |
| 118 | +- [eslint-plugin-functional](https://github.com/eslint-functional/eslint-plugin-functional) |
| 119 | +- [eslint-plugin-perfectionist](https://github.com/azat-io/eslint-plugin-perfectionist) |
| 120 | +- [eslint-plugin-filenames-simple](https://github.com/epaew/eslint-plugin-filenames-simple) |
| 121 | +- [rome/tools](https://github.com/rome/tools) |
| 122 | +- [rust-clippy](https://github.com/rust-lang/rust-clippy) |
| 123 | + |
| 124 | +## Prior art |
| 125 | + |
| 126 | +- [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) |
| 127 | +- [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks) |
0 commit comments