@devbie/style-guide 1.1.1 → 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 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 `frontend` standard plus `eslint-config-next`, so Next.js
24
- applications and the rest of the frontend group never drift on the shared
25
- part. `eslint-config-next` requires the `next` package at load time, which is
26
- why repos without a Next runtime (fewbie) use `frontend` instead.
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,11 @@ 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.
71
78
  - 1.1.1 — fix: `frontend` uses the flat variant of eslint-plugin-react-hooks
72
79
  (`configs.flat["recommended-latest"]`); 1.1.0 shipped the legacy shape and
73
80
  failed to load under flat config.
@@ -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 of this
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
- * Repo-specific rules and ignores belong in the consumer's own
19
- * eslint.config.mjs, spread after this entry.
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.flat["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 frontend from "./frontend.js";
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 overlay for Next.js applications
8
+ * Next.js standard for Next.js applications
9
9
  * (nightwatch-frontend, fewbie-starter).
10
10
  *
11
- * It extends the shared frontend standard with the canonical Next rule set.
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
- ...frontend,
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.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",