codebyplan 1.13.3 → 1.13.5
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/README.md +34 -0
- package/dist/cli.js +96 -18
- package/package.json +1 -1
- package/templates/hooks/README.md +31 -19
- package/templates/hooks/cbp-cmux-branch-watch.sh +39 -0
- package/templates/hooks/cbp-cmux-workspace-sync.sh +19 -0
- package/templates/hooks/cbp-test-hooks.sh +74 -11
- package/templates/hooks/hooks.json +14 -5
- package/templates/settings.project.base.json +2 -0
- 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,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.
|
|
@@ -1,64 +1,60 @@
|
|
|
1
|
-
# tailwind — Tailwind CSS class linting
|
|
1
|
+
# tailwind — Tailwind CSS class linting (eslint-plugin-better-tailwindcss)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
> **Tailwind ships no first-party ESLint plugin.** Tailwind's official Editor Setup docs recommend only
|
|
4
|
+
> the IntelliSense extension + the official Prettier class-sorting plugin — no ESLint config. The
|
|
5
|
+
> community-standard plugin is `eslint-plugin-better-tailwindcss` (by schoero); its official setup is
|
|
6
|
+
> below (verified 2026-05-31).
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
> with first-class **Tailwind v4** + ESLint 9/10 flat-config support. The original
|
|
8
|
-
> `eslint-plugin-tailwindcss` only handles v4 on an unstable alpha — **avoid it for v4.**
|
|
9
|
-
|
|
10
|
-
## Packages
|
|
11
|
-
|
|
12
|
-
| Package | Latest | Tailwind v4? | Verdict |
|
|
13
|
-
| ------- | ------ | ------------ | ------- |
|
|
14
|
-
| `eslint-plugin-better-tailwindcss` | `4.5.0` | **yes (stable)** | **use this** |
|
|
15
|
-
| `eslint-plugin-tailwindcss` | `3.18.3` (v4 only on `4.0.0-alpha`) | beta/as-is | avoid for v4 |
|
|
8
|
+
## Install
|
|
16
9
|
|
|
17
10
|
```bash
|
|
18
|
-
|
|
11
|
+
npm i -D eslint-plugin-better-tailwindcss
|
|
19
12
|
```
|
|
20
13
|
|
|
21
|
-
|
|
14
|
+
> Depending on your file flavor (JSX/TSX/Vue/Svelte/Astro/HTML/CSS) you may also need the matching
|
|
15
|
+
> parser — see the plugin's per-parser docs.
|
|
22
16
|
|
|
23
|
-
##
|
|
17
|
+
## eslint.config.js — React/JSX (official example)
|
|
24
18
|
|
|
25
19
|
```js
|
|
26
|
-
|
|
20
|
+
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
27
21
|
import { defineConfig } from "eslint/config";
|
|
28
|
-
import betterTailwind from "eslint-plugin-better-tailwindcss";
|
|
29
22
|
|
|
30
|
-
export default defineConfig(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
// enable all recommended rules
|
|
25
|
+
extends: [eslintPluginBetterTailwindcss.configs.recommended],
|
|
26
|
+
|
|
27
|
+
settings: {
|
|
28
|
+
"better-tailwindcss": {
|
|
29
|
+
// tailwindcss 4: path to the CSS entry file (e.g. `src/global.css`)
|
|
30
|
+
entryPoint: "src/global.css",
|
|
31
|
+
// tailwindcss 3: path to the tailwind config (e.g. `tailwind.config.js`)
|
|
32
|
+
// tailwindConfig: "tailwind.config.js",
|
|
40
33
|
},
|
|
41
34
|
},
|
|
42
|
-
]);
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Gotchas
|
|
46
35
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- Config presets: `recommended`, `correctness` (errors), `stylistic` (warnings); severity
|
|
53
|
-
suffixes `-error` / `-warn`.
|
|
54
|
-
- Non-JSX file types (Svelte/Vue/Astro/HTML) need the matching `languageOptions.parser`.
|
|
55
|
-
|
|
56
|
-
## CBP preset divergence
|
|
57
|
-
|
|
58
|
-
There is **no** CBP `tailwind` DB preset — Tailwind linting is entirely manual. `tarkur`
|
|
59
|
-
currently has no Tailwind ESLint rules; add the block above to lint class order/validity.
|
|
60
|
-
|
|
61
|
-
## Official docs
|
|
36
|
+
languageOptions: {
|
|
37
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
```
|
|
62
41
|
|
|
63
|
-
|
|
64
|
-
|
|
42
|
+
## Notes (from the official docs)
|
|
43
|
+
|
|
44
|
+
- The plugin is wired in via **`extends: [...configs.recommended]`** — the official docs do **not** use
|
|
45
|
+
a literal `plugins: {}` key.
|
|
46
|
+
- **Three configs**: `recommended` (both), `correctness`, `stylistic`. By default stylistic rules are
|
|
47
|
+
warnings, correctness rules are errors. Append `-error` / `-warn` to change severity (e.g.
|
|
48
|
+
`recommended-warn`).
|
|
49
|
+
- **`settings` is version-specific**:
|
|
50
|
+
- **Tailwind v4** → `entryPoint`: path to the CSS file containing `@import "tailwindcss"` (v4 has no
|
|
51
|
+
JS config file).
|
|
52
|
+
- **Tailwind v3** → `tailwindConfig`: path to `tailwind.config.js`. The docs state: *"For Tailwind
|
|
53
|
+
CSS v4 and the css based config, use the `entryPoint` option instead."*
|
|
54
|
+
- Both paths are relative to the working directory; both are optional with automatic fallback.
|
|
55
|
+
- Legacy `.eslintrc` config names are prefixed `legacy-` (e.g. `legacy-recommended`).
|
|
56
|
+
- Runs under your normal `npx eslint .` — no special command.
|
|
57
|
+
|
|
58
|
+
## Source
|
|
59
|
+
|
|
60
|
+
- https://github.com/schoero/eslint-plugin-better-tailwindcss (README + `docs/parsers/*`, `docs/settings/settings.md`)
|
|
@@ -1,57 +1,48 @@
|
|
|
1
|
-
# testing-react — Testing Library + jest-dom
|
|
1
|
+
# testing-react — Testing Library + jest-dom (official setup)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
(`tech_match.requires: ["React", "Vitest"]`, `requires_capabilities: ["jsx"]`).
|
|
3
|
+
> **Official sources** (verified 2026-05-31):
|
|
4
|
+
> - eslint-plugin-testing-library — https://github.com/testing-library/eslint-plugin-testing-library
|
|
5
|
+
> - eslint-plugin-jest-dom — https://github.com/testing-library/eslint-plugin-jest-dom
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
> spreads its own plugin registration — keep them as **separate array entries**.
|
|
7
|
+
For React component tests. Each plugin ships its own framework-scoped flat config.
|
|
10
8
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
| Package | Latest | Purpose |
|
|
14
|
-
| ------- | ------ | ------- |
|
|
15
|
-
| `eslint-plugin-testing-library` | `7.16.2` | Testing Library best-practices |
|
|
16
|
-
| `eslint-plugin-jest-dom` | `5.5.0` | `@testing-library/jest-dom` matchers |
|
|
9
|
+
## Install
|
|
17
10
|
|
|
18
11
|
```bash
|
|
19
|
-
|
|
12
|
+
npm install --save-dev eslint-plugin-testing-library eslint-plugin-jest-dom
|
|
20
13
|
```
|
|
21
14
|
|
|
22
|
-
##
|
|
15
|
+
## eslint.config.mjs (official examples)
|
|
23
16
|
|
|
24
17
|
```js
|
|
25
|
-
// eslint.config.mjs
|
|
26
18
|
import testingLibrary from "eslint-plugin-testing-library";
|
|
27
19
|
import jestDom from "eslint-plugin-jest-dom";
|
|
28
20
|
|
|
29
|
-
const TEST_GLOBS = [
|
|
21
|
+
const TEST_GLOBS = [/* glob matching your test files */];
|
|
30
22
|
|
|
31
23
|
export default [
|
|
32
|
-
{
|
|
33
|
-
|
|
24
|
+
{
|
|
25
|
+
files: TEST_GLOBS,
|
|
26
|
+
...testingLibrary.configs["flat/react"], // 'flat/dom' for framework-agnostic
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
files: TEST_GLOBS,
|
|
30
|
+
...jestDom.configs["flat/recommended"],
|
|
31
|
+
},
|
|
34
32
|
];
|
|
35
33
|
```
|
|
36
34
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
- Keep the two as **separate array entries** — each `...config` spread re-declares its own
|
|
40
|
-
`plugins`. Merging them into one object means you must hand-combine `plugins` + `rules`.
|
|
41
|
-
- `eslint-plugin-testing-library` framework presets: `flat/react`, `flat/dom` (agnostic),
|
|
42
|
-
`flat/vue`, `flat/angular`, `flat/svelte`, `flat/marko` — pick **one**.
|
|
43
|
-
- Scope to the **same test globs** as your runner override so the rules don't bleed onto
|
|
44
|
-
production code.
|
|
45
|
-
- Don't let Playwright e2e specs hit `testing-library/*` rules (e.g.
|
|
46
|
-
`prefer-screen-queries` mis-fires on Playwright's `page.getByRole`) — scope to `src/**`
|
|
47
|
-
unit tests, not the e2e dir (see [e2e.md](e2e.md)).
|
|
48
|
-
|
|
49
|
-
## CBP preset divergence
|
|
35
|
+
## Notes (from the official docs)
|
|
50
36
|
|
|
51
|
-
|
|
52
|
-
`
|
|
37
|
+
- **Testing Library has NO aggregate `flat/recommended`** — the flat configs are **framework-specific
|
|
38
|
+
only**: `flat/dom`, `flat/react`, `flat/angular`, `flat/vue`, `flat/svelte`, `flat/marko`. Pick one.
|
|
39
|
+
- **jest-dom** uses `configs["flat/recommended"]`.
|
|
40
|
+
- Both plugins require **you** to supply the test-file glob in `files` — they don't preset it.
|
|
41
|
+
- Both READMEs state their *primary* documentation still uses `.eslintrc`; the flat configs are the
|
|
42
|
+
`flat/`-prefixed alternatives.
|
|
43
|
+
- Keep these as **separate array entries** — each `...config` spread re-declares its own `plugins`.
|
|
53
44
|
|
|
54
|
-
##
|
|
45
|
+
## Source
|
|
55
46
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
47
|
+
- https://github.com/testing-library/eslint-plugin-testing-library
|
|
48
|
+
- https://github.com/testing-library/eslint-plugin-jest-dom
|