@peerigon/configs 14.6.0 → 14.8.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/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # [14.8.0](https://github.com/peerigon/configs/compare/v14.7.0...v14.8.0) (2026-03-16)
2
+
3
+ ### Features
4
+
5
+ - **ai:** Apply best practices from "A Philosophy of Software Design" ([ad5f17d](https://github.com/peerigon/configs/commit/ad5f17dfc6534196fb65813682a2a429f7eb0495))
6
+
7
+ # [14.7.0](https://github.com/peerigon/configs/compare/v14.6.0...v14.7.0) (2026-03-16)
8
+
9
+ ### Features
10
+
11
+ - **ai:** Improve agent instructions for large repos ([89e8298](https://github.com/peerigon/configs/commit/89e82983d9a13439cc75e90b41cc2f13c345b5c8))
12
+ - Update dependencies ([ee6e1ed](https://github.com/peerigon/configs/commit/ee6e1ed3fc64563792437ab102e0dacbc9e6ca24))
13
+
1
14
  # [14.6.0](https://github.com/peerigon/configs/compare/v14.5.0...v14.6.0) (2026-03-15)
2
15
 
3
16
  ### Features
package/ai/README.md CHANGED
@@ -12,6 +12,9 @@ Put this in your project-specific rules file (like `CLAUDE.md`, `.cursor/rules.m
12
12
  **Important**: You **must** follow [these rules](./node_modules/@peerigon/configs/ai/rules.mdc) and its language-specific rules referenced in that file.
13
13
  ```
14
14
 
15
+ For large repositories, we recommend maintaining a repo-level routing document at `docs/agent-routing.md` to help agents find the right entrypoints quickly.
16
+ You can start from [`agent-routing.example.md`](./agent-routing.example.md) and adapt it to your needs.
17
+
15
18
  ## Migration Guide
16
19
 
17
20
  [`migrate-to.md`](./migrate-to.md) provides step-by-step instructions for coding agents for migrating projects to use `@peerigon/configs`.
@@ -0,0 +1,41 @@
1
+ # Agent Routing
2
+
3
+ Use this file as a fast index for coding agents in large repositories. Keep entries short and practical.
4
+
5
+ ## Scope
6
+
7
+ Describe the repository purpose in 2-4 lines.
8
+
9
+ ## Quick task map
10
+
11
+ - "<task type>" -> `<path-a>`, `<path-b>`, `<path-c>`
12
+ - "Add or modify API endpoint" -> `src/api/*`, `src/routes/*`, `tests/api/*`
13
+ - "UI component change" -> `src/components/*`, `src/pages/*`, `*.stories.*`
14
+ - "Build or release change" -> `package.json`, `.github/workflows/*`, `semantic-release/*`
15
+
16
+ ## Entry points by area
17
+
18
+ ### Authentication
19
+
20
+ - Start reading: `src/auth/index.ts`
21
+ - Core flow: `src/auth/service.ts`
22
+ - Tests: `src/auth/*.test.ts`
23
+
24
+ ### Data layer
25
+
26
+ - Start reading: `src/db/client.ts`
27
+ - Migrations: `db/migrations/*`
28
+ - Contract tests: `tests/db/*`
29
+
30
+ ## Validation commands
31
+
32
+ - Unit (scoped): `npm run test -- <path>`
33
+ - Types: `npm run test:types`
34
+ - Lint: `npm run test:lint`
35
+ - Full: `npm test && npm run build`
36
+
37
+ ## Known traps
38
+
39
+ - "Import style is extensionless in app packages."
40
+ - "Feature flags are defined in `src/flags.ts`."
41
+ - "Integration tests require `.env.test`."
@@ -8,6 +8,7 @@ globs: **/*.js, **/*.ts, **/*.mjs, **/*.cjs, **/*.mts, **/*.cts
8
8
  - Use TypeScript. If .js files are requested, use JSDoc type annotations
9
9
  - Prefer functional over imperative
10
10
  - Prefer immutability
11
+ - **Priority rule (MUST)**: order every file by importance. Start with the primary logic and keep less important helpers/details at the end.
11
12
 
12
13
  ## Formatting
13
14
 
@@ -16,17 +17,21 @@ globs: **/*.js, **/*.ts, **/*.mjs, **/*.cjs, **/*.mts, **/*.cts
16
17
  ## Imports & exports
17
18
 
18
19
  - Use ESM unless you're editing a CommonJS file
19
- - Use file extensions in import specifiers. Use .ts extension in TypeScript files.
20
+ - Follow the consuming repository's established import-specifier convention (extensions vs extensionless; `.js` vs `.ts` in TypeScript source files)
21
+ - Determine convention from nearby files and configuration before introducing new imports
22
+ - Keep import style consistent within a module/package; avoid mixed styles unless already established
23
+ - If conventions are unclear or conflicting, ask the user before changing or introducing import-specifier style
20
24
  - Avoid default imports and default exports
21
25
  - Avoid barrel files (index files that only re-export) unless its a package entry file
22
26
 
23
27
  ## File structure
24
28
 
25
- - Begin with a `@module` overview JSDoc comment (**not** for test or config files)
29
+ - Do not add a file header comment by default
30
+ - For complex or high-impact files only, add a short context comment near the top (3-6 lines) that explains purpose, where to start reading, and non-obvious caveats
26
31
  - Then imports
27
32
  - Then important top-level constants or variables
28
- - Then order by importance (in relation to the file purpose): the most important classes/functions of the file should be at the beginning
29
- - Unimportant helper functions and variables should be at the bottom of the file
33
+ - Then order by importance (in relation to the file purpose): the file **must** start with its most important classes/functions
34
+ - Move unimportant helper functions, variables, and secondary details to the bottom of the file
30
35
  - Exception: when module execution requires a function to be defined before it is used, define it earlier
31
36
 
32
37
  ## Naming Conventions
@@ -95,7 +100,9 @@ globs: **/*.js, **/*.ts, **/*.mjs, **/*.cjs, **/*.mts, **/*.cts
95
100
 
96
101
  ## Comments
97
102
 
98
- - Use JSDoc comments and its tags where appropriate
103
+ - Use comments to explain why, invariants, constraints, and non-obvious trade-offs
104
+ - Do not write comments that only restate what the code already makes obvious
105
+ - Add short contract comments only for complex or high-impact exports. Focus on purpose, guarantees, and important caveats.
99
106
 
100
107
  ## Testing
101
108
 
@@ -9,6 +9,7 @@ globs: **/*.tsx, **/*.jsx
9
9
  - Inline component props next to the component prop argument
10
10
  - Derive state where possible
11
11
  - Avoid unnecessary `useState` and `useEffect`
12
- - `useEffect` **must** contain an async function call (unless it's a synchronous browser api like `localStorage`)
12
+ - Use `useEffect` only when synchronizing with external systems (for example browser APIs, subscriptions, timers, network interactions)
13
+ - Keep effects small, deterministic, and cleanup-safe
13
14
  - Avoid `useMemo` and `useCallback` unless its absolutely necessary
14
15
  - Create a story for each React component if Storybook is used
@@ -7,7 +7,7 @@ globs: **/*.test.js, **/*.test.ts, **/*.test.tsx
7
7
 
8
8
  ## General principle
9
9
 
10
- **Important**: Write as less tests as possible while covering all relevant scenarios. Focus on testing the behavior of the code rather than implementation details.
10
+ **Important**: Aim for the smallest high-value test set that protects behavior, interface contracts, invariants, and regression-prone paths. Focus on testing behavior rather than implementation details.
11
11
 
12
12
  ## Structure & Organization
13
13
 
package/ai/rules.mdc CHANGED
@@ -14,6 +14,12 @@ alwaysApply: true
14
14
  - Prefer explicit over implicit
15
15
  - Keep code close together that belongs together
16
16
 
17
+ ## Complexity and module design
18
+
19
+ - Treat complexity as the primary enemy. Prefer designs that reduce mental load, special cases, and cross-module coupling.
20
+ - Prefer deep modules with shallow interfaces: expose minimal API surface and hide implementation details by default.
21
+ - Avoid pass-through abstractions that add layers but do not hide meaningful complexity.
22
+
17
23
  ## JavaScript & TypeScript
18
24
 
19
25
  See [Coding Styleguide JavaScript & TypeScript](./coding-styleguide-js-ts.mdc)
@@ -33,9 +39,34 @@ See [Coding Styleguide Shell Scripts](./coding-styleguide-sh.mdc)
33
39
  ## Development Practices
34
40
 
35
41
  - Breakdown complex tasks into smaller, manageable todos and write them down to a dedicated TODO file
36
- - Aim for small pull-requests. Each TODO should be a single pull-request. Use stacked PRs.
42
+ - Aim for small, reviewable pull-requests. Split work into logical units, and use stacked PRs when scope or risk justifies incremental review.
37
43
  - Write unit tests for simple, pure functions
38
- - Unit test files are colocated with source files (*.test.ts)
44
+ - Unit test files are colocated with source files (\*.test.ts)
39
45
  - Write integration or e2e tests for more complex functions/classes/components
40
- - Run the linter and type checker only once after the implementation is complete and the tests are passing
41
- - Adjust documentation both in comments and markdown files once you're done
46
+ - Prefer staged validation for non-trivial tasks: run focused checks after meaningful changes, then run broader lint/type/test checks before handoff. For trivial tasks, a single final validation is acceptable.
47
+ - Adjust documentation both in comments and markdown files once you're done
48
+
49
+ ## Consumer-repo uncertainty protocol
50
+
51
+ Some guidance depends on the consuming repository's runtime and toolchain (module resolution, transpilation, bundler, test runner).
52
+
53
+ - First infer conventions from local evidence:
54
+ - nearby files and existing import style
55
+ - tsconfig compiler options
56
+ - eslint and import rules
57
+ - package scripts and build tooling
58
+ - If evidence is insufficient or conflicting, ask one concise question before changing conventions.
59
+ - Do not silently introduce a new convention in a mixed or unknown setup.
60
+ - If no answer is possible, follow the closest existing local convention and explicitly document the assumption.
61
+
62
+ ## Repo-level routing system
63
+
64
+ To reduce exploration cost in large repositories, use a repo-level routing document.
65
+
66
+ - Preferred path in consuming repositories: `docs/agent-routing.md` (or the nearest existing equivalent).
67
+ - Use `@peerigon/configs/ai/agent-routing.example.md` as a starting structure and adapt it to the consuming repository.
68
+ - At task start, check whether routing exists.
69
+ - If routing is missing and the task is non-trivial, create an initial routing file before implementation. If local policy may restrict docs changes, ask one concise question first.
70
+ - Use routing-first navigation: read the relevant routing section before broad codebase exploration.
71
+ - Keep routing concise and practical. Update it when better entrypoints, caveats, or validation commands are discovered.
72
+ - Do not duplicate full architecture docs. Routing should be an index for fast task orientation.
@@ -2,7 +2,6 @@
2
2
  import reactPlugin2 from "@eslint-react/eslint-plugin";
3
3
  import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
4
4
  import reactPlugin from "eslint-plugin-react";
5
- import reactCompilerPlugin from "eslint-plugin-react-compiler";
6
5
  import reactHooksPlugin from "eslint-plugin-react-hooks";
7
6
  import reactRefreshPlugin from "eslint-plugin-react-refresh";
8
7
  import reactYouMightNotNeedAnEffect from "eslint-plugin-react-you-might-not-need-an-effect";
@@ -66,28 +65,9 @@ export const react = [
66
65
  ],
67
66
  },
68
67
  },
69
- // There's currently no official recommended flat config for react-hooks.
70
- // TODO: Use recommended config when it's available.
71
68
  {
72
69
  files,
73
- plugins: {
74
- "react-hooks": reactHooksPlugin,
75
- },
76
- rules: {
77
- "react-hooks/rules-of-hooks": "error",
78
- "react-hooks/exhaustive-deps": "warn",
79
- },
80
- },
81
- // There's currently no official recommended flat config for react-compiler.
82
- // TODO: Use recommended config when it's available.
83
- {
84
- files,
85
- plugins: {
86
- "react-compiler": reactCompilerPlugin,
87
- },
88
- rules: {
89
- "react-compiler/react-compiler": "error",
90
- },
70
+ ...reactHooksPlugin.configs.flat.recommended,
91
71
  },
92
72
  {
93
73
  files,
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import assert from "node:assert/strict";
2
+ import reactHooksPlugin from "eslint-plugin-react-hooks";
3
+ import { react } from "./react.js";
4
+ const reactHooksConfigs = react.filter((config) => config.rules &&
5
+ typeof config.rules === "object" &&
6
+ "react-hooks/rules-of-hooks" in config.rules);
7
+ assert.equal(reactHooksConfigs.length, 1, "react config should include exactly one react-hooks recommended config entry");
8
+ assert.deepEqual(reactHooksConfigs[0]?.rules, reactHooksPlugin.configs.flat.recommended.rules, "react config should mirror eslint-plugin-react-hooks flat recommended rules");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerigon/configs",
3
- "version": "14.6.0",
3
+ "version": "14.8.0",
4
4
  "description": "Configs for ESLint, Prettier, TypeScript & friends",
5
5
  "keywords": [
6
6
  "eslint",
@@ -79,25 +79,24 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@eslint-react/eslint-plugin": "^2.13.0",
82
- "@eslint/compat": "^2.0.2",
82
+ "@eslint/compat": "^2.0.3",
83
83
  "@eslint/js": "^9.39.1",
84
84
  "@ianvs/prettier-plugin-sort-imports": "^4.7.1",
85
85
  "@prettier/plugin-oxc": "^0.1.3",
86
- "@sebbo2002/semantic-release-jsr": "^3.2.0",
86
+ "@sebbo2002/semantic-release-jsr": "^3.2.1",
87
87
  "@semantic-release/changelog": "^6.0.3",
88
88
  "@semantic-release/exec": "^7.1.0",
89
89
  "@semantic-release/git": "^10.0.1",
90
90
  "@tanstack/eslint-plugin-query": "^5.91.4",
91
91
  "@types/eslint-config-prettier": "^6.11.3",
92
92
  "@types/eslint-plugin-jsx-a11y": "^6.10.1",
93
- "@vitest/eslint-plugin": "^1.6.9",
93
+ "@vitest/eslint-plugin": "^1.6.12",
94
94
  "eslint-config-prettier": "^10.1.8",
95
95
  "eslint-plugin-jsx-a11y": "^6.10.2",
96
96
  "eslint-plugin-no-only-tests": "^3.3.0",
97
- "eslint-plugin-playwright": "^2.8.0",
97
+ "eslint-plugin-playwright": "^2.10.0",
98
98
  "eslint-plugin-prefer-arrow": "^1.2.3",
99
99
  "eslint-plugin-react": "^7.37.5",
100
- "eslint-plugin-react-compiler": "^19.1.0-rc.2",
101
100
  "eslint-plugin-react-hooks": "^7.0.1",
102
101
  "eslint-plugin-react-refresh": "^0.5.2",
103
102
  "eslint-plugin-react-you-might-not-need-an-effect": "^0.9.1",
@@ -105,18 +104,18 @@
105
104
  "globals": "^17.4.0",
106
105
  "prettier-plugin-css-order": "^2.2.0",
107
106
  "prettier-plugin-jsdoc": "^1.8.0",
108
- "prettier-plugin-packagejson": "^3.0.0",
107
+ "prettier-plugin-packagejson": "^3.0.2",
109
108
  "prettier-plugin-tailwindcss": "^0.7.2",
110
- "typescript-eslint": "^8.56.0"
109
+ "typescript-eslint": "^8.57.0"
111
110
  },
112
111
  "devDependencies": {
113
112
  "@types/jest": "^30.0.0",
114
- "@types/node": "^25.3.0",
113
+ "@types/node": "^25.5.0",
115
114
  "@types/react": "^19.2.14",
116
115
  "@types/signale": "^1.4.7",
117
116
  "eslint": "^9.39.1",
118
117
  "husky": "^9.1.7",
119
- "lint-staged": "^16.3.1",
118
+ "lint-staged": "^16.4.0",
120
119
  "npm-run-all2": "^8.0.4",
121
120
  "pin-github-action": "^3.4.0",
122
121
  "prettier": "^3.8.1",