@dloizides/frontend-devtools 2.0.0 → 2.1.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,162 +1,170 @@
1
- # Changelog
2
-
3
- All notable changes to `@dloizides/frontend-devtools` are documented here.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [2.0.0] - 2026-10-20
9
-
10
- D-PAT-15 "Move initI18n out of frontend-devtools so it is dev-only".
11
-
12
- ### Removed (BREAKING)
13
- - `initI18n` and `InitI18nOptions`: import them from `@dloizides/i18n` (>= 1.1.0), same signature: `import { initI18n } from '@dloizides/i18n';`.
14
- - The root entry (`@dloizides/frontend-devtools`): it exported only `initI18n`. Use the `/eslint` and `/test-results` subpaths.
15
- - The `i18next` and `react-i18next` optional peer dependencies.
16
-
17
- ## [1.10.0] - 2026-10-19
18
-
19
- PATTERN-1.12 "TS rule packs + house rules in frontend-devtools" (D-PAT-12 "Whole rule packs as warnings, one shared approach").
20
-
21
- ### Added
22
- - `patternPacksConfig`: the recommended rules of `@tanstack/eslint-plugin-query`, `eslint-plugin-react-you-might-not-need-an-effect`, `eslint-plugin-boundaries` and `eslint-plugin-sonarjs`, every rule at `warn`, plus the house rules.
23
- - `query-key-factory` (PAT-QUERY-KEY-1 "queryKey only from a key factory"): flags an inline array/string/template `queryKey`; key-factory files (`*Keys.ts`), tests and generated code are exempt; `allow` adds path fragments.
24
- - `HOUSE_PATTERN_RULE_NAMES`.
25
-
26
- ## [1.9.0] - 2026-10-19
27
-
28
- PATTERN-1.4 "TypeScript pattern rules as ESLint rules", `no-raw-backend-fetch` (PAT-API-1 "web apps call the backend through the shared client") hardening.
29
-
30
- ### Changed
31
- - `no-raw-backend-fetch` no longer reports `fetch` of a literal absolute `http(s)://host/...` URL (third-party), or of a value produced by `URL.createObjectURL(...)` / `new FileReader().result` (direct, or via a single `const`).
32
- - `no-raw-backend-fetch` registers no visitors when the parsed AST is not an ESTree `Program` (non-JS languages under an unscoped `apiConfig`).
33
-
34
- ### Tests
35
- - `apiConfigUnscoped.test.ts`: `apiConfig` without `files` lints `.js`/`.mjs`/`.cjs`, build output and a 2000-deep nested file without throwing, and still reports under `src/`.
36
-
37
- ## [1.8.0] - 2026-10-19
38
-
39
- PATTERN-1.4 "TypeScript pattern rules as ESLint rules", row PAT-API-1 "web apps call the backend through the shared client".
40
-
41
- ### Added
42
-
43
- - `no-raw-backend-fetch`: reports `fetch(` / `window.fetch(` / `globalThis.fetch(` / `self.fetch(` and value imports of `axios`
44
- (`import`, `require`, `import()`) in `src/**`. Exempt: `src/server/`, `src/http/`, `src/lib/http/`, `packages/*-client/`,
45
- `/generated/`, service worker files, `app/+html.*`, tests, `data:`/`blob:` URLs, `import type` from axios. Option `{ allow: string[] }`.
46
- - `apiConfig` flat-config preset (`API_RULE_NAMES`) at `error`; included in `recommendedConfig`.
47
-
48
- ## [1.7.0] - 2026-10-19
49
-
50
- NAV-1 "Every game menu works with arrow keys and controller", phase 3.
51
-
52
- ### Added
53
-
54
- - `game-menu-focusable`: reports a `click` / `pointerdown` / `pointerup` listener or `onclick =` on an element created as
55
- `div` / `span` / `li` / `img` whose variable never gets `tabIndex` / `role` (property or `setAttribute`), and every
56
- `stopPropagation()` inside a `keydown` / `onkeydown` handler (inline, named function or const). No options, no autofix.
57
- - `gameConfig` flat-config preset (`GAME_RULE_NAMES`): enables `game-menu-focusable` at `error`. Not part of
58
- `recommendedConfig`; game repos opt in.
59
-
60
- ### Changed
61
-
62
- - `testdoc-results.v1.schema.json` copy synced to Dloizides.Testing 7fbf809 (adds the optional `features` array).
63
-
64
- ## [1.5.0] - 2026-10-07
65
-
66
- KEFI-ACT-1 "Same attendee actions everywhere" (generalized: one row-action source per entity, every portal).
67
-
68
- ### Added
69
-
70
- - `single-row-action-source`: reports `<RowActionGroup actions>` from `@dloizides/ui-buttons` built in the same file
71
- (inline array, array-bound identifier, `useMemo` returning an array, local builder function, `RowActionSpec[]`
72
- annotated local). Imported builders/sets and props pass. No options, no autofix.
73
- - `rowActionsConfig` and `recommendedConfig` flat-config blocks (`recommendedConfig` = comments + row actions, all `error`).
74
-
75
- ## [1.4.0] - 2026-10-07
76
-
77
- COMMENTS-1 "No code comments; only short doc comments on public members", decision D-CMT-4 "One-line summary, no call chains".
78
-
79
- ### Changed
80
-
81
- - `doc-comment-max-lines`: the description (lines other than `@param` / `@returns`) is capped at ONE line
82
- (`summaryMaxLines`, default 1), every doc line at 120 chars (`lineMaxChars`), and a line containing an arrow
83
- (U+2192 or `->`) or starting `Flow:` is reported (`callChain`). Matches `.claude/hooks/review-violations.js` docBlock().
84
- The 3-line total cap is unchanged. One report per block; banned tags take precedence.
85
-
86
- ## [1.3.0] - 2026-10-06
87
-
88
- COMMENTS-1 "No code comments; only short doc comments on public members" (decisions D-CMT-1, D-CMT-3).
89
-
90
- ### Added
91
-
92
- - `no-comments`: reports every comment that is not a `/**` doc block and not a tool directive
93
- (`eslint-*`, `@ts-*`, `prettier-ignore`, `istanbul`/`c8`, `/// <reference>`, `#__PURE__`,
94
- `webpackChunkName`, shebang). `allow: string[]` adds directive regexes. Suggestion only, no autofix.
95
- - `doc-comment-public-only`: a doc block must sit on an exported declaration (incl. `export { x }`,
96
- `export default x`, `module.exports`, ambient `declare module`) or a public member of one;
97
- `private` / `protected` / `#` members and local declarations are reported.
98
- - `doc-comment-max-lines`: doc body capped at `max` (default 3) content lines; block tags other than
99
- `allowedTags` (default `@param`, `@returns`) are reported. JSDoc type-annotation blocks
100
- (`@type`, `@typedef`, ...) are exempt from both doc rules.
101
- - `commentsConfig` flat-config block (the three rules at `error`) and `COMMENT_RULE_NAMES`, exported
102
- from `/eslint`. Not adopted by any app yet: each repo opts in as step 1 of its COMMENTS-CLEAN sweep.
103
-
104
- ## [1.1.0] - 2026-07-13
105
-
106
- Both changes come out of the ES-04 (agora-web) build, which surfaced two ways the
107
- rule pack misbehaved against a freshly scaffolded app.
108
-
109
- ### Fixed
110
-
111
- - **`no-null-check`: the autofixer no longer corrupts files.** It rewrote
112
- `x === undefined` → `!isValueDefined(x)` *without importing `isValueDefined`*,
113
- so `eslint --fix` emitted source referencing an undeclared global. Running
114
- `lint:fix` on agora-web rewrote ~20 files and produced 67 `no-unsafe-call` /
115
- `strict-boolean-expressions` errors. A fixer that produces broken code is worse
116
- than no fixer — `lint:fix` is the first thing anyone runs.
117
-
118
- The fixer now inserts `import { isValueDefined } from '@dloizides/utils';` (the
119
- path is configurable via the pre-existing but previously **unused**
120
- `utilImportPath` option) when the file has no binding for the guard, and skips
121
- the autofix entirely in the module that defines or re-exports it. Proven with
122
- `Linter.verifyAndFix` multipass tests — the actual `--fix` code path.
123
-
124
- ⚠️ The package's own test suite had *codified* the bug: it asserted the
125
- import-less output was correct. Those expectations were wrong and are updated.
126
-
127
- ### Changed
128
-
129
- - **`smart-max-lines`: `functionWarn` is now opt-in (default: off).** ESLint has
130
- no per-report severity, so a `functionWarn` report is emitted at the severity
131
- the *rule* is configured with. Every app configured the rule as `'error'` and
132
- passed `functionWarn: 30` — which made the real, enforced limit **30 lines**
133
- while the docs promised **50**. The rule lied about its own threshold.
134
-
135
- Out of the box the only enforced thresholds are now `componentMax` (200) and
136
- `functionMax` (50) — exactly what the documentation has always promised.
137
- `functionWarn` remains available as an explicit *stricter second threshold*,
138
- and its schema/message now say plainly that it reports at the rule's severity
139
- rather than as a warning.
140
-
141
- Migration: drop `functionWarn: 30` from your ESLint config. This only relaxes
142
- linting (30 → 50), so it cannot introduce new failures.
143
-
144
- ## [1.0.0] - 2026-06-14
145
-
146
- ### Added
147
-
148
- - Initial extraction of the shared RN-web dev tooling duplicated across
149
- erevna-web, katalogos-web, and kefi-web.
150
- - **ESLint custom rule pack** (17 rules) exported as `plugin` / `rules` /
151
- `legacyPlugins`, also available under the `@dloizides/frontend-devtools/eslint`
152
- subpath. Rule names preserved byte-for-byte so existing config keys and
153
- `eslint-disable-next-line <rule>` comments keep working:
154
- `enforce-function-style`, `enforce-module-structure`, `enforce-route-preload`,
155
- `enforce-test-colocation`, `enum-file-isolation`, `i18n-interpolation`,
156
- `i18n-param-names`, `no-barrel-companion-file`, `no-duplicate-nav-prefix`,
157
- `no-duplicate-shared-patterns`, `no-generated-models-barrel-value-import`,
158
- `no-null-check`, `no-optional-undefined`, `no-product-imports-in-shared`,
159
- `prefer-const-enum`, `require-stable-hook-args`, `smart-max-lines`.
160
- - **`initI18n(options)`** — parameterized i18next + react-i18next init factory.
161
- Carries the `import/no-named-as-default-member` disable so apps stop repeating
162
- it. The app owns its `locales/*.json` strings and the active language.
1
+ # Changelog
2
+
3
+ All notable changes to `@dloizides/frontend-devtools` are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.1.0] - 2026-10-20
9
+
10
+ QUAL-ADOPT-1 "Fail lint/arch tests when an app re-implements an existing package" (TS half).
11
+
12
+ ### Added
13
+ - `no-reimplemented-package`: flags app code that re-implements a shared package (hand-rolled analytics/Umami -> `@dloizides/analytics-web`, `X-BFF-Csrf` header or `bffCsrf` -> `@dloizides/bff-web-client`, `forgotPasswordRequest` -> `@dloizides/auth-web`, `utils/logger` -> `@dloizides/logging-web`). Pairs live in one registry, `src/rules/reimplemented-packages-registry.js`. Tests, e2e and package sources are exempt; `allow` adds path fragments.
14
+ - `reuseConfig` + `REUSE_RULE_NAMES` (opt-in, not part of `recommendedConfig`).
15
+
16
+ ## [2.0.0] - 2026-10-20
17
+
18
+ D-PAT-15 "Move initI18n out of frontend-devtools so it is dev-only".
19
+
20
+ ### Removed (BREAKING)
21
+ - `initI18n` and `InitI18nOptions`: import them from `@dloizides/i18n` (>= 1.1.0), same signature: `import { initI18n } from '@dloizides/i18n';`.
22
+ - The root entry (`@dloizides/frontend-devtools`): it exported only `initI18n`. Use the `/eslint` and `/test-results` subpaths.
23
+ - The `i18next` and `react-i18next` optional peer dependencies.
24
+
25
+ ## [1.10.0] - 2026-10-19
26
+
27
+ PATTERN-1.12 "TS rule packs + house rules in frontend-devtools" (D-PAT-12 "Whole rule packs as warnings, one shared approach").
28
+
29
+ ### Added
30
+ - `patternPacksConfig`: the recommended rules of `@tanstack/eslint-plugin-query`, `eslint-plugin-react-you-might-not-need-an-effect`, `eslint-plugin-boundaries` and `eslint-plugin-sonarjs`, every rule at `warn`, plus the house rules.
31
+ - `query-key-factory` (PAT-QUERY-KEY-1 "queryKey only from a key factory"): flags an inline array/string/template `queryKey`; key-factory files (`*Keys.ts`), tests and generated code are exempt; `allow` adds path fragments.
32
+ - `HOUSE_PATTERN_RULE_NAMES`.
33
+
34
+ ## [1.9.0] - 2026-10-19
35
+
36
+ PATTERN-1.4 "TypeScript pattern rules as ESLint rules", `no-raw-backend-fetch` (PAT-API-1 "web apps call the backend through the shared client") hardening.
37
+
38
+ ### Changed
39
+ - `no-raw-backend-fetch` no longer reports `fetch` of a literal absolute `http(s)://host/...` URL (third-party), or of a value produced by `URL.createObjectURL(...)` / `new FileReader().result` (direct, or via a single `const`).
40
+ - `no-raw-backend-fetch` registers no visitors when the parsed AST is not an ESTree `Program` (non-JS languages under an unscoped `apiConfig`).
41
+
42
+ ### Tests
43
+ - `apiConfigUnscoped.test.ts`: `apiConfig` without `files` lints `.js`/`.mjs`/`.cjs`, build output and a 2000-deep nested file without throwing, and still reports under `src/`.
44
+
45
+ ## [1.8.0] - 2026-10-19
46
+
47
+ PATTERN-1.4 "TypeScript pattern rules as ESLint rules", row PAT-API-1 "web apps call the backend through the shared client".
48
+
49
+ ### Added
50
+
51
+ - `no-raw-backend-fetch`: reports `fetch(` / `window.fetch(` / `globalThis.fetch(` / `self.fetch(` and value imports of `axios`
52
+ (`import`, `require`, `import()`) in `src/**`. Exempt: `src/server/`, `src/http/`, `src/lib/http/`, `packages/*-client/`,
53
+ `/generated/`, service worker files, `app/+html.*`, tests, `data:`/`blob:` URLs, `import type` from axios. Option `{ allow: string[] }`.
54
+ - `apiConfig` flat-config preset (`API_RULE_NAMES`) at `error`; included in `recommendedConfig`.
55
+
56
+ ## [1.7.0] - 2026-10-19
57
+
58
+ NAV-1 "Every game menu works with arrow keys and controller", phase 3.
59
+
60
+ ### Added
61
+
62
+ - `game-menu-focusable`: reports a `click` / `pointerdown` / `pointerup` listener or `onclick =` on an element created as
63
+ `div` / `span` / `li` / `img` whose variable never gets `tabIndex` / `role` (property or `setAttribute`), and every
64
+ `stopPropagation()` inside a `keydown` / `onkeydown` handler (inline, named function or const). No options, no autofix.
65
+ - `gameConfig` flat-config preset (`GAME_RULE_NAMES`): enables `game-menu-focusable` at `error`. Not part of
66
+ `recommendedConfig`; game repos opt in.
67
+
68
+ ### Changed
69
+
70
+ - `testdoc-results.v1.schema.json` copy synced to Dloizides.Testing 7fbf809 (adds the optional `features` array).
71
+
72
+ ## [1.5.0] - 2026-10-07
73
+
74
+ KEFI-ACT-1 "Same attendee actions everywhere" (generalized: one row-action source per entity, every portal).
75
+
76
+ ### Added
77
+
78
+ - `single-row-action-source`: reports `<RowActionGroup actions>` from `@dloizides/ui-buttons` built in the same file
79
+ (inline array, array-bound identifier, `useMemo` returning an array, local builder function, `RowActionSpec[]`
80
+ annotated local). Imported builders/sets and props pass. No options, no autofix.
81
+ - `rowActionsConfig` and `recommendedConfig` flat-config blocks (`recommendedConfig` = comments + row actions, all `error`).
82
+
83
+ ## [1.4.0] - 2026-10-07
84
+
85
+ COMMENTS-1 "No code comments; only short doc comments on public members", decision D-CMT-4 "One-line summary, no call chains".
86
+
87
+ ### Changed
88
+
89
+ - `doc-comment-max-lines`: the description (lines other than `@param` / `@returns`) is capped at ONE line
90
+ (`summaryMaxLines`, default 1), every doc line at 120 chars (`lineMaxChars`), and a line containing an arrow
91
+ (U+2192 or `->`) or starting `Flow:` is reported (`callChain`). Matches `.claude/hooks/review-violations.js` docBlock().
92
+ The 3-line total cap is unchanged. One report per block; banned tags take precedence.
93
+
94
+ ## [1.3.0] - 2026-10-06
95
+
96
+ COMMENTS-1 "No code comments; only short doc comments on public members" (decisions D-CMT-1, D-CMT-3).
97
+
98
+ ### Added
99
+
100
+ - `no-comments`: reports every comment that is not a `/**` doc block and not a tool directive
101
+ (`eslint-*`, `@ts-*`, `prettier-ignore`, `istanbul`/`c8`, `/// <reference>`, `#__PURE__`,
102
+ `webpackChunkName`, shebang). `allow: string[]` adds directive regexes. Suggestion only, no autofix.
103
+ - `doc-comment-public-only`: a doc block must sit on an exported declaration (incl. `export { x }`,
104
+ `export default x`, `module.exports`, ambient `declare module`) or a public member of one;
105
+ `private` / `protected` / `#` members and local declarations are reported.
106
+ - `doc-comment-max-lines`: doc body capped at `max` (default 3) content lines; block tags other than
107
+ `allowedTags` (default `@param`, `@returns`) are reported. JSDoc type-annotation blocks
108
+ (`@type`, `@typedef`, ...) are exempt from both doc rules.
109
+ - `commentsConfig` flat-config block (the three rules at `error`) and `COMMENT_RULE_NAMES`, exported
110
+ from `/eslint`. Not adopted by any app yet: each repo opts in as step 1 of its COMMENTS-CLEAN sweep.
111
+
112
+ ## [1.1.0] - 2026-07-13
113
+
114
+ Both changes come out of the ES-04 (agora-web) build, which surfaced two ways the
115
+ rule pack misbehaved against a freshly scaffolded app.
116
+
117
+ ### Fixed
118
+
119
+ - **`no-null-check`: the autofixer no longer corrupts files.** It rewrote
120
+ `x === undefined` → `!isValueDefined(x)` *without importing `isValueDefined`*,
121
+ so `eslint --fix` emitted source referencing an undeclared global. Running
122
+ `lint:fix` on agora-web rewrote ~20 files and produced 67 `no-unsafe-call` /
123
+ `strict-boolean-expressions` errors. A fixer that produces broken code is worse
124
+ than no fixer — `lint:fix` is the first thing anyone runs.
125
+
126
+ The fixer now inserts `import { isValueDefined } from '@dloizides/utils';` (the
127
+ path is configurable via the pre-existing but previously **unused**
128
+ `utilImportPath` option) when the file has no binding for the guard, and skips
129
+ the autofix entirely in the module that defines or re-exports it. Proven with
130
+ `Linter.verifyAndFix` multipass tests — the actual `--fix` code path.
131
+
132
+ ⚠️ The package's own test suite had *codified* the bug: it asserted the
133
+ import-less output was correct. Those expectations were wrong and are updated.
134
+
135
+ ### Changed
136
+
137
+ - **`smart-max-lines`: `functionWarn` is now opt-in (default: off).** ESLint has
138
+ no per-report severity, so a `functionWarn` report is emitted at the severity
139
+ the *rule* is configured with. Every app configured the rule as `'error'` and
140
+ passed `functionWarn: 30` — which made the real, enforced limit **30 lines**
141
+ while the docs promised **50**. The rule lied about its own threshold.
142
+
143
+ Out of the box the only enforced thresholds are now `componentMax` (200) and
144
+ `functionMax` (50) — exactly what the documentation has always promised.
145
+ `functionWarn` remains available as an explicit *stricter second threshold*,
146
+ and its schema/message now say plainly that it reports at the rule's severity
147
+ rather than as a warning.
148
+
149
+ Migration: drop `functionWarn: 30` from your ESLint config. This only relaxes
150
+ linting (30 → 50), so it cannot introduce new failures.
151
+
152
+ ## [1.0.0] - 2026-06-14
153
+
154
+ ### Added
155
+
156
+ - Initial extraction of the shared RN-web dev tooling duplicated across
157
+ erevna-web, katalogos-web, and kefi-web.
158
+ - **ESLint custom rule pack** (17 rules) exported as `plugin` / `rules` /
159
+ `legacyPlugins`, also available under the `@dloizides/frontend-devtools/eslint`
160
+ subpath. Rule names preserved byte-for-byte so existing config keys and
161
+ `eslint-disable-next-line <rule>` comments keep working:
162
+ `enforce-function-style`, `enforce-module-structure`, `enforce-route-preload`,
163
+ `enforce-test-colocation`, `enum-file-isolation`, `i18n-interpolation`,
164
+ `i18n-param-names`, `no-barrel-companion-file`, `no-duplicate-nav-prefix`,
165
+ `no-duplicate-shared-patterns`, `no-generated-models-barrel-value-import`,
166
+ `no-null-check`, `no-optional-undefined`, `no-product-imports-in-shared`,
167
+ `prefer-const-enum`, `require-stable-hook-args`, `smart-max-lines`.
168
+ - **`initI18n(options)`** — parameterized i18next + react-i18next init factory.
169
+ Carries the `import/no-named-as-default-member` disable so apps stop repeating
170
+ it. The app owns its `locales/*.json` strings and the active language.
@@ -90,7 +90,10 @@ declare const gameConfig: FlatConfig;
90
90
  declare const API_RULE_NAMES: readonly string[];
