@dloizides/frontend-devtools 2.5.0 → 2.6.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +16 -0
  3. package/dist/babel/index.d.mts +19 -0
  4. package/dist/babel/index.d.ts +19 -0
  5. package/dist/babel/index.js +24 -0
  6. package/dist/babel/index.js.map +1 -0
  7. package/dist/babel/index.mjs +22 -0
  8. package/dist/babel/index.mjs.map +1 -0
  9. package/dist/eslint/index.d.mts +47 -2
  10. package/dist/eslint/index.d.ts +47 -2
  11. package/dist/eslint/index.js +734 -41
  12. package/dist/eslint/index.js.map +1 -1
  13. package/dist/eslint/index.mjs +734 -42
  14. package/dist/eslint/index.mjs.map +1 -1
  15. package/dist/jest/index.d.mts +20 -0
  16. package/dist/jest/index.d.ts +20 -0
  17. package/dist/jest/index.js +63 -0
  18. package/dist/jest/index.js.map +1 -0
  19. package/dist/jest/index.mjs +60 -0
  20. package/dist/jest/index.mjs.map +1 -0
  21. package/dist/jest/setup.d.mts +2 -0
  22. package/dist/jest/setup.d.ts +2 -0
  23. package/dist/jest/setup.js +74 -0
  24. package/dist/jest/setup.js.map +1 -0
  25. package/dist/jest/setup.mjs +72 -0
  26. package/dist/jest/setup.mjs.map +1 -0
  27. package/dist/metro/index.d.mts +24 -0
  28. package/dist/metro/index.d.ts +24 -0
  29. package/dist/metro/index.js +72 -0
  30. package/dist/metro/index.js.map +1 -0
  31. package/dist/metro/index.mjs +47 -0
  32. package/dist/metro/index.mjs.map +1 -0
  33. package/dist/test-results/index.d.mts +2 -2
  34. package/dist/test-results/index.d.ts +2 -2
  35. package/dist/test-results/jestReporter.d.mts +1 -1
  36. package/dist/test-results/jestReporter.d.ts +1 -1
  37. package/dist/test-results/vitestReporter.d.mts +1 -1
  38. package/dist/test-results/vitestReporter.d.ts +1 -1
  39. package/dist/{types-9BQtbdcF.d.mts → types-DQiTmmgP.d.mts} +1 -1
  40. package/dist/{types-9BQtbdcF.d.ts → types-DQiTmmgP.d.ts} +1 -1
  41. package/package.json +42 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to `@dloizides/frontend-devtools` are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.6.0] - 2026-11-19
9
+
10
+ ESTATE-AUDIT-1 "Estate audit" W2a, findings D1 "one ESLint base config", D7 "metro and babel preset", D8 "jest preset".
11
+
12
+ ### Added
13
+ - `createBaseConfig(deps, options)` in `/eslint`: the full house flat config (TypeScript strict, React, React Native, a11y, import order, house rules, i18n, test overrides, comments, api, pattern packs, boundaries, prettier). The app passes the third-party plugins it installs; `options` covers extra ignores, tsconfig path, stable-hook ignore patterns, logger files, route-preload and nav-prefix blocks, boundary elements. A test holds it equal, block by block and rule by rule, to the agora-web config it replaces.
14
+ - `/metro`: `withSharedMetroConfig(getDefaultConfig(root), { projectRoot })` (symlinks, package exports, build-dir block list, `@/` alias, one host React).
15
+ - `/babel`: `createBabelConfig(api, options)` (babel-preset-expo, `@` alias, import.meta transform, const enums as runtime objects).
16
+ - `/jest`: `createJestConfig(options)` (jest-expo preset, RN/Expo transform list, `@/` mapper, coverage defaults) and `/jest/setup`, the shared Expo mocks as a `setupFilesAfterEnv` entry.
17
+
8
18
  ## [2.5.0] - 2026-11-16
9
19
 
10
20
  MODC-1 "Module C unified console", D-MC-46 "AC-MC-14: the lint rule flags our backend hosts".
