Skip to content

Commit ad8da68

Browse files
committed
ci: add update:readme npm script, closes #509
1 parent 7f380b6 commit ad8da68

File tree

4 files changed

+138
-4
lines changed

4 files changed

+138
-4
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"prepare": "husky install && pnpm run build",
5353
"test": "vitest --run --logHeapUsage",
5454
"update:deps": "taze",
55+
"update:readme": "bun run --bun ./scripts/update-readme.ts",
5556
"update:version": "bun run --bun ./scripts/update-version.ts && pnpm run format:package-json"
5657
},
5758
"devDependencies": {
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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+
[![Version](https://img.shields.io/npm/v/@eslint-react/eslint-plugin?style=flat&colorA=000000&colorB=000000)](https://npmjs.com/package/@eslint-react/eslint-plugin)
6+
[![Size](https://img.shields.io/bundlephobia/minzip/@eslint-react/eslint-plugin?label=gzip&style=flat&colorA=000000&colorB=000000)](https://bundlephobia.com/package/@eslint-react/eslint-plugin)
7+
[![Downloads](https://img.shields.io/npm/dt/@eslint-react/eslint-plugin.svg?style=flat&colorA=000000&colorB=000000)](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)

scripts/lib/fs.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { BunFile } from "bun";
2-
import { isString } from "effect/Predicate";
2+
import { Function as F, Predicate as Pred } from "effect";
33

4-
export function copyFile(src: BunFile | string, dest: string) {
5-
return Bun.write(dest, isString(src) ? Bun.file(src) : src);
6-
}
4+
export const copyFile: {
5+
(src: string | BunFile): (dest: string) => Promise<void>;
6+
(src: string | BunFile, dest: string): BunFile;
7+
} = F.dual(2, (src: BunFile | string, dest: string) => Bun.write(dest, Pred.isString(src) ? Bun.file(src) : src));

scripts/update-readme.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { copyFile } from "./lib/fs";
2+
3+
const source = "README.md";
4+
const dest = ["packages/plugins/eslint-plugin/README.md"];
5+
await Promise.all(dest.map((d) => copyFile(source, d)));

0 commit comments

Comments
 (0)