@dloizides/frontend-devtools 1.10.0 → 2.0.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,153 +1,162 @@
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
- ## [1.10.0] - 2026-10-19
9
-
10
- PATTERN-1.12 "TS rule packs + house rules in frontend-devtools" (D-PAT-12 "Whole rule packs as warnings, one shared approach").
11
-
12
- ### Added
13
- - `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.
14
- - `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.
15
- - `HOUSE_PATTERN_RULE_NAMES`.
16
-
17
- ## [1.9.0] - 2026-10-19
18
-
19
- 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.
20
-
21
- ### Changed
22
- - `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`).
23
- - `no-raw-backend-fetch` registers no visitors when the parsed AST is not an ESTree `Program` (non-JS languages under an unscoped `apiConfig`).
24
-
25
- ### Tests
26
- - `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/`.
27
-
28
- ## [1.8.0] - 2026-10-19
29
-
30
- PATTERN-1.4 "TypeScript pattern rules as ESLint rules", row PAT-API-1 "web apps call the backend through the shared client".
31
-
32
- ### Added
33
-
34
- - `no-raw-backend-fetch`: reports `fetch(` / `window.fetch(` / `globalThis.fetch(` / `self.fetch(` and value imports of `axios`
35
- (`import`, `require`, `import()`) in `src/**`. Exempt: `src/server/`, `src/http/`, `src/lib/http/`, `packages/*-client/`,
36
- `/generated/`, service worker files, `app/+html.*`, tests, `data:`/`blob:` URLs, `import type` from axios. Option `{ allow: string[] }`.
37
- - `apiConfig` flat-config preset (`API_RULE_NAMES`) at `error`; included in `recommendedConfig`.
38
-
39
- ## [1.7.0] - 2026-10-19
40
-
41
- NAV-1 "Every game menu works with arrow keys and controller", phase 3.
42
-
43
- ### Added
44
-
45
- - `game-menu-focusable`: reports a `click` / `pointerdown` / `pointerup` listener or `onclick =` on an element created as
46
- `div` / `span` / `li` / `img` whose variable never gets `tabIndex` / `role` (property or `setAttribute`), and every
47
- `stopPropagation()` inside a `keydown` / `onkeydown` handler (inline, named function or const). No options, no autofix.
48
- - `gameConfig` flat-config preset (`GAME_RULE_NAMES`): enables `game-menu-focusable` at `error`. Not part of
49
- `recommendedConfig`; game repos opt in.
50
-
51
- ### Changed
52
-
53
- - `testdoc-results.v1.schema.json` copy synced to Dloizides.Testing 7fbf809 (adds the optional `features` array).
54
-
55
- ## [1.5.0] - 2026-10-07
56
-
57
- KEFI-ACT-1 "Same attendee actions everywhere" (generalized: one row-action source per entity, every portal).
58
-
59
- ### Added
60
-
61
- - `single-row-action-source`: reports `<RowActionGroup actions>` from `@dloizides/ui-buttons` built in the same file
62
- (inline array, array-bound identifier, `useMemo` returning an array, local builder function, `RowActionSpec[]`
63
- annotated local). Imported builders/sets and props pass. No options, no autofix.
64
- - `rowActionsConfig` and `recommendedConfig` flat-config blocks (`recommendedConfig` = comments + row actions, all `error`).
65
-
66
- ## [1.4.0] - 2026-10-07
67
-
68
- COMMENTS-1 "No code comments; only short doc comments on public members", decision D-CMT-4 "One-line summary, no call chains".
69
-
70
- ### Changed
71
-
72
- - `doc-comment-max-lines`: the description (lines other than `@param` / `@returns`) is capped at ONE line
73
- (`summaryMaxLines`, default 1), every doc line at 120 chars (`lineMaxChars`), and a line containing an arrow
74
- (U+2192 or `->`) or starting `Flow:` is reported (`callChain`). Matches `.claude/hooks/review-violations.js` docBlock().
75
- The 3-line total cap is unchanged. One report per block; banned tags take precedence.
76
-
77
- ## [1.3.0] - 2026-10-06
78
-
79
- COMMENTS-1 "No code comments; only short doc comments on public members" (decisions D-CMT-1, D-CMT-3).
80
-
81
- ### Added
82
-
83
- - `no-comments`: reports every comment that is not a `/**` doc block and not a tool directive
84
- (`eslint-*`, `@ts-*`, `prettier-ignore`, `istanbul`/`c8`, `/// <reference>`, `#__PURE__`,
85
- `webpackChunkName`, shebang). `allow: string[]` adds directive regexes. Suggestion only, no autofix.
86
- - `doc-comment-public-only`: a doc block must sit on an exported declaration (incl. `export { x }`,
87
- `export default x`, `module.exports`, ambient `declare module`) or a public member of one;
88
- `private` / `protected` / `#` members and local declarations are reported.
89
- - `doc-comment-max-lines`: doc body capped at `max` (default 3) content lines; block tags other than
90
- `allowedTags` (default `@param`, `@returns`) are reported. JSDoc type-annotation blocks
91
- (`@type`, `@typedef`, ...) are exempt from both doc rules.
92
- - `commentsConfig` flat-config block (the three rules at `error`) and `COMMENT_RULE_NAMES`, exported
93
- from `/eslint`. Not adopted by any app yet: each repo opts in as step 1 of its COMMENTS-CLEAN sweep.
94
-
95
- ## [1.1.0] - 2026-07-13
96
-
97
- Both changes come out of the ES-04 (agora-web) build, which surfaced two ways the
98
- rule pack misbehaved against a freshly scaffolded app.
99
-
100
- ### Fixed
101
-
102
- - **`no-null-check`: the autofixer no longer corrupts files.** It rewrote
103
- `x === undefined` → `!isValueDefined(x)` *without importing `isValueDefined`*,
104
- so `eslint --fix` emitted source referencing an undeclared global. Running
105
- `lint:fix` on agora-web rewrote ~20 files and produced 67 `no-unsafe-call` /
106
- `strict-boolean-expressions` errors. A fixer that produces broken code is worse
107
- than no fixer — `lint:fix` is the first thing anyone runs.
108
-
109
- The fixer now inserts `import { isValueDefined } from '@dloizides/utils';` (the
110
- path is configurable via the pre-existing but previously **unused**
111
- `utilImportPath` option) when the file has no binding for the guard, and skips
112
- the autofix entirely in the module that defines or re-exports it. Proven with
113
- `Linter.verifyAndFix` multipass tests — the actual `--fix` code path.
114
-
115
- ⚠️ The package's own test suite had *codified* the bug: it asserted the
116
- import-less output was correct. Those expectations were wrong and are updated.
117
-
118
- ### Changed
119
-
120
- - **`smart-max-lines`: `functionWarn` is now opt-in (default: off).** ESLint has
121
- no per-report severity, so a `functionWarn` report is emitted at the severity
122
- the *rule* is configured with. Every app configured the rule as `'error'` and
123
- passed `functionWarn: 30` — which made the real, enforced limit **30 lines**
124
- while the docs promised **50**. The rule lied about its own threshold.
125
-
126
- Out of the box the only enforced thresholds are now `componentMax` (200) and
127
- `functionMax` (50) — exactly what the documentation has always promised.
128
- `functionWarn` remains available as an explicit *stricter second threshold*,
129
- and its schema/message now say plainly that it reports at the rule's severity
130
- rather than as a warning.
131
-
132
- Migration: drop `functionWarn: 30` from your ESLint config. This only relaxes
133
- linting (30 → 50), so it cannot introduce new failures.
134
-
135
- ## [1.0.0] - 2026-06-14
136
-
137
- ### Added
138
-
139
- - Initial extraction of the shared RN-web dev tooling duplicated across
140
- erevna-web, katalogos-web, and kefi-web.
141
- - **ESLint custom rule pack** (17 rules) exported as `plugin` / `rules` /
142
- `legacyPlugins`, also available under the `@dloizides/frontend-devtools/eslint`
143
- subpath. Rule names preserved byte-for-byte so existing config keys and
144
- `eslint-disable-next-line <rule>` comments keep working:
145
- `enforce-function-style`, `enforce-module-structure`, `enforce-route-preload`,
146
- `enforce-test-colocation`, `enum-file-isolation`, `i18n-interpolation`,
147
- `i18n-param-names`, `no-barrel-companion-file`, `no-duplicate-nav-prefix`,
148
- `no-duplicate-shared-patterns`, `no-generated-models-barrel-value-import`,
149
- `no-null-check`, `no-optional-undefined`, `no-product-imports-in-shared`,
150
- `prefer-const-enum`, `require-stable-hook-args`, `smart-max-lines`.
151
- - **`initI18n(options)`** — parameterized i18next + react-i18next init factory.
152
- Carries the `import/no-named-as-default-member` disable so apps stop repeating
153
- 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.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.
package/README.md CHANGED
@@ -6,11 +6,10 @@ product-agnostic concerns that were duplicated byte-for-byte across
6
6
 