package/README.md CHANGED
@@ -150,6 +150,22 @@ third-party call and allowed. Options:
150
150
  `ruleNames` exports the sorted list for migration assertions (prove no rule was
151
151
  dropped).
152
152
 
153
+ ## App presets (`createBaseConfig`, `/metro`, `/babel`, `/jest`)
154
+
155
+ ```js
156
+ // eslint.config.mjs: import the plugins the app installs, then
157
+ export default createBaseConfig({ jsRecommended: js.configs.recommended, prettierConfig, tsParser, jsoncParser,
158
+ plugins: { typescript, react, reactHooks, reactNative, reactNativeA11y, import: importPlugin, unusedImports, reactCompiler, i18next } });
159
+ // metro.config.js
160
+ module.exports = withSharedMetroConfig(getDefaultConfig(__dirname), { projectRoot: __dirname });
161
+ // babel.config.js
162
+ module.exports = (api) => createBabelConfig(api);
163
+ // jest.config.js
164
+ module.exports = createJestConfig({ setupFilesAfterEnv: ['@dloizides/frontend-devtools/jest/setup', '<rootDir>/jest.setup.js'] });
165
+ ```
166
+
167
+ App-specific settings go in each preset's options; nothing product-specific lives in the package.
168
+
153
169
  ## i18n init factory — moved
154
170
 
155
171
  `initI18n` and `InitI18nOptions` live in `@dloizides/i18n` (>= 1.1.0) since 2.0.0:
@@ -0,0 +1,19 @@
1
+ interface BabelApi {
2
+ cache: (value: boolean) => void;
3
+ }
4
+ interface SharedBabelOptions {
5
+ srcAlias?: string;
6
+ extraPlugins?: unknown[];
7
+ }
8
+ interface BabelConfig {
9
+ presets: unknown[];
10
+ plugins: unknown[];
11
+ overrides: Array<{
12
+ test: RegExp;
13
+ plugins: unknown[];
14
+ }>;
15
+ }
16
+ /** The house Expo babel config: `@/` alias, import.meta transform, const enums as runtime objects. */
17
+ declare function createBabelConfig(api: BabelApi, options?: SharedBabelOptions): BabelConfig;
18
+
19
+ export { type BabelApi, type BabelConfig, type SharedBabelOptions, createBabelConfig };
@@ -0,0 +1,19 @@
1
+ interface BabelApi {
2
+ cache: (value: boolean) => void;
3
+ }
4
+ interface SharedBabelOptions {
5
+ srcAlias?: string;
6
+ extraPlugins?: unknown[];
7
+ }
8
+ interface BabelConfig {
9
+ presets: unknown[];
10
+ plugins: unknown[];
11
+ overrides: Array<{
12
+ test: RegExp;
13
+ plugins: unknown[];
14
+ }>;
15
+ }
16
+ /** The house Expo babel config: `@/` alias, import.meta transform, const enums as runtime objects. */
17
+ declare function createBabelConfig(api: BabelApi, options?: SharedBabelOptions): BabelConfig;
18
+
19
+ export { type BabelApi, type BabelConfig, type SharedBabelOptions, createBabelConfig };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ // src/babel/index.ts
4
+ function createBabelConfig(api, options = {}) {
5
+ api.cache(true);
6
+ return {
7
+ presets: ["babel-preset-expo"],
8
+ plugins: [
9
+ ["module-resolver", { alias: { "@": options.srcAlias ?? "./src" } }],
10
+ "babel-plugin-transform-import-meta",
11
+ ...options.extraPlugins ?? []
12
+ ],
13
+ overrides: [
14
+ {
15
+ test: /\.tsx?$/,
16
+ plugins: [["babel-plugin-const-enum", { transform: "constObject" }]]
17
+ }
18
+ ]
19
+ };
20
+ }
21
+
22
+ exports.createBabelConfig = createBabelConfig;
23
+ //# sourceMappingURL=index.js.map
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/babel/index.ts"],"names":[],"mappings":";;;AAgBO,SAAS,iBAAA,CAAkB,GAAA,EAAe,OAAA,GAA8B,EAAC,EAAgB;AAC9F,EAAA,GAAA,CAAI,MAAM,IAAI,CAAA;AACd,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,CAAC,mBAAmB,CAAA;AAAA,IAC7B,OAAA,EAAS;AAAA,MACP,CAAC,iBAAA,EAAmB,EAAE,KAAA,EAAO,EAAE,KAAK,OAAA,CAAQ,QAAA,IAAY,OAAA,EAAQ,EAAG,CAAA;AAAA,MACnE,oCAAA;AAAA,MACA,GAAI,OAAA,CAAQ,YAAA,IAAgB;AAAC,KAC/B;AAAA,IACA,SAAA,EAAW;AAAA,MACT;AAAA,QACE,IAAA,EAAM,SAAA;AAAA,QACN,OAAA,EAAS,CAAC,CAAC,yBAAA,EAA2B,EAAE,SAAA,EAAW,aAAA,EAAe,CAAC;AAAA;AACrE;AACF,GACF;AACF","file":"index.js","sourcesContent":["export interface BabelApi {\n cache: (value: boolean) => void;\n}\n\nexport interface SharedBabelOptions {\n srcAlias?: string;\n extraPlugins?: unknown[];\n}\n\nexport interface BabelConfig {\n presets: unknown[];\n plugins: unknown[];\n overrides: Array<{ test: RegExp; plugins: unknown[] }>;\n}\n\n/** The house Expo babel config: `@/` alias, import.meta transform, const enums as runtime objects. */\nexport function createBabelConfig(api: BabelApi, options: SharedBabelOptions = {}): BabelConfig {\n api.cache(true);\n return {\n presets: ['babel-preset-expo'],\n plugins: [\n ['module-resolver', { alias: { '@': options.srcAlias ?? './src' } }],\n 'babel-plugin-transform-import-meta',\n ...(options.extraPlugins ?? []),\n ],\n overrides: [\n {\n test: /\\.tsx?$/,\n plugins: [['babel-plugin-const-enum', { transform: 'constObject' }]],\n },\n ],\n };\n}\n"]}
@@ -0,0 +1,22 @@
1
+ // src/babel/index.ts
2
+ function createBabelConfig(api, options = {}) {
3
+ api.cache(true);
4
+ return {
5
+ presets: ["babel-preset-expo"],
6
+ plugins: [
7
+ ["module-resolver", { alias: { "@": options.srcAlias ?? "./src" } }],
8
+ "babel-plugin-transform-import-meta",
9
+ ...options.extraPlugins ?? []
10
+ ],
11
+ overrides: [
12
+ {
13
+ test: /\.tsx?$/,
14
+ plugins: [["babel-plugin-const-enum", { transform: "constObject" }]]
15
+ }
16
+ ]
17
+ };
18
+ }
19
+
20
+ export { createBabelConfig };
21
+ //# sourceMappingURL=index.mjs.map
22
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/babel/index.ts"],"names":[],"mappings":";AAgBO,SAAS,iBAAA,CAAkB,GAAA,EAAe,OAAA,GAA8B,EAAC,EAAgB;AAC9F,EAAA,GAAA,CAAI,MAAM,IAAI,CAAA;AACd,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,CAAC,mBAAmB,CAAA;AAAA,IAC7B,OAAA,EAAS;AAAA,MACP,CAAC,iBAAA,EAAmB,EAAE,KAAA,EAAO,EAAE,KAAK,OAAA,CAAQ,QAAA,IAAY,OAAA,EAAQ,EAAG,CAAA;AAAA,MACnE,oCAAA;AAAA,MACA,GAAI,OAAA,CAAQ,YAAA,IAAgB;AAAC,KAC/B;AAAA,IACA,SAAA,EAAW;AAAA,MACT;AAAA,QACE,IAAA,EAAM,SAAA;AAAA,QACN,OAAA,EAAS,CAAC,CAAC,yBAAA,EAA2B,EAAE,SAAA,EAAW,aAAA,EAAe,CAAC;AAAA;AACrE;AACF,GACF;AACF","file":"index.mjs","sourcesContent":["export interface BabelApi {\n cache: (value: boolean) => void;\n}\n\nexport interface SharedBabelOptions {\n srcAlias?: string;\n extraPlugins?: unknown[];\n}\n\nexport interface BabelConfig {\n presets: unknown[];\n plugins: unknown[];\n overrides: Array<{ test: RegExp; plugins: unknown[] }>;\n}\n\n/** The house Expo babel config: `@/` alias, import.meta transform, const enums as runtime objects. */\nexport function createBabelConfig(api: BabelApi, options: SharedBabelOptions = {}): BabelConfig {\n api.cache(true);\n return {\n presets: ['babel-preset-expo'],\n plugins: [\n ['module-resolver', { alias: { '@': options.srcAlias ?? './src' } }],\n 'babel-plugin-transform-import-meta',\n ...(options.extraPlugins ?? []),\n ],\n overrides: [\n {\n test: /\\.tsx?$/,\n plugins: [['babel-plugin-const-enum', { transform: 'constObject' }]],\n },\n ],\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Rule, Linter } from 'eslint';
1
+ import { Linter, Rule } from 'eslint';
2
2
 
3
3
  /**
4
4
  * A single custom ESLint rule implementation (the object passed to ESLint's
@@ -74,6 +74,51 @@ declare const ruleNames: readonly string[];
74
74
  */
75
75
  declare const legacyPlugins: Record<string, FlatConfigPlugin>;
76
76
 
77
+ type PluginLike = NonNullable<FlatConfig['plugins']>[string];
78
+ type ParserLike = NonNullable<NonNullable<FlatConfig['languageOptions']>['parser']>;
79
+ interface BaseConfigDeps {
80
+ jsRecommended: FlatConfig;
81
+ prettierConfig: FlatConfig;
82
+ tsParser: ParserLike;
83
+ jsoncParser: ParserLike;
84
+ plugins: {
85
+ typescript: PluginLike;
86
+ react: PluginLike;
87
+ reactHooks: PluginLike;
88
+ reactNative: PluginLike;
89
+ reactNativeA11y: PluginLike;
90
+ import: PluginLike;
91
+ unusedImports: PluginLike;
92
+ reactCompiler: PluginLike;
93
+ i18next: PluginLike;
94
+ };
95
+ }
96
+ interface RoutePreloadOptions {
97
+ file: string;
98
+ routeDir: string;
99
+ excludeFiles: string[];
100
+ excludeDirs: string[];
101
+ rootIndexIsRedirect: boolean;
102
+ }
103
+ interface BoundaryElement {
104
+ type: string;
105
+ pattern: string | string[];
106
+ mode: string;
107
+ capture: string[];
108
+ }
109
+ interface BaseConfigOptions {
110
+ extraIgnores?: string[];
111
+ tsconfigProject?: string;
112
+ stableHookIgnorePatterns?: string[];
113
+ loggerFiles?: string[];
114
+ routePreload?: RoutePreloadOptions | false;
115
+ navPrefixFiles?: string[] | false;
116
+ boundaryElements?: BoundaryElement[];
117
+ }
118
+
119
+ /** The house flat config for RN/Expo web apps; plugins come from the app, app paths from `options`. */
120
+ declare function createBaseConfig(deps: BaseConfigDeps, options?: BaseConfigOptions): FlatConfig[];
121
+
77
122
  declare const HOUSE_PATTERN_RULE_NAMES: readonly string[];
78
123
  /** D-PAT-12 preset: four community rule packs plus the house pattern rules, every rule at warn. */
79
124
  declare const patternPacksConfig: FlatConfig;
@@ -102,4 +147,4 @@ declare const COMPOSE_RULE_NAMES: readonly string[];
102
147
  /** UI-COMPOSE-1: a component stays small and composes with slots. Opt-in; pass `frozen` for existing over-limit ones. */
103
148
  declare const composeConfig: FlatConfig;
104
149
 
105
- export { API_RULE_NAMES, COMMENT_RULE_NAMES, COMPOSE_RULE_NAMES, type CustomRule, FOCUS_RULE_NAMES, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, composeConfig, focusConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
150
+ export { API_RULE_NAMES, type BaseConfigDeps, type BaseConfigOptions, type BoundaryElement, COMMENT_RULE_NAMES, COMPOSE_RULE_NAMES, type CustomRule, FOCUS_RULE_NAMES, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type RoutePreloadOptions, type SingleRulePlugin, apiConfig, commentsConfig, composeConfig, createBaseConfig, focusConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
@@ -1,4 +1,4 @@
1
- import { Rule, Linter } from 'eslint';
1
+ import { Linter, Rule } from 'eslint';
2
2
 
3
3
  /**
4
4
  * A single custom ESLint rule implementation (the object passed to ESLint's
@@ -74,6 +74,51 @@ declare const ruleNames: readonly string[];
74
74
  */
75
75
  declare const legacyPlugins: Record<string, FlatConfigPlugin>;
76
76
 
77
+ type PluginLike = NonNullable<FlatConfig['plugins']>[string];
78
+ type ParserLike = NonNullable<NonNullable<FlatConfig['languageOptions']>['parser']>;
79
+ interface BaseConfigDeps {
80
+ jsRecommended: FlatConfig;
81
+ prettierConfig: FlatConfig;
82
+ tsParser: ParserLike;
83
+ jsoncParser: ParserLike;
84
+ plugins: {
85
+ typescript: PluginLike;
86
+ react: PluginLike;
87
+ reactHooks: PluginLike;
88
+ reactNative: PluginLike;
89
+ reactNativeA11y: PluginLike;
90
+ import: PluginLike;
91
+ unusedImports: PluginLike;
92
+ reactCompiler: PluginLike;
93
+ i18next: PluginLike;
94
+ };
95
+ }
96
+ interface RoutePreloadOptions {
97
+ file: string;
98
+ routeDir: string;
99
+ excludeFiles: string[];
100
+ excludeDirs: string[];
101
+ rootIndexIsRedirect: boolean;
102
+ }
103
+ interface BoundaryElement {
104
+ type: string;
105
+ pattern: string | string[];
106
+ mode: string;
107
+ capture: string[];
108
+ }
109
+ interface BaseConfigOptions {
110
+ extraIgnores?: string[];
111
+ tsconfigProject?: string;
112
+ stableHookIgnorePatterns?: string[];
113
+ loggerFiles?: string[];
114
+ routePreload?: RoutePreloadOptions | false;
115
+ navPrefixFiles?: string[] | false;
116
+ boundaryElements?: BoundaryElement[];
117
+ }
118
+
119
+ /** The house flat config for RN/Expo web apps; plugins come from the app, app paths from `options`. */
120
+ declare function createBaseConfig(deps: BaseConfigDeps, options?: BaseConfigOptions): FlatConfig[];
121
+
77
122
  declare const HOUSE_PATTERN_RULE_NAMES: readonly string[];
78
123
  /** D-PAT-12 preset: four community rule packs plus the house pattern rules, every rule at warn. */
79
124
  declare const patternPacksConfig: FlatConfig;
@@ -102,4 +147,4 @@ declare const COMPOSE_RULE_NAMES: readonly string[];
102
147
  /** UI-COMPOSE-1: a component stays small and composes with slots. Opt-in; pass `frozen` for existing over-limit ones. */
103
148
  declare const composeConfig: FlatConfig;
104
149
 
105
- export { API_RULE_NAMES, COMMENT_RULE_NAMES, COMPOSE_RULE_NAMES, type CustomRule, FOCUS_RULE_NAMES, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, composeConfig, focusConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
150
+ export { API_RULE_NAMES, type BaseConfigDeps, type BaseConfigOptions, type BoundaryElement, COMMENT_RULE_NAMES, COMPOSE_RULE_NAMES, type CustomRule, FOCUS_RULE_NAMES, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type RoutePreloadOptions, type SingleRulePlugin, apiConfig, commentsConfig, composeConfig, createBaseConfig, focusConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };