@devbie/style-guide 1.1.3 → 1.2.0

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
@@ -5,27 +5,26 @@ Single source of truth for code style across the devbie ecosystem
5
5
 
6
6
  ## Exports
7
7
 
8
- | Entry | Contents |
9
- | ------------------------------------ | -------------------------------------------------------------- |
10
- | `@devbie/style-guide/prettier` | Canonical prettier config (all repos) |
11
- | `@devbie/style-guide/eslint/backend` | eslint flat standard for Nest/Node TypeScript backends |
12
- | `@devbie/style-guide/eslint/frontend`| eslint flat standard for frontend repos (TS + React + a11y) |
13
- | `@devbie/style-guide/eslint/next` | Frontend standard + canonical Next.js rules (overlay) |
8
+ | Entry | Contents |
9
+ | --------------------------------- | --------------------------------------------------- |
10
+ | `@devbie/style-guide/prettier` | Canonical prettier config (all repos) |
11
+ | `@devbie/style-guide/eslint/base` | eslint flat standard for Node TypeScript repos |
12
+ | `@devbie/style-guide/eslint/next` | `base` + canonical Next.js rules (for Next.js apps) |
14
13
 
15
14
  ## Which entry each repo uses
16
15
 
17
- | Repo | eslint entry |
18
- | --------------------------------------------------------------------------------- | ------------ |
19
- | newbie, newbie-starter, nightwatch-backend, newbie-modules, apits | `backend` |
20
- | fewbie | `frontend` |
21
- | fewbie-starter, nightwatch-frontend | `next` |
16
+ | Repo | eslint entry |
17
+ | ---------------------------------------------------------- | ------------ |
18
+ | newbie, newbie-starter, nightwatch-backend, newbie-modules | `base` |
19
+ | fewbie-starter, nightwatch-frontend | `next` |
22
20
 
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.
21
+ `base` is the shared default: language-level rules plus prettier, with no
22
+ framework content — it serves Nest services, CLIs, code generators, and
23
+ source registries alike. `next` is `base`'s baseline plus `eslint-config-next`
24
+ (which already bundles the React / react-hooks / jsx-a11y layers), so every
25
+ repo shares the same language-level rules while Next.js applications add only
26
+ the canonical framework layer. `eslint-config-next` requires the `next`
27
+ package at load time, which is why Node repos cannot use `next`.
29
28
 
30
29
  ## Usage
31
30
 
@@ -48,12 +47,11 @@ not style decisions.
48
47
  `eslint.config.mjs` in the consumer repo:
49
48
 
50
49
  ```js
51
- import backend from "@devbie/style-guide/eslint/backend";
52
- // frontend repos: import frontend from "@devbie/style-guide/eslint/frontend";
53
- // Next.js apps: import next from "@devbie/style-guide/eslint/next";
50
+ import base from "@devbie/style-guide/eslint/base";
51
+ // Next.js apps: import next from "@devbie/style-guide/eslint/next";
54
52
 
55
53
  export default [
56
- ...backend,
54
+ ...base,
57
55
  // Repo-specific rules and ignores go here.
58
56
  ];
59
57
  ```
@@ -70,6 +68,13 @@ default, only as a deliberate milestone.
70
68
 
71
69
  ## Changelog
72
70
 
71
+ - 1.2.0 — `backend` renamed to `base` and `frontend` removed. After apits and
72
+ fewbie-cli joined the newbie monorepo (ADR-012/ADR-015), `frontend` had no
73
+ consumer left, and `backend` no longer described its consumers (CLIs, code
74
+ generators, registries — none of them backends). The pair is now named for
75
+ what it is: `base` (the default) and `next` (the Next.js specialization).
76
+ The react/react-hooks/jsx-a11y plugin dependencies are dropped; `next`
77
+ gets those layers from `eslint-config-next`.
73
78
  - 1.1.3 — `frontend` pins the React version for rule evaluation (19.0) instead
74
79
  of detecting it: fewbie lints React template sources without a `react`
75
80
  package installed, where detection only emits a warning.
package/eslint/base.js ADDED
@@ -0,0 +1,15 @@
1
+ import core from "./core.js";
2
+ import prettierConfig from "eslint-config-prettier";
3
+
4
+ /**
5
+ * Base standard for the devbie ecosystem.
6
+ *
7
+ * Consumers: newbie (monorepo), newbie-starter, nightwatch-backend,
8
+ * newbie-modules, apits, fewbie-cli (inside newbie). All of them are Node.js
9
+ * TypeScript codebases — no browser DOM framework. The language-level rules
10
+ * live in `core` so base and next standards never drift on the shared part.
11
+ *
12
+ * Repo-specific rules and ignores belong in the consumer's own
13
+ * eslint.config.mjs, spread after this entry.
14
+ */
15
+ export default [...core, prettierConfig];
package/eslint/core.js CHANGED
@@ -11,20 +11,27 @@ import tseslint from "typescript-eslint";
11
11
  * Internal entry: consumers import `backend`, `frontend` or `next`, never
12
12
  * this file.
13
13
  */
14
- export default [...tseslint.configs.recommended, {
15
- rules: {
16
- "@typescript-eslint/no-explicit-any": "off",
17
- "@typescript-eslint/no-unused-vars": [
18
- "error",
19
- { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
20
- ],
14
+ export default [
15
+ ...tseslint.configs.recommended,
16
+ {
17
+ rules: {
18
+ "@typescript-eslint/no-explicit-any": "off",
19
+ "@typescript-eslint/no-unused-vars": [
20
+ "error",
21
+ { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
22
+ ],
21
23
 
22
- // Code-quality rules carried over from the legacy gts-derived config.
23
- "block-scoped-var": "error",
24
- eqeqeq: ["error", "always", { null: "ignore" }],
25
- "no-var": "error",
26
- "prefer-const": "error",
27
- "prefer-arrow-callback": "error",
28
- "no-restricted-properties": ["error", { object: "describe", property: "only" }, { object: "it", property: "only" }],
24
+ // Code-quality rules carried over from the legacy gts-derived config.
25
+ "block-scoped-var": "error",
26
+ eqeqeq: ["error", "always", { null: "ignore" }],
27
+ "no-var": "error",
28
+ "prefer-const": "error",
29
+ "prefer-arrow-callback": "error",
30
+ "no-restricted-properties": [
31
+ "error",
32
+ { object: "describe", property: "only" },
33
+ { object: "it", property: "only" },
34
+ ],
35
+ },
29
36
  },
30
- }];
37
+ ];
package/eslint/next.js CHANGED
@@ -10,11 +10,11 @@ import prettierConfig from "eslint-config-prettier";
10
10
  *
11
11
  * Extends the shared `core` baseline with the canonical Next rule set.
12
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
13
+ * layers, so nothing else is layered on top: spreading another React layer
14
14
  * would redefine the same plugin and flat config rejects that.
15
15
  *
16
- * This entry can only be loaded where the `next` package is installed, which
17
- * is why frontend repos without a Next runtime use `frontend` instead.
16
+ * This entry can only be loaded where the `next` package is installed; Node
17
+ * repos without a Next runtime use the `base` entry instead.
18
18
  */
19
19
  export default defineConfig([
20
20
  ...core,
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "@devbie/style-guide",
3
- "version": "1.1.3",
4
- "description": "Single source of truth for devbie ecosystem code style: shared prettier config and eslint flat standards (backend, frontend, next)",
3
+ "version": "1.2.0",
4
+ "description": "Single source of truth for devbie ecosystem code style: shared prettier config and eslint flat standards (base, next)",
5
5
  "license": "MIT",
6
6
  "author": "worldzhy",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  "./prettier": "./prettier.js",
10
- "./eslint/backend": "./eslint/backend.js",
11
- "./eslint/frontend": "./eslint/frontend.js",
10
+ "./eslint/base": "./eslint/base.js",
12
11
  "./eslint/next": "./eslint/next.js",
13
12
  "./package.json": "./package.json"
14
13
  },
@@ -22,9 +21,6 @@
22
21
  "dependencies": {
23
22
  "eslint-config-next": "^16.4.2",
24
23
  "eslint-config-prettier": "^10.1.8",
25
- "eslint-plugin-jsx-a11y": "^6.10.0",
26
- "eslint-plugin-react": "^7.37.0",
27
- "eslint-plugin-react-hooks": "^7.1.0",
28
24
  "typescript-eslint": "^8.71.2"
29
25
  },
30
26
  "peerDependencies": {
package/eslint/backend.js DELETED
@@ -1,15 +0,0 @@
1
- import core from "./core.js";
2
- import prettierConfig from "eslint-config-prettier";
3
-
4
- /**
5
- * Backend standard for the devbie ecosystem.
6
- *
7
- * Consumers: newbie, newbie-starter, nightwatch-backend, newbie-modules,
8
- * apits. All of them are Nest/Node TypeScript codebases; the language-level
9
- * rules live in `core` so the backend and frontend standards never drift on
10
- * the shared part.
11
- *
12
- * Repo-specific rules and ignores belong in the consumer's own
13
- * eslint.config.mjs, spread after this entry.
14
- */
15
- export default [...core, prettierConfig];
@@ -1,34 +0,0 @@
1
- import core from "./core.js";
2
- import prettierConfig from "eslint-config-prettier";
3
- import react from "eslint-plugin-react";
4
- import reactHooks from "eslint-plugin-react-hooks";
5
- import jsxA11y from "eslint-plugin-jsx-a11y";
6
-
7
- /**
8
- * Frontend standard for the devbie ecosystem.
9
- *
10
- * Consumers: fewbie, fewbie-starter, nightwatch-frontend.
11
- *
12
- * Deliberately independent of `eslint-config-next`: that package requires the
13
- * `next` package to be installed (its parser is `next/dist/compiled/babel
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 instead.
16
- *
17
- * The JSX/React layer is scoped to JSX/TSX files, so Node code in a frontend
18
- * group repo (fewbie-cli) is never evaluated against React rules, while its
19
- * React template sources are.
20
- */
21
- const jsxFiles = ["**/*.jsx", "**/*.tsx"];
22
- const jsxOnly = (config) => ({ ...config, files: jsxFiles });
23
-
24
- export default [
25
- ...core,
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),
30
- // Pinned instead of `detect`: fewbie lints React 19 template sources without
31
- // a `react` package installed, where detection only produces a warning.
32
- { settings: { react: { version: "19.0" } } },
33
- prettierConfig,
34
- ];