7
7
  1. The **custom ESLint rule pack** (17 rules) — previously 17 identical
8
8
  `eslint-plugins/*.mjs` files in each app.
9
- 2. **`initI18n()`** — the parameterized i18next + react-i18next init factory —
10
- previously an identical `src/localization/i18n.ts` in each app.
9
+ 2. **`initI18n()` moved to `@dloizides/i18n` in 2.0.0** — this package is dev-only:
10
+ `import { initI18n } from '@dloizides/i18n';` (same signature).
11
11
 
12
- > **Decoupling:** the package owns the *logic* (rule implementations + the
13
- > i18next `.use().init()` chain). Each app owns its *config* — which rules it
12
+ > **Decoupling:** the package owns the *logic* (rule implementations). Each app owns its *config* — which rules it
14
13
  > enables and with what options, plus its own `locales/*.json` strings.
15
14
  > This package **never imports a product**.
16
15
 
@@ -20,12 +19,12 @@ product-agnostic concerns that were duplicated byte-for-byte across
20
19
  npm install -D @dloizides/frontend-devtools
21
20
  ```
22
21
 
23
- `eslint`, `i18next`, and `react-i18next` are optional peer dependencies — apps
24
- that only use one half don't need the other's peers.
22
+ `eslint` is an optional peer dependency. There is no root entry since 2.0.0: import from
23
+ `@dloizides/frontend-devtools/eslint` or `@dloizides/frontend-devtools/test-results`.
25
24
 
26
25
  ## ESLint rule pack
27
26
 
28
- Import from the root or the `/eslint` subpath. Three shapes are exported:
27
+ Import from the `/eslint` subpath. Three shapes are exported:
29
28
 
30
29
  | Export | Use when |
31
30
  | --- | --- |
@@ -136,38 +135,14 @@ by `recommendedConfig` and `rowActionsConfig`.
136
135
  `ruleNames` exports the sorted list for migration assertions (prove no rule was
137
136
  dropped).
138
137
 
139
- ## i18n init factory
138
+ ## i18n init factory — moved
140
139
 
141
- ```ts
142
- // src/localization/i18n.ts
143
- import { initI18n } from '@dloizides/frontend-devtools';
144
- import * as Localization from 'expo-localization';
145
- import en from './locales/en.json';
146
-
147
- const i18n = initI18n({
148
- resources: { en: { translation: en } },
149
- lng: Localization.getLocales()[0]?.languageCode, // optional; defaults to fallback
150
- });
140
+ `initI18n` and `InitI18nOptions` live in `@dloizides/i18n` (>= 1.1.0) since 2.0.0:
151
141
 
152
- export default i18n;
142
+ ```ts
143
+ import { initI18n } from '@dloizides/i18n';
153
144
  ```
154
145
 
155
- ### `InitI18nOptions`
156
-
157
- | Field | Type | Default | Notes |
158
- | --- | --- | --- | --- |
159
- | `resources` | `Resource` | — (required) | App-owned strings bundle. |
160
- | `lng` | `string` | `fallbackLng` | Active language. |
161
- | `fallbackLng` | `string` | `'en'` | Fallback for missing keys. |
162
- | `escapeValue` | `boolean` | `false` | React already escapes output. |
163
- | `defaultNS` | `string \| string[]` | i18next default | Optional. |
164
- | `ns` | `string \| string[]` | — | Optional; for multi-namespace apps. |
165
-
166
- The factory wires `react-i18next` into the i18next singleton, runs `.init()`,
167
- swallows the (synchronous-for-in-memory) init rejection, and returns the
168
- singleton. The `FM()` / `FD()` helpers + `locales/*.json` stay **app-owned**
169
- (per the SaaS code standards).
170
-
171
146
  ## Scripts
172
147
 
173
148
  | Script | What |
package/package.json CHANGED
@@ -1,12 +1,10 @@
1
1
  {
2
2
  "name": "@dloizides/frontend-devtools",
3
- "version": "1.10.0",
4
- "description": "Shared RN-web dev tooling for the dloizides.com SaaS frontends: the 17-rule custom ESLint plugin pack (also at the /eslint subpath) and the parameterized initI18n() i18next + react-i18next init factory. Owned shape erevna-web / katalogos-web / kefi-web shared byte-for-byte; never imports a product.",
3
+ "version": "2.0.0",
4
+ "description": "Shared RN-web dev tooling (dev-only) for the dloizides.com SaaS frontends: the custom ESLint plugin pack and rule packs (/eslint) and the test-results reporters (/test-results). initI18n moved to @dloizides/i18n in 2.0.0. Never imports a product.",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "eslint-plugin",
8
- "i18next",
9
- "react-i18next",
10
8
  "react-native",
11
9
  "dev-tooling",
12
10
  "dloizides"
@@ -26,20 +24,7 @@
26
24
  "README.md",
27
25
  "CHANGELOG.md"
28
26
  ],