91
91
  /** PAT-API-1: the backend is called through the shared client or generated hooks, never raw fetch/axios. */
92
92
  declare const apiConfig: FlatConfig;
93
+ declare const REUSE_RULE_NAMES: readonly string[];
94
+ /** QUAL-ADOPT-1: app code may not re-implement a capability a shared @dloizides package provides. Opt-in. */
95
+ declare const reuseConfig: FlatConfig;
93
96
  /** The recommended flat-config block: every rule the pack enables by default, at error. */
94
97
  declare const recommendedConfig: FlatConfig;
95
98
 
96
- export { API_RULE_NAMES, COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, rowActionsConfig, ruleNames, rules };
99
+ export { API_RULE_NAMES, COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
@@ -90,7 +90,10 @@ declare const gameConfig: FlatConfig;
90
90
  declare const API_RULE_NAMES: readonly string[];
91
91
  /** PAT-API-1: the backend is called through the shared client or generated hooks, never raw fetch/axios. */
92
92
  declare const apiConfig: FlatConfig;
93
+ declare const REUSE_RULE_NAMES: readonly string[];
94
+ /** QUAL-ADOPT-1: app code may not re-implement a capability a shared @dloizides package provides. Opt-in. */
95
+ declare const reuseConfig: FlatConfig;
93
96
  /** The recommended flat-config block: every rule the pack enables by default, at error. */
94
97
  declare const recommendedConfig: FlatConfig;
95
98
 
96
- export { API_RULE_NAMES, COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, rowActionsConfig, ruleNames, rules };
99
+ export { API_RULE_NAMES, COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
@@ -2143,6 +2143,103 @@ var no_raw_color_literal_default = {
2143
2143
  }
2144
2144
  };
2145
2145
 
2146
+ // src/rules/reimplemented-packages-registry.js
2147
+ var REIMPLEMENTED_PACKAGE_REGISTRY = [
2148
+ {
2149
+ id: "analytics",
2150
+ package: "@dloizides/analytics-web",
2151
+ use: "createAnalytics, track, createWebVitals",
2152
+ paths: [/\/src\/lib\/analytics\//, /\/UmamiClient\.[cm]?[jt]sx?$/, /\/MultiProviderClient\.[cm]?[jt]sx?$/, /\/useWebVitalsTracking\.[cm]?[jt]sx?$/],
2153
+ literals: []
2154
+ },
2155
+ {
2156
+ id: "bff-csrf",
2157
+ package: "@dloizides/bff-web-client",
2158
+ use: "createBffAxiosClient (default CSRF interceptor)",
2159
+ paths: [/\/bffCsrf\.[cm]?[jt]sx?$/],
2160
+ literals: [/^X-BFF-Csrf$/i]
2161
+ },
2162
+ {
2163
+ id: "forgot-password",
2164
+ package: "@dloizides/auth-web",
2165
+ use: "useBffForgotPassword, ForgotPasswordForm",
2166
+ paths: [/\/forgotPasswordRequest\.[cm]?[jt]sx?$/],
2167
+ literals: []
2168
+ },
2169
+ {
2170
+ id: "logger",
2171
+ package: "@dloizides/logging-web",
2172
+ use: "logger, LoggingService",
2173
+ paths: [/\/src\/(?:lib\/)?utils\/logger\.[cm]?[jt]sx?$/],
2174
+ literals: []
2175
+ }
2176
+ ];
2177
+
2178
+ // src/rules/no-reimplemented-package.js
2179
+ var TEST_FILE2 = /(?:\.(?:test|spec)\.[cm]?[jt]sx?$)|(?:\/__tests__\/)|(?:\/e2e\/)/;
2180
+ var SHARED_SOURCE = /\/(?:NpmPackages\/packages|node_modules)\//;
2181
+ function normalisePath2(filename) {
2182
+ return typeof filename === "string" ? filename.split("\\").join("/") : "";
2183
+ }
2184
+ function isExemptFile2(path2, allow) {
2185
+ if (!path2.includes("/src/")) return true;
2186
+ if (TEST_FILE2.test(path2) || SHARED_SOURCE.test(path2)) return true;
2187
+ return allow.some((fragment) => path2.includes(fragment));
2188
+ }
2189
+ function literalText(node) {
2190
+ if (node.type === "Literal") return typeof node.value === "string" ? node.value : "";
2191
+ return node.quasis.length === 1 ? node.quasis[0].value.cooked ?? "" : "";
2192
+ }
2193
+ var noReimplementedPackageRule = {
2194
+ meta: {
2195
+ type: "problem",
2196
+ docs: {
2197
+ description: "Flag app code that re-implements a capability a shared @dloizides package already provides.",
2198
+ recommended: false
2199
+ },
2200
+ schema: [
2201
+ {
2202
+ type: "object",
2203
+ properties: { allow: { type: "array", items: { type: "string" } } },
2204
+ additionalProperties: false
2205
+ }
2206
+ ],
2207
+ messages: {
2208
+ reimplemented: "This re-implements {{package}} ({{id}}). Use {{use}} from {{package}} instead (QUAL-ADOPT-1)."
2209
+ }
2210
+ },
2211
+ create(context) {
2212
+ const options = context.options[0] ?? {};
2213
+ const path2 = normalisePath2(context.filename ?? context.getFilename());
2214
+ if (isExemptFile2(path2, options.allow ?? [])) return {};
2215
+ const reported = /* @__PURE__ */ new Set();
2216
+ const report = (node, entry) => {
2217
+ if (reported.has(entry.id)) return;
2218
+ reported.add(entry.id);
2219
+ context.report({ node, messageId: "reimplemented", data: { id: entry.id, package: entry.package, use: entry.use } });
2220
+ };
2221
+ const checkLiteral = (node) => {
2222
+ const text = literalText(node);
2223
+ if (text === "") return;
2224
+ for (const entry of REIMPLEMENTED_PACKAGE_REGISTRY)
2225
+ if (entry.literals.some((pattern) => pattern.test(text))) report(node, entry);
2226
+ };
2227
+ return {
2228
+ Program(node) {
2229
+ for (const entry of REIMPLEMENTED_PACKAGE_REGISTRY)
2230
+ if (entry.paths.some((pattern) => pattern.test(path2))) report(node, entry);
2231
+ },
2232
+ Literal: checkLiteral,
2233
+ TemplateLiteral: checkLiteral
2234
+ };
2235
+ }
2236
+ };
2237
+ var no_reimplemented_package_default = {
2238
+ rules: {
2239
+ "no-reimplemented-package": noReimplementedPackageRule
2240
+ }
2241
+ };
2242
+
2146
2243
  // src/rules/prefer-const-enum.js
2147
2244
  function toPascalCase(value) {
2148
2245
  const words = value.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[-_\s]+/).filter((w) => w.length > 0);
@@ -2214,17 +2311,17 @@ var prefer_const_enum_default = {
2214
2311
 
2215
2312
  // src/rules/query-key-factory.js
2216
2313
  var QUERY_KEY = "queryKey";
2217
- var TEST_FILE2 = /(?:\.(?:test|spec)\.[cm]?[jt]sx?$)|(?:\/__tests__\/)/;
2314
+ var TEST_FILE3 = /(?:\.(?:test|spec)\.[cm]?[jt]sx?$)|(?:\/__tests__\/)/;
2218
2315
  var FACTORY_FILE = /[kK]eys?(?:Factory)?\.[cm]?[jt]sx?$/;
2219
2316
  var DEFAULT_ALLOWED_PATH_FRAGMENTS2 = ["/generated/", "/autoGeneratedHooks/"];
2220
2317
  var INLINE_KEY_TYPES = /* @__PURE__ */ new Set(["ArrayExpression", "Literal", "TemplateLiteral"]);
2221
2318
  var TYPE_WRAPPERS = /* @__PURE__ */ new Set(["TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression"]);
2222
- function normalisePath2(filename) {
2319
+ function normalisePath3(filename) {
2223
2320
  return typeof filename === "string" ? filename.split("\\").join("/") : "";
2224
2321
  }
2225
- function isExemptFile2(filename, allow) {
2226
- const path2 = normalisePath2(filename);
2227
- if (TEST_FILE2.test(path2)) return true;
2322
+ function isExemptFile3(filename, allow) {
2323
+ const path2 = normalisePath3(filename);
2324
+ if (TEST_FILE3.test(path2)) return true;
2228
2325
  if (FACTORY_FILE.test(path2)) return true;
2229
2326
  return [...DEFAULT_ALLOWED_PATH_FRAGMENTS2, ...allow].some((fragment) => path2.includes(fragment));
2230
2327
  }
@@ -2259,7 +2356,7 @@ var rule4 = {
2259
2356
  const options = context.options[0] ?? {};
2260
2357
  const allow = Array.isArray(options.allow) ? options.allow : [];
2261
2358
  const filename = context.filename ?? context.getFilename();
2262
- if (isExemptFile2(filename, allow)) return {};
2359
+ if (isExemptFile3(filename, allow)) return {};
2263
2360
  return {
2264
2361
  Property(node) {
2265
2362
  if (!isQueryKeyProperty(node)) return;
@@ -2953,6 +3050,7 @@ var ruleModules = [
2953
3050
  no_product_imports_in_shared_default,
2954
3051
  no_raw_backend_fetch_default,
2955
3052
  no_raw_color_literal_default,
3053
+ no_reimplemented_package_default,
2956
3054
  prefer_const_enum_default,
2957
3055
  query_key_factory_default,
2958
3056
  require_stable_hook_args_default,
@@ -3071,6 +3169,13 @@ var apiConfig = {
3071
3169
  "@dloizides/no-raw-backend-fetch": "error"
3072
3170
  }
3073
3171
  };
3172
+ var REUSE_RULE_NAMES = ["no-reimplemented-package"];
3173
+ var reuseConfig = {
3174
+ plugins: commentsConfig.plugins,
3175
+ rules: {
3176
+ "@dloizides/no-reimplemented-package": "error"
3177
+ }
3178
+ };
3074
3179
  var recommendedConfig = {
3075
3180
  plugins: commentsConfig.plugins,
3076
3181
  rules: { ...commentsConfig.rules, ...rowActionsConfig.rules, ...apiConfig.rules }
@@ -3080,6 +3185,7 @@ exports.API_RULE_NAMES = API_RULE_NAMES;
3080
3185
  exports.COMMENT_RULE_NAMES = COMMENT_RULE_NAMES;
3081
3186
  exports.GAME_RULE_NAMES = GAME_RULE_NAMES;
3082
3187
  exports.HOUSE_PATTERN_RULE_NAMES = HOUSE_PATTERN_RULE_NAMES;
3188
+ exports.REUSE_RULE_NAMES = REUSE_RULE_NAMES;
3083
3189
  exports.ROW_ACTION_RULE_NAMES = ROW_ACTION_RULE_NAMES;
3084
3190
  exports.apiConfig = apiConfig;
3085
3191
  exports.commentsConfig = commentsConfig;
@@ -3088,6 +3194,7 @@ exports.legacyPlugins = legacyPlugins;
3088
3194
  exports.patternPacksConfig = patternPacksConfig;
3089
3195
  exports.plugin = plugin;
3090
3196
  exports.recommendedConfig = recommendedConfig;
3197
+ exports.reuseConfig = reuseConfig;
3091
3198
  exports.rowActionsConfig = rowActionsConfig;
3092
3199
  exports.ruleNames = ruleNames;
3093
3200
  exports.rules = rules;