codebyplan 1.13.3 → 1.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/templates/hooks/README.md +3 -19
- package/templates/hooks/cbp-test-hooks.sh +1 -9
- package/templates/hooks/hooks.json +0 -11
- package/templates/skills/cbp-setup-eslint/SKILL.md +4 -3
- package/templates/skills/cbp-setup-eslint/reference/base.md +44 -55
- package/templates/skills/cbp-setup-eslint/reference/cli.md +43 -36
- package/templates/skills/cbp-setup-eslint/reference/e2e.md +57 -47
- package/templates/skills/cbp-setup-eslint/reference/jest.md +22 -38
- package/templates/skills/cbp-setup-eslint/reference/nestjs.md +39 -40
- package/templates/skills/cbp-setup-eslint/reference/nextjs.md +39 -40
- package/templates/skills/cbp-setup-eslint/reference/node.md +25 -54
- package/templates/skills/cbp-setup-eslint/reference/react-native.md +33 -37
- package/templates/skills/cbp-setup-eslint/reference/react.md +33 -58
- package/templates/skills/cbp-setup-eslint/reference/tailwind.md +45 -49
- package/templates/skills/cbp-setup-eslint/reference/testing-react.md +28 -37
- package/templates/skills/cbp-setup-eslint/reference/vitest.md +25 -45
- package/templates/hooks/cbp-notify.sh +0 -68
|
@@ -1,69 +1,68 @@
|
|
|
1
|
-
# nestjs — NestJS
|
|
1
|
+
# nestjs — NestJS (official starter ESLint config)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
official Nest starter has a specific shape worth matching.
|
|
3
|
+
> **Official source**: https://github.com/nestjs/typescript-starter/blob/master/eslint.config.mjs
|
|
4
|
+
> (verified 2026-05-31). This is the `eslint.config.mjs` the official Nest starter ships, **verbatim**.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
NestJS has no first-party ESLint plugin — the official starter uses type-checked typescript-eslint +
|
|
7
|
+
Prettier.
|
|
9
8
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
| Package | Latest | Purpose |
|
|
13
|
-
| ------- | ------ | ------- |
|
|
14
|
-
| `typescript-eslint` | `8.60.0` | parser + type-checked preset |
|
|
15
|
-
| `@eslint/js` | `10.0.1` | `eslint.configs.recommended` |
|
|
16
|
-
| `eslint-plugin-prettier` | `^5` | `/recommended` subpath |
|
|
17
|
-
| `globals` | `17.6.0` | `globals.node`, `globals.jest` |
|
|
9
|
+
## Install
|
|
18
10
|
|
|
19
11
|
```bash
|
|
20
|
-
|
|
12
|
+
npm install --save-dev eslint @eslint/js typescript-eslint eslint-plugin-prettier eslint-config-prettier globals
|
|
21
13
|
```
|
|
22
14
|
|
|
23
|
-
##
|
|
15
|
+
## eslint.config.mjs (official `nest new` starter, verbatim)
|
|
24
16
|
|
|
25
17
|
```js
|
|
26
18
|
// @ts-check
|
|
27
|
-
import eslint from
|
|
28
|
-
import eslintPluginPrettierRecommended from
|
|
29
|
-
import globals from
|
|
30
|
-
import tseslint from
|
|
19
|
+
import eslint from '@eslint/js';
|
|
20
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
21
|
+
import globals from 'globals';
|
|
22
|
+
import tseslint from 'typescript-eslint';
|
|
31
23
|
|
|
32
24
|
export default tseslint.config(
|
|
33
|
-
{
|
|
25
|
+
{
|
|
26
|
+
ignores: ['eslint.config.mjs'],
|
|
27
|
+
},
|
|
34
28
|
eslint.configs.recommended,
|
|
35
29
|
...tseslint.configs.recommendedTypeChecked,
|
|
36
30
|
eslintPluginPrettierRecommended,
|
|
37
31
|
{
|
|
38
32
|
languageOptions: {
|
|
39
|
-
globals: {
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
globals: {
|
|
34
|
+
...globals.node,
|
|
35
|
+
...globals.jest,
|
|
36
|
+
},
|
|
37
|
+
sourceType: 'commonjs',
|
|
38
|
+
parserOptions: {
|
|
39
|
+
projectService: true,
|
|
40
|
+
tsconfigRootDir: import.meta.dirname,
|
|
41
|
+
},
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
rules: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
47
|
+
'@typescript-eslint/no-floating-promises': 'warn',
|
|
48
|
+
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
49
|
+
'prettier/prettier': ['error', { endOfLine: 'auto' }],
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
52
|
);
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
##
|
|
55
|
+
## Notes (from the official starter file)
|
|
56
56
|
|
|
57
|
-
-
|
|
58
|
-
`
|
|
59
|
-
|
|
60
|
-
- `
|
|
61
|
-
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
|
|
65
|
-
- Nest tests use **Jest** — add the [jest.md](jest.md) override scoped to `**/*.spec.ts`.
|
|
57
|
+
- This is the one official config that wraps with **`tseslint.config(...)`** (not `defineConfig`). It
|
|
58
|
+
imports `@eslint/js` as `eslint` (so `eslint.configs.recommended`) and spreads
|
|
59
|
+
`...tseslint.configs.recommendedTypeChecked` (it's an array).
|
|
60
|
+
- `{ ignores: ['eslint.config.mjs'] }` keeps type-aware linting off the config file itself.
|
|
61
|
+
- `sourceType: 'commonjs'` matches Nest's default CJS build — switch to `'module'` for an ESM Nest app.
|
|
62
|
+
- The starter deliberately relaxes three type-checked rules (`no-explicit-any` off;
|
|
63
|
+
`no-floating-promises` and `no-unsafe-argument` to `warn`) for Nest's DI/decorator patterns, and adds
|
|
64
|
+
Prettier via `eslint-plugin-prettier/recommended`.
|
|
66
65
|
|
|
67
|
-
##
|
|
66
|
+
## Source
|
|
68
67
|
|
|
69
|
-
-
|
|
68
|
+
- https://github.com/nestjs/typescript-starter/blob/master/eslint.config.mjs
|
|
@@ -1,63 +1,62 @@
|
|
|
1
|
-
# nextjs — Next.js (
|
|
1
|
+
# nextjs — Next.js (official eslint-config-next setup)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
> **Official source**: https://nextjs.org/docs/app/api-reference/config/eslint — Next.js **16.2.6**,
|
|
4
|
+
> lastUpdated 2026-05-28. Native ESLint flat config. This is the official setup verbatim.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
> config**, `next lint` is **removed** (run `eslint .` directly), and the `eslint` key in
|
|
8
|
-
> `next.config.js` is gone. No `FlatCompat` shim is needed.
|
|
9
|
-
|
|
10
|
-
## Packages
|
|
11
|
-
|
|
12
|
-
| Package | Latest | Purpose |
|
|
13
|
-
| ------- | ------ | ------- |
|
|
14
|
-
| `eslint-config-next` | `16.2.6` | bundles `@next/eslint-plugin-next` + react/react-hooks/import |
|
|
6
|
+
## Install
|
|
15
7
|
|
|
16
8
|
```bash
|
|
17
|
-
pnpm add -D eslint-config-next
|
|
9
|
+
pnpm add -D eslint eslint-config-next
|
|
18
10
|
```
|
|
19
11
|
|
|
20
|
-
##
|
|
12
|
+
## eslint.config.mjs — TypeScript app
|
|
21
13
|
|
|
22
|
-
`
|
|
14
|
+
What `create-next-app --typescript` generates:
|
|
23
15
|
|
|
24
16
|
```js
|
|
25
|
-
// eslint.config.mjs
|
|
26
17
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
27
18
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
28
19
|
import nextTs from "eslint-config-next/typescript";
|
|
29
20
|
|
|
30
|
-
|
|
31
|
-
...nextVitals,
|
|
32
|
-
...nextTs,
|
|
21
|
+
const eslintConfig = defineConfig([
|
|
22
|
+
...nextVitals,
|
|
23
|
+
...nextTs,
|
|
24
|
+
// Override default ignores of eslint-config-next.
|
|
33
25
|
globalIgnores([".next/**", "out/**", "build/**", "next-env.d.ts"]),
|
|
34
26
|
]);
|
|
27
|
+
|
|
28
|
+
export default eslintConfig;
|
|
35
29
|
```
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
- `eslint-config-next` — base (Next + react + react-hooks recommended).
|
|
39
|
-
- `eslint-config-next/core-web-vitals` — base + CWV rules at error (**recommended default**).
|
|
40
|
-
- `eslint-config-next/typescript` — adds typescript-eslint rules; spread alongside a base.
|
|
31
|
+
JavaScript app: drop the `nextTs` import and the `...nextTs` spread.
|
|
41
32
|
|
|
42
|
-
##
|
|
33
|
+
## Run
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- `next lint` removal landed in Next 16.0.0 — old `.eslintrc.json` configs should migrate to
|
|
50
|
-
`eslint.config.mjs` (a codemod exists).
|
|
35
|
+
```bash
|
|
36
|
+
npx eslint .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## The three official configs
|
|
51
40
|
|
|
52
|
-
|
|
41
|
+
- **`eslint-config-next`** — base: Next.js + `eslint-plugin-react` + `eslint-plugin-react-hooks`
|
|
42
|
+
recommended rule-sets (JS + TS).
|
|
43
|
+
- **`eslint-config-next/core-web-vitals`** — base + promotes Core-Web-Vitals rules from warning to
|
|
44
|
+
error. Recommended default; auto-included by create-next-app.
|
|
45
|
+
- **`eslint-config-next/typescript`** — adds typescript-eslint rules (based on
|
|
46
|
+
`@typescript-eslint/recommended`); spread alongside one of the above.
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
## Notes (from the official docs)
|
|
49
|
+
|
|
50
|
+
- **`next lint` was removed in Next.js v16.0.0** (and the `eslint` option in `next.config.js`). Use
|
|
51
|
+
the ESLint CLI directly (`npx eslint .`). A codemod is available to migrate.
|
|
52
|
+
- **`globalIgnores([...])` is required** when you spread the config — it re-asserts
|
|
53
|
+
eslint-config-next's default ignores.
|
|
54
|
+
- **Monorepo**: tell the plugin where the app is via `settings: { next: { rootDir: "packages/my-app/" } }`
|
|
55
|
+
(path, glob, or array).
|
|
56
|
+
- **Prettier**: install `eslint-config-prettier`, then add
|
|
57
|
+
`import prettier from "eslint-config-prettier/flat"` and include `prettier` in the array.
|
|
58
|
+
- **Disable rules**: append a `{ rules: { ... } }` object after the spreads.
|
|
60
59
|
|
|
61
|
-
##
|
|
60
|
+
## Source
|
|
62
61
|
|
|
63
|
-
-
|
|
62
|
+
- https://nextjs.org/docs/app/api-reference/config/eslint
|
|
@@ -1,74 +1,45 @@
|
|
|
1
|
-
# node — Node
|
|
1
|
+
# node — Node.js (official eslint-plugin-n setup)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(`tech_match.requires: ["Node.js"]`, `requires_capabilities: ["node-server"]`).
|
|
3
|
+
> **Official source**: https://github.com/eslint-community/eslint-plugin-n (verified 2026-05-31).
|
|
4
|
+
> ESLint flat config. This is the plugin's official setup verbatim.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
> `recommendedTypeChecked`, not from a node plugin.
|
|
6
|
+
For Node.js services and packages. `eslint-plugin-n` is the maintained Node plugin (successor to the
|
|
7
|
+
deprecated `eslint-plugin-node`).
|
|
10
8
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
| Package | Latest | Purpose |
|
|
14
|
-
| ------- | ------ | ------- |
|
|
15
|
-
| `globals` | `17.6.0` | `globals.node` |
|
|
16
|
-
| `typescript-eslint` | `8.60.0` | type-aware promise rules |
|
|
17
|
-
| `eslint-plugin-n` | `18.0.1` | **optional** — unsupported-Node-API / import / engines checks |
|
|
9
|
+
## Install
|
|
18
10
|
|
|
19
11
|
```bash
|
|
20
|
-
|
|
21
|
-
# optional (libraries / dual ESM-CJS packages):
|
|
22
|
-
pnpm add -D eslint-plugin-n
|
|
12
|
+
npm install --save-dev eslint eslint-plugin-n
|
|
23
13
|
```
|
|
24
14
|
|
|
25
|
-
##
|
|
15
|
+
## eslint.config.mjs — ES Modules
|
|
26
16
|
|
|
27
17
|
```js
|
|
28
|
-
|
|
18
|
+
import node from "eslint-plugin-n";
|
|
29
19
|
import { defineConfig } from "eslint/config";
|
|
30
|
-
import js from "@eslint/js";
|
|
31
|
-
import tseslint from "typescript-eslint";
|
|
32
|
-
import globals from "globals";
|
|
33
|
-
// optional: import n from "eslint-plugin-n";
|
|
34
20
|
|
|
35
21
|
export default defineConfig([
|
|
36
|
-
js.configs.recommended,
|
|
37
|
-
...tseslint.configs.recommendedTypeChecked, // enables the promise rules below
|
|
38
22
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
globals: globals.node,
|
|
42
|
-
sourceType: "module", // "commonjs" for a CJS service
|
|
43
|
-
parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
|
|
44
|
-
},
|
|
45
|
-
rules: {
|
|
46
|
-
"@typescript-eslint/no-floating-promises": "error",
|
|
47
|
-
"@typescript-eslint/no-misused-promises": "error",
|
|
48
|
-
},
|
|
23
|
+
plugins: { n: node },
|
|
24
|
+
extends: ["n/recommended-module"],
|
|
49
25
|
},
|
|
50
|
-
// optional eslint-plugin-n:
|
|
51
|
-
// { files: ["**/*.{ts,mts,cts}"], plugins: { n }, extends: ["n/recommended-module"] },
|
|
52
26
|
]);
|
|
53
27
|
```
|
|
54
28
|
|
|
55
|
-
##
|
|
56
|
-
|
|
57
|
-
- **`eslint-plugin-n` is optional.** For a pure internal TS service you can skip it — its main
|
|
58
|
-
value is catching unsupported Node APIs, missing imports, and `package.json#engines` issues
|
|
59
|
-
in **libraries** and dual ESM/CJS packages. Pick the right preset: `n/recommended-module`
|
|
60
|
-
(ESM), `n/recommended-script` (CJS), `n/recommended` (mixed).
|
|
61
|
-
- The promise rules **require** a type-checked config + `projectService` — they silently do
|
|
62
|
-
nothing without type info.
|
|
63
|
-
- A CJS service uses `sourceType: "commonjs"`; an ESM service uses `"module"`.
|
|
64
|
-
|
|
65
|
-
## CBP preset divergence
|
|
29
|
+
## Notes (from the official docs)
|
|
66
30
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
31
|
+
- Preset variants (swap the `extends` value):
|
|
32
|
+
- **`n/recommended-module`** — considers all files as ES Modules.
|
|
33
|
+
- **`n/recommended-script`** — considers all files as CommonJS.
|
|
34
|
+
- **`n/recommended`** — handles both; uses `package.json` `"type"` plus `.mjs`/`.cjs` extensions to
|
|
35
|
+
decide how to treat each file.
|
|
36
|
+
- **`n/mixed-esm-and-cjs`** — for a package that mixes both.
|
|
37
|
+
- The README uses the `plugins: { n: node }` + `extends: [...]` form, which requires `defineConfig`
|
|
38
|
+
from `eslint/config`.
|
|
39
|
+
- For a TypeScript Node project, layer this on top of the official typescript-eslint setup
|
|
40
|
+
([base.md](base.md)) — the type-aware promise rules (`no-floating-promises`, `no-misused-promises`)
|
|
41
|
+
come from typescript-eslint's `recommendedTypeChecked`, not from eslint-plugin-n.
|
|
70
42
|
|
|
71
|
-
##
|
|
43
|
+
## Source
|
|
72
44
|
|
|
73
|
-
-
|
|
74
|
-
- no-floating-promises: https://typescript-eslint.io/rules/no-floating-promises/
|
|
45
|
+
- https://github.com/eslint-community/eslint-plugin-n
|
|
@@ -1,60 +1,56 @@
|
|
|
1
|
-
# react-native — React Native
|
|
1
|
+
# react-native — Expo / React Native (official eslint-config-expo setup)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
> **Official source**: https://docs.expo.dev/guides/using-eslint/ (verified 2026-05-31). This is
|
|
4
|
+
> Expo's official ESLint setup verbatim. Flat config is the default from **Expo SDK 53** onward (SDK 52
|
|
5
|
+
> and earlier use legacy `.eslintrc`).
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
> by default from Expo SDK 53** onward (SDK 52 and earlier use legacy `.eslintrc`).
|
|
8
|
-
|
|
9
|
-
## Packages
|
|
10
|
-
|
|
11
|
-
| Package | Latest | Purpose |
|
|
12
|
-
| ------- | ------ | ------- |
|
|
13
|
-
| `eslint-config-expo` | `56.0.4` | Expo's flat config (`/flat` subpath) |
|
|
7
|
+
## Setup
|
|
14
8
|
|
|
15
9
|
```bash
|
|
16
|
-
npx expo lint
|
|
10
|
+
npx expo lint
|
|
17
11
|
```
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
bundle `eslint-plugin-react-native` (that's a separate optional add-on, `@5.0.0`).
|
|
13
|
+
This generates an **`eslint.config.js`** that extends `eslint-config-expo` and installs the deps on
|
|
14
|
+
first run. Optional Prettier integration:
|
|
22
15
|
|
|
23
|
-
|
|
16
|
+
```bash
|
|
17
|
+
npx expo install prettier eslint-config-prettier eslint-plugin-prettier --dev
|
|
18
|
+
```
|
|
24
19
|
|
|
25
|
-
|
|
20
|
+
## eslint.config.js (official example, with Prettier)
|
|
26
21
|
|
|
27
22
|
```js
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
|
|
23
|
+
const { defineConfig } = require('eslint/config');
|
|
24
|
+
const expoConfig = require('eslint-config-expo/flat');
|
|
25
|
+
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
|
|
32
26
|
|
|
33
27
|
module.exports = defineConfig([
|
|
34
28
|
expoConfig,
|
|
35
29
|
eslintPluginPrettierRecommended,
|
|
36
|
-
{
|
|
30
|
+
{
|
|
31
|
+
ignores: ['dist/*'],
|
|
32
|
+
},
|
|
37
33
|
]);
|
|
38
34
|
```
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
The bare generated config simply extends `eslint-config-expo/flat`; the block above is the documented
|
|
37
|
+
full example including Prettier. Note Expo's template is **CommonJS `eslint.config.js`**.
|
|
41
38
|
|
|
42
|
-
##
|
|
39
|
+
## Run
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
want RN-specific rules (`no-inline-styles`, `no-unused-styles`).
|
|
48
|
-
- Run linting with `npx expo lint` (it wires the config the first time).
|
|
49
|
-
- Expo apps test with **Jest** — add the [jest.md](jest.md) override.
|
|
41
|
+
```bash
|
|
42
|
+
npx expo lint
|
|
43
|
+
```
|
|
50
44
|
|
|
51
|
-
##
|
|
45
|
+
## Notes (from the official docs)
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
- **Flat config availability**: *"From SDK 53 onwards, the default ESLint config file uses the Flat
|
|
48
|
+
config format. For SDK 52 and earlier, the default ESLint config file uses legacy config and does not
|
|
49
|
+
support Flat config."*
|
|
50
|
+
- **Prettier**: after setup, *"when you run `npx expo lint`, anything that is not aligned with Prettier
|
|
51
|
+
formatting will be caught as an error."*
|
|
52
|
+
- **Performance**: for large projects, add a `.eslintignore` with `/.expo` and `node_modules`.
|
|
56
53
|
|
|
57
|
-
##
|
|
54
|
+
## Source
|
|
58
55
|
|
|
59
|
-
-
|
|
60
|
-
- eslint-config-expo: https://github.com/expo/expo/tree/main/packages/eslint-config-expo
|
|
56
|
+
- https://docs.expo.dev/guides/using-eslint/
|
|
@@ -1,82 +1,57 @@
|
|
|
1
|
-
# react — standalone React (
|
|
1
|
+
# react — standalone React (official eslint-plugin-react + react-hooks + jsx-a11y)
|
|
2
2
|
|
|
3
|
-
For React
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
For React projects that are **not** Next.js (Vite, etc.). Each plugin ships its own official flat
|
|
4
|
+
config; compose them. Setup below uses the official config keys from each plugin's docs (verified
|
|
5
|
+
2026-05-31).
|
|
6
6
|
|
|
7
|
-
> **
|
|
8
|
-
>
|
|
9
|
-
>
|
|
7
|
+
> **Official sources**:
|
|
8
|
+
> - eslint-plugin-react — https://github.com/jsx-eslint/eslint-plugin-react
|
|
9
|
+
> - react-hooks — https://react.dev/reference/eslint-plugin-react-hooks
|
|
10
|
+
> - jsx-a11y — https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
|
|
10
11
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
| Package | Latest | Purpose |
|
|
14
|
-
| ------- | ------ | ------- |
|
|
15
|
-
| `eslint-plugin-react` | `7.37.5` | React rules + JSX parsing (`configs.flat.*`) |
|
|
16
|
-
| `eslint-plugin-react-hooks` | `7.1.1` | hooks rules **+ bundled React Compiler rules** |
|
|
17
|
-
| `eslint-plugin-jsx-a11y` | `6.10.2` | accessibility (`flatConfigs.*` — note plural) |
|
|
12
|
+
## Install
|
|
18
13
|
|
|
19
14
|
```bash
|
|
20
|
-
|
|
15
|
+
npm install --save-dev eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y globals
|
|
21
16
|
```
|
|
22
17
|
|
|
23
|
-
##
|
|
18
|
+
## eslint.config.mjs
|
|
24
19
|
|
|
25
20
|
```js
|
|
26
|
-
// eslint.config.mjs
|
|
27
|
-
import { defineConfig } from "eslint/config";
|
|
28
21
|
import react from "eslint-plugin-react";
|
|
29
22
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
30
23
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
31
24
|
import globals from "globals";
|
|
25
|
+
import { defineConfig } from "eslint/config";
|
|
32
26
|
|
|
33
27
|
export default defineConfig([
|
|
34
|
-
react.configs.flat.recommended,
|
|
35
|
-
react.configs.flat["jsx-runtime"],
|
|
36
|
-
reactHooks.configs.flat
|
|
37
|
-
jsxA11y.flatConfigs.
|
|
28
|
+
react.configs.flat.recommended, // eslint-plugin-react recommended
|
|
29
|
+
react.configs.flat["jsx-runtime"], // React 17+ automatic JSX transform
|
|
30
|
+
reactHooks.configs.flat.recommended, // rules-of-hooks + exhaustive-deps
|
|
31
|
+
jsxA11y.flatConfigs.recommended, // accessibility (or .strict)
|
|
38
32
|
{
|
|
39
|
-
files
|
|
40
|
-
|
|
33
|
+
// eslint-plugin-react and jsx-a11y do NOT preset files/globals — set them yourself.
|
|
34
|
+
files: ["**/*.{js,mjs,cjs,jsx,ts,tsx}"],
|
|
35
|
+
languageOptions: { globals: { ...globals.browser } },
|
|
41
36
|
settings: { react: { version: "detect" } },
|
|
42
37
|
},
|
|
43
38
|
]);
|
|
44
39
|
```
|
|
45
40
|
|
|
46
|
-
##
|
|
47
|
-
|
|
48
|
-
- **`eslint-plugin-react` flat configs do not set `files` or globals** — add your own
|
|
49
|
-
`files`/`globals.browser`/`settings.react.version` object (shown above) or you'll get the
|
|
50
|
-
"React version not specified" warning and no JSX globals.
|
|
51
|
-
- **`eslint-plugin-react-hooks` v7 keys** live under `configs.flat.*`:
|
|
52
|
-
`recommended` (standard hooks) vs `recommended-latest` (hooks **+ compiler** rules — use
|
|
53
|
-
this for React 19 + the compiler).
|
|
54
|
-
- **`jsx-a11y` uses `flatConfigs` (plural)** — `jsxA11y.flatConfigs.strict`, a different
|
|
55
|
-
namespace from react's `configs.flat`.
|
|
56
|
-
|
|
57
|
-
## Storybook (bonus)
|
|
58
|
-
|
|
59
|
-
If the app uses Storybook, add `eslint-plugin-storybook@10.4.1`:
|
|
60
|
-
|
|
61
|
-
```js
|
|
62
|
-
import storybook from "eslint-plugin-storybook";
|
|
63
|
-
// ...spread into the array:
|
|
64
|
-
...storybook.configs["flat/recommended"],
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
The standalone plugin repo was archived (2025-11); it now lives in the Storybook monorepo but
|
|
68
|
-
the npm name `eslint-plugin-storybook` is unchanged.
|
|
69
|
-
|
|
70
|
-
## CBP preset divergence
|
|
41
|
+
## Notes (from the official docs)
|
|
71
42
|
|
|
72
|
-
|
|
73
|
-
`
|
|
74
|
-
`
|
|
75
|
-
|
|
43
|
+
- eslint-plugin-react and jsx-a11y: *"Our shareable configs do NOT configure `files` or
|
|
44
|
+
`languageOptions.globals`"* — you must add them yourself (shown above).
|
|
45
|
+
- For React 17+, add `react.configs.flat["jsx-runtime"]` to disable the old "React must be in scope"
|
|
46
|
+
rules.
|
|
47
|
+
- **react-hooks**: `configs.flat.recommended` is the standard. The plugin also exposes
|
|
48
|
+
`configs.flat["recommended-latest"]`, which the React team describes as *"bleeding edge experimental
|
|
49
|
+
compiler rules"* (the React Compiler rules are bundled into `eslint-plugin-react-hooks`). Opt in only
|
|
50
|
+
if you want them.
|
|
51
|
+
- **jsx-a11y** exposes `flatConfigs.recommended` and `flatConfigs.strict`.
|
|
52
|
+
- eslint-plugin-react's README writes its examples in CommonJS (`require`/`module.exports`); the config
|
|
53
|
+
keys above are identical in ESM.
|
|
76
54
|
|
|
77
|
-
##
|
|
55
|
+
## Source
|
|
78
56
|
|
|
79
|
-
|
|
80
|
-
- react-hooks: https://react.dev/reference/eslint-plugin-react-hooks
|
|
81
|
-
- React Compiler v1.0: https://react.dev/blog/2025/10/07/react-compiler-1
|
|
82
|
-
- jsx-a11y: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
|
|
57
|
+
See the three URLs above.
|