29
- "main": "./dist/index.js",
30
- "module": "./dist/index.mjs",
31
- "types": "./dist/index.d.ts",
32
27
  "exports": {
33
- ".": {
34
- "require": {
35
- "types": "./dist/index.d.ts",
36
- "default": "./dist/index.js"
37
- },
38
- "import": {
39
- "types": "./dist/index.d.mts",
40
- "default": "./dist/index.mjs"
41
- }
42
- },
43
28
  "./eslint": {
44
29
  "require": {
45
30
  "types": "./dist/eslint/index.d.ts",
@@ -98,24 +83,16 @@
98
83
  "security:audit": "npm audit --audit-level=high",
99
84
  "deps:outdated": "npm outdated || exit 0",
100
85
  "deps:unused": "npx depcheck --ignores \"@types/jest,@types/node,rimraf,@typescript-eslint/parser\"",
101
- "deps:licenses": "npx license-checker --onlyAllow \"MIT;Apache-2.0;ISC;BSD-2-Clause;BSD-3-Clause;0BSD;Unlicense;CC0-1.0\"",
86
+ "deps:licenses": "npx license-checker --onlyAllow \"MIT;Apache-2.0;ISC;BSD-2-Clause;BSD-3-Clause;0BSD;Unlicense;CC0-1.0;CC-BY-3.0;CC-BY-4.0;Python-2.0;BlueOak-1.0.0;LGPL-3.0;LGPL-3.0-only;LGPL-3.0-or-later\"",
102
87
  "deps:health": "npm run deps:outdated && npm run deps:unused",
103
88
  "prepublishOnly": "npm run clean && npm run build && npm run test"
104
89
  },
105
90
  "peerDependencies": {
106
- "eslint": ">=8.0.0",
107
- "i18next": ">=23.0.0",
108
- "react-i18next": ">=13.0.0"
91
+ "eslint": ">=8.0.0"
109
92
  },
110
93
  "peerDependenciesMeta": {
111
94
  "eslint": {
112
95
  "optional": true
113
- },
114
- "i18next": {
115
- "optional": true
116
- },
117
- "react-i18next": {
118
- "optional": true
119
96
  }
120
97
  },
121
98
  "devDependencies": {
@@ -128,11 +105,9 @@
128
105
  "ajv-formats": "^3.0.1",
129
106
  "eslint": "^8.57.0",
130
107
  "eslint-plugin-import": "^2.32.0",
131
- "i18next": "^23.0.0",
132
108
  "jest": "^29.7.0",
133
109
  "jest-environment-jsdom": "^29.7.0",
134
110
  "react": "^18.0.0",
135
- "react-i18next": "^13.0.0",
136
111
  "rimraf": "^5.0.0",
137
112
  "ts-jest": "^29.1.0",
138
113
  "tsup": "^8.0.0",
package/dist/index.d.mts DELETED
@@ -1,69 +0,0 @@
1
- import { Resource, i18n } from 'i18next';
2
-
3
- /**
4
- * Options for {@link initI18n}.
5
- *
6
- * Everything app-specific (the strings, the locales, the fallback language and
7
- * the active language) is passed in — the package owns only the init *chain*.
8
- */
9
- interface InitI18nOptions {
10
- /**
11
- * The i18next resource bundle, e.g. `{ en: { translation: en } }`.
12
- * The app owns its own `locales/*.json` — only the init logic is shared.
13
- */
14
- resources: Resource;
15
- /**
16
- * The active language. Apps typically derive this from device locale,
17
- * e.g. `expo-localization`'s `getLocales()[0]?.languageCode`.
18
- *
19
- * When omitted (or undefined), defaults to {@link fallbackLng}.
20
- */
21
- lng?: string;
22
- /**
23
- * The fallback language used when a key is missing in {@link lng}.
24
- * Defaults to `'en'`.
25
- */
26
- fallbackLng?: string;
27
- /**
28
- * Whether to escape interpolated values. React already escapes output, so
29
- * the SaaS apps run with `escapeValue: false`. Defaults to `false`.
30
- */
31
- escapeValue?: boolean;
32
- /**
33
- * Default namespace(s). i18next's default is `'translation'`; the SaaS apps
34
- * keep that single-namespace convention, so this is optional.
35
- */
36
- defaultNS?: string | readonly string[];
37
- /**
38
- * Namespace list. Optional — only needed when the app splits strings across
39
- * multiple namespaces. Single-namespace apps can omit it.
40
- */
41
- ns?: string | readonly string[];
42
- }
43
- /**
44
- * Initialize the shared i18next + react-i18next singleton.
45
- *
46
- * This is the parameterized factory that replaces the per-app `i18n.ts`. It
47
- * wires `react-i18next` into the i18next singleton and runs `.init()` with the
48
- * app-supplied resources/language, swallowing the async init rejection the same
49
- * way every app did (i18next resolves synchronously for in-memory resources).
50
- *
51
- * The returned value is the i18next singleton — apps `export default` it and
52
- * call `.t()` through their own `FM()` helper.
53
- *
54
- * @example
55
- * ```ts
56
- * import { initI18n } from '@dloizides/frontend-devtools';
57
- * import * as Localization from 'expo-localization';
58
- * import en from './locales/en.json';
59
- *
60
- * const i18n = initI18n({
61
- * resources: { en: { translation: en } },
62
- * lng: Localization.getLocales()[0]?.languageCode,
63
- * });
64
- * export default i18n;
65
- * ```
66
- */
67
- declare function initI18n(options: InitI18nOptions): i18n;
68
-
69
- export { type InitI18nOptions, initI18n };
package/dist/index.d.ts DELETED
@@ -1,69 +0,0 @@
1
- import { Resource, i18n } from 'i18next';
2
-
3
- /**
4
- * Options for {@link initI18n}.
5
- *
6
- * Everything app-specific (the strings, the locales, the fallback language and
7
- * the active language) is passed in — the package owns only the init *chain*.
8
- */
9
- interface InitI18nOptions {
10
- /**
11
- * The i18next resource bundle, e.g. `{ en: { translation: en } }`.
12
- * The app owns its own `locales/*.json` — only the init logic is shared.
13
- */
14
- resources: Resource;
15
- /**
16
- * The active language. Apps typically derive this from device locale,
17
- * e.g. `expo-localization`'s `getLocales()[0]?.languageCode`.
18
- *
19
- * When omitted (or undefined), defaults to {@link fallbackLng}.
20
- */
21
- lng?: string;
22
- /**
23
- * The fallback language used when a key is missing in {@link lng}.
24
- * Defaults to `'en'`.
25
- */
26
- fallbackLng?: string;
27
- /**
28
- * Whether to escape interpolated values. React already escapes output, so
29
- * the SaaS apps run with `escapeValue: false`. Defaults to `false`.
30
- */
31
- escapeValue?: boolean;
32
- /**
33
- * Default namespace(s). i18next's default is `'translation'`; the SaaS apps
34
- * keep that single-namespace convention, so this is optional.
35
- */
36
- defaultNS?: string | readonly string[];
37
- /**
38
- * Namespace list. Optional — only needed when the app splits strings across
39
- * multiple namespaces. Single-namespace apps can omit it.
40
- */
41
- ns?: string | readonly string[];
42
- }
43
- /**
44
- * Initialize the shared i18next + react-i18next singleton.
45
- *
46
- * This is the parameterized factory that replaces the per-app `i18n.ts`. It
47
- * wires `react-i18next` into the i18next singleton and runs `.init()` with the
48
- * app-supplied resources/language, swallowing the async init rejection the same
49
- * way every app did (i18next resolves synchronously for in-memory resources).
50
- *
51
- * The returned value is the i18next singleton — apps `export default` it and
52
- * call `.t()` through their own `FM()` helper.
53
- *
54
- * @example
55
- * ```ts
56
- * import { initI18n } from '@dloizides/frontend-devtools';
57
- * import * as Localization from 'expo-localization';
58
- * import en from './locales/en.json';
59
- *
60
- * const i18n = initI18n({
61
- * resources: { en: { translation: en } },
62
- * lng: Localization.getLocales()[0]?.languageCode,
63
- * });
64
- * export default i18n;
65
- * ```
66
- */
67
- declare function initI18n(options: InitI18nOptions): i18n;
68
-
69
- export { type InitI18nOptions, initI18n };
package/dist/index.js DELETED
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- var i18n = require('i18next');
4
- var reactI18next = require('react-i18next');
5
-
6
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
-
8
- var i18n__default = /*#__PURE__*/_interopDefault(i18n);
9
-
10
- // src/i18n/initI18n.ts
11
- var DEFAULT_FALLBACK_LNG = "en";
12
- function initI18n(options) {
13
- const {
14
- resources,
15
- lng,
16
- fallbackLng = DEFAULT_FALLBACK_LNG,
17
- escapeValue = false,
18
- defaultNS,
19
- ns
20
- } = options;
21
- i18n__default.default.use(reactI18next.initReactI18next).init({
22
- lng: lng ?? fallbackLng,
23
- fallbackLng,
24
- resources,
25
- ...defaultNS !== void 0 ? { defaultNS } : {},
26
- ...ns !== void 0 ? { ns } : {},
27
- interpolation: {
28
- escapeValue
29
- }
30
- }).catch(() => {
31
- });
32
- return i18n__default.default;
33
- }
34
-
35
- exports.initI18n = initI18n;
36
- //# sourceMappingURL=index.js.map
37
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/i18n/initI18n.ts"],"names":["i18n","initReactI18next"],"mappings":";;;;;;;;;;AAsDA,IAAM,oBAAA,GAAuB,IAAA;AA0BtB,SAAS,SAAS,OAAA,EAAwC;AAC/D,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,GAAA;AAAA,IACA,WAAA,GAAc,oBAAA;AAAA,IACd,WAAA,GAAc,KAAA;AAAA,IACd,SAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAEJ,EAAAA,qBAAA,CACG,GAAA,CAAIC,6BAAgB,CAAA,CACpB,IAAA,CAAK;AAAA,IACJ,KAAK,GAAA,IAAO,WAAA;AAAA,IACZ,WAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAI,SAAA,KAAc,MAAA,GAAY,EAAE,SAAA,KAAc,EAAC;AAAA,IAC/C,GAAI,EAAA,KAAO,MAAA,GAAY,EAAE,EAAA,KAAO,EAAC;AAAA,IACjC,aAAA,EAAe;AAAA,MACb;AAAA;AACF,GACD,CAAA,CACA,KAAA,CAAM,MAAM;AAAA,EAGb,CAAC,CAAA;AAEH,EAAA,OAAOD,qBAAA;AACT","file":"index.js","sourcesContent":["// i18next's default export is the configurable singleton; `.use()` / `.init()`\n// are members on it — this is the documented i18next initialization pattern,\n// which trips `import/no-named-as-default-member` for the whole fluent chain.\n// The disable is owned by the package so the consuming apps don't repeat it.\n/* eslint-disable import/no-named-as-default-member */\nimport i18n, { type i18n as I18nInstance, type Resource } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\n/**\n * Options for {@link initI18n}.\n *\n * Everything app-specific (the strings, the locales, the fallback language and\n * the active language) is passed in — the package owns only the init *chain*.\n */\nexport interface InitI18nOptions {\n /**\n * The i18next resource bundle, e.g. `{ en: { translation: en } }`.\n * The app owns its own `locales/*.json` — only the init logic is shared.\n */\n resources: Resource;\n\n /**\n * The active language. Apps typically derive this from device locale,\n * e.g. `expo-localization`'s `getLocales()[0]?.languageCode`.\n *\n * When omitted (or undefined), defaults to {@link fallbackLng}.\n */\n lng?: string;\n\n /**\n * The fallback language used when a key is missing in {@link lng}.\n * Defaults to `'en'`.\n */\n fallbackLng?: string;\n\n /**\n * Whether to escape interpolated values. React already escapes output, so\n * the SaaS apps run with `escapeValue: false`. Defaults to `false`.\n */\n escapeValue?: boolean;\n\n /**\n * Default namespace(s). i18next's default is `'translation'`; the SaaS apps\n * keep that single-namespace convention, so this is optional.\n */\n defaultNS?: string | readonly string[];\n\n /**\n * Namespace list. Optional — only needed when the app splits strings across\n * multiple namespaces. Single-namespace apps can omit it.\n */\n ns?: string | readonly string[];\n}\n\nconst DEFAULT_FALLBACK_LNG = 'en';\n\n/**\n * Initialize the shared i18next + react-i18next singleton.\n *\n * This is the parameterized factory that replaces the per-app `i18n.ts`. It\n * wires `react-i18next` into the i18next singleton and runs `.init()` with the\n * app-supplied resources/language, swallowing the async init rejection the same\n * way every app did (i18next resolves synchronously for in-memory resources).\n *\n * The returned value is the i18next singleton — apps `export default` it and\n * call `.t()` through their own `FM()` helper.\n *\n * @example\n * ```ts\n * import { initI18n } from '@dloizides/frontend-devtools';\n * import * as Localization from 'expo-localization';\n * import en from './locales/en.json';\n *\n * const i18n = initI18n({\n * resources: { en: { translation: en } },\n * lng: Localization.getLocales()[0]?.languageCode,\n * });\n * export default i18n;\n * ```\n */\nexport function initI18n(options: InitI18nOptions): I18nInstance {\n const {\n resources,\n lng,\n fallbackLng = DEFAULT_FALLBACK_LNG,\n escapeValue = false,\n defaultNS,\n ns,\n } = options;\n\n i18n\n .use(initReactI18next)\n .init({\n lng: lng ?? fallbackLng,\n fallbackLng,\n resources,\n ...(defaultNS !== undefined ? { defaultNS } : {}),\n ...(ns !== undefined ? { ns } : {}),\n interpolation: {\n escapeValue,\n },\n })\n .catch(() => {\n // i18next resolves synchronously for in-memory resources; the apps have\n // always swallowed this rejection. Kept identical to avoid behaviour drift.\n });\n\n return i18n;\n}\n"]}
package/dist/index.mjs DELETED
@@ -1,31 +0,0 @@
1
- import i18n from 'i18next';
2
- import { initReactI18next } from 'react-i18next';
3
-
4
- // src/i18n/initI18n.ts
5
- var DEFAULT_FALLBACK_LNG = "en";
6
- function initI18n(options) {
7
- const {
8
- resources,
9
- lng,
10
- fallbackLng = DEFAULT_FALLBACK_LNG,
11
- escapeValue = false,
12
- defaultNS,
13
- ns
14
- } = options;
15
- i18n.use(initReactI18next).init({
16
- lng: lng ?? fallbackLng,
17
- fallbackLng,
18
- resources,
19
- ...defaultNS !== void 0 ? { defaultNS } : {},
20
- ...ns !== void 0 ? { ns } : {},
21
- interpolation: {
22
- escapeValue
23
- }
24
- }).catch(() => {
25
- });
26
- return i18n;
27
- }
28
-
29
- export { initI18n };
30
- //# sourceMappingURL=index.mjs.map
31
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/i18n/initI18n.ts"],"names":[],"mappings":";;;;AAsDA,IAAM,oBAAA,GAAuB,IAAA;AA0BtB,SAAS,SAAS,OAAA,EAAwC;AAC/D,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,GAAA;AAAA,IACA,WAAA,GAAc,oBAAA;AAAA,IACd,WAAA,GAAc,KAAA;AAAA,IACd,SAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAEJ,EAAA,IAAA,CACG,GAAA,CAAI,gBAAgB,CAAA,CACpB,IAAA,CAAK;AAAA,IACJ,KAAK,GAAA,IAAO,WAAA;AAAA,IACZ,WAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAI,SAAA,KAAc,MAAA,GAAY,EAAE,SAAA,KAAc,EAAC;AAAA,IAC/C,GAAI,EAAA,KAAO,MAAA,GAAY,EAAE,EAAA,KAAO,EAAC;AAAA,IACjC,aAAA,EAAe;AAAA,MACb;AAAA;AACF,GACD,CAAA,CACA,KAAA,CAAM,MAAM;AAAA,EAGb,CAAC,CAAA;AAEH,EAAA,OAAO,IAAA;AACT","file":"index.mjs","sourcesContent":["// i18next's default export is the configurable singleton; `.use()` / `.init()`\n// are members on it — this is the documented i18next initialization pattern,\n// which trips `import/no-named-as-default-member` for the whole fluent chain.\n// The disable is owned by the package so the consuming apps don't repeat it.\n/* eslint-disable import/no-named-as-default-member */\nimport i18n, { type i18n as I18nInstance, type Resource } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\n/**\n * Options for {@link initI18n}.\n *\n * Everything app-specific (the strings, the locales, the fallback language and\n * the active language) is passed in — the package owns only the init *chain*.\n */\nexport interface InitI18nOptions {\n /**\n * The i18next resource bundle, e.g. `{ en: { translation: en } }`.\n * The app owns its own `locales/*.json` — only the init logic is shared.\n */\n resources: Resource;\n\n /**\n * The active language. Apps typically derive this from device locale,\n * e.g. `expo-localization`'s `getLocales()[0]?.languageCode`.\n *\n * When omitted (or undefined), defaults to {@link fallbackLng}.\n */\n lng?: string;\n\n /**\n * The fallback language used when a key is missing in {@link lng}.\n * Defaults to `'en'`.\n */\n fallbackLng?: string;\n\n /**\n * Whether to escape interpolated values. React already escapes output, so\n * the SaaS apps run with `escapeValue: false`. Defaults to `false`.\n */\n escapeValue?: boolean;\n\n /**\n * Default namespace(s). i18next's default is `'translation'`; the SaaS apps\n * keep that single-namespace convention, so this is optional.\n */\n defaultNS?: string | readonly string[];\n\n /**\n * Namespace list. Optional — only needed when the app splits strings across\n * multiple namespaces. Single-namespace apps can omit it.\n */\n ns?: string | readonly string[];\n}\n\nconst DEFAULT_FALLBACK_LNG = 'en';\n\n/**\n * Initialize the shared i18next + react-i18next singleton.\n *\n * This is the parameterized factory that replaces the per-app `i18n.ts`. It\n * wires `react-i18next` into the i18next singleton and runs `.init()` with the\n * app-supplied resources/language, swallowing the async init rejection the same\n * way every app did (i18next resolves synchronously for in-memory resources).\n *\n * The returned value is the i18next singleton — apps `export default` it and\n * call `.t()` through their own `FM()` helper.\n *\n * @example\n * ```ts\n * import { initI18n } from '@dloizides/frontend-devtools';\n * import * as Localization from 'expo-localization';\n * import en from './locales/en.json';\n *\n * const i18n = initI18n({\n * resources: { en: { translation: en } },\n * lng: Localization.getLocales()[0]?.languageCode,\n * });\n * export default i18n;\n * ```\n */\nexport function initI18n(options: InitI18nOptions): I18nInstance {\n const {\n resources,\n lng,\n fallbackLng = DEFAULT_FALLBACK_LNG,\n escapeValue = false,\n defaultNS,\n ns,\n } = options;\n\n i18n\n .use(initReactI18next)\n .init({\n lng: lng ?? fallbackLng,\n fallbackLng,\n resources,\n ...(defaultNS !== undefined ? { defaultNS } : {}),\n ...(ns !== undefined ? { ns } : {}),\n interpolation: {\n escapeValue,\n },\n })\n .catch(() => {\n // i18next resolves synchronously for in-memory resources; the apps have\n // always swallowed this rejection. Kept identical to avoid behaviour drift.\n });\n\n return i18n;\n}\n"]}