@devbie/style-guide 1.1.0 → 1.1.2
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 +14 -4
- package/eslint/frontend.js +11 -8
- package/eslint/next.js +8 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,10 +20,12 @@ Single source of truth for code style across the devbie ecosystem
|
|
|
20
20
|
| fewbie | `frontend` |
|
|
21
21
|
| fewbie-starter, nightwatch-frontend | `next` |
|
|
22
22
|
|
|
23
|
-
`next` is the `
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
`next` is the shared `core` baseline plus `eslint-config-next` (which already
|
|
24
|
+
bundles the React / react-hooks / jsx-a11y layers), so every repo shares the
|
|
25
|
+
same language-level rules while Next.js applications add only the canonical
|
|
26
|
+
framework layer. `eslint-config-next` requires the `next` package at load
|
|
27
|
+
time, which is why repos without a Next runtime (fewbie) use `frontend`
|
|
28
|
+
instead.
|
|
27
29
|
|
|
28
30
|
## Usage
|
|
29
31
|
|
|
@@ -68,6 +70,14 @@ default, only as a deliberate milestone.
|
|
|
68
70
|
|
|
69
71
|
## Changelog
|
|
70
72
|
|
|
73
|
+
- 1.1.2 — fix: `next` extends `core` plus the canonical Next rule set
|
|
74
|
+
(`eslint-config-next` already bundles React/react-hooks/jsx-a11y, so
|
|
75
|
+
spreading `frontend` on top redefined `jsx-a11y` and flat config rejected
|
|
76
|
+
it). The `frontend` React layer is now scoped to JSX/TSX files, so
|
|
77
|
+
non-React frontend repos (fewbie-cli) never evaluate React rules.
|
|
78
|
+
- 1.1.1 — fix: `frontend` uses the flat variant of eslint-plugin-react-hooks
|
|
79
|
+
(`configs.flat["recommended-latest"]`); 1.1.0 shipped the legacy shape and
|
|
80
|
+
failed to load under flat config.
|
|
71
81
|
- 1.1.0 — entries renamed to `backend` / `frontend` and layered: `core` is
|
|
72
82
|
internal, `frontend` is framework-independent (React rules only), `next`
|
|
73
83
|
adds the canonical Next.js rule set. `nest` was replaced by `backend`.
|
package/eslint/frontend.js
CHANGED
|
@@ -12,17 +12,20 @@ import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
|
12
12
|
* Deliberately independent of `eslint-config-next`: that package requires the
|
|
13
13
|
* `next` package to be installed (its parser is `next/dist/compiled/babel
|
|
14
14
|
* /eslint-parser`), while fewbie ships a Node CLI and has no Next runtime.
|
|
15
|
-
* Next.js applications layer `@devbie/style-guide/eslint/next` on top
|
|
16
|
-
* standard instead, so every frontend repo shares the same base rules.
|
|
15
|
+
* Next.js applications layer `@devbie/style-guide/eslint/next` on top instead.
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* The JSX/React layer is scoped to JSX/TSX files: repositories in the
|
|
18
|
+
* frontend group that carry no React code (fewbie-cli) receive the same
|
|
19
|
+
* standard without evaluating React rules at all.
|
|
20
20
|
*/
|
|
21
|
+
const jsxFiles = ["**/*.jsx", "**/*.tsx"];
|
|
22
|
+
const jsxOnly = (config) => ({ ...config, files: jsxFiles });
|
|
23
|
+
|
|
21
24
|
export default [
|
|
22
25
|
...core,
|
|
23
|
-
react.configs.flat.recommended,
|
|
24
|
-
react.configs.flat["jsx-runtime"],
|
|
25
|
-
reactHooks.configs["recommended-latest"],
|
|
26
|
-
jsxA11y.flatConfigs.recommended,
|
|
26
|
+
jsxOnly(react.configs.flat.recommended),
|
|
27
|
+
jsxOnly(react.configs.flat["jsx-runtime"]),
|
|
28
|
+
jsxOnly(reactHooks.configs.flat["recommended-latest"]),
|
|
29
|
+
jsxOnly(jsxA11y.flatConfigs.recommended),
|
|
27
30
|
prettierConfig,
|
|
28
31
|
];
|
package/eslint/next.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
-
import
|
|
2
|
+
import core from "./core.js";
|
|
3
3
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
4
4
|
import nextTs from "eslint-config-next/typescript";
|
|
5
5
|
import prettierConfig from "eslint-config-prettier";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Next.js
|
|
8
|
+
* Next.js standard for Next.js applications
|
|
9
9
|
* (nightwatch-frontend, fewbie-starter).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Extends the shared `core` baseline with the canonical Next rule set.
|
|
12
|
+
* `eslint-config-next` already bundles the React / react-hooks / jsx-a11y
|
|
13
|
+
* layers, so the `frontend` React layer is not repeated here: spreading both
|
|
14
|
+
* would redefine the same plugin and flat config rejects that.
|
|
15
|
+
*
|
|
12
16
|
* This entry can only be loaded where the `next` package is installed, which
|
|
13
17
|
* is why frontend repos without a Next runtime use `frontend` instead.
|
|
14
18
|
*/
|
|
15
19
|
export default defineConfig([
|
|
16
|
-
...
|
|
20
|
+
...core,
|
|
17
21
|
...nextVitals,
|
|
18
22
|
...nextTs,
|
|
19
23
|
prettierConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devbie/style-guide",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Single source of truth for devbie ecosystem code style: shared prettier config and eslint flat standards (backend, frontend, next)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "worldzhy",
|