@venizia/dev-configs 0.3.1-0 → 0.3.1-1

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 (60) hide show
  1. package/README.md +45 -13
  2. package/dist/compilers/bun.d.ts.map +1 -1
  3. package/dist/compilers/bun.js +1 -0
  4. package/dist/compilers/bun.js.map +1 -1
  5. package/dist/linters/browser.d.ts +3 -2
  6. package/dist/linters/browser.d.ts.map +1 -1
  7. package/dist/linters/browser.js +5 -4
  8. package/dist/linters/browser.js.map +1 -1
  9. package/dist/linters/house/common.d.ts +20 -0
  10. package/dist/linters/house/common.d.ts.map +1 -0
  11. package/dist/linters/house/common.js +29 -0
  12. package/dist/linters/house/common.js.map +1 -0
  13. package/dist/linters/house/configs.d.ts +16 -0
  14. package/dist/linters/house/configs.d.ts.map +1 -0
  15. package/dist/linters/house/configs.js +45 -0
  16. package/dist/linters/house/configs.js.map +1 -0
  17. package/dist/linters/house/index.d.ts +6 -0
  18. package/dist/linters/house/index.d.ts.map +1 -0
  19. package/dist/linters/house/index.js +22 -0
  20. package/dist/linters/house/index.js.map +1 -0
  21. package/dist/linters/house/max-params-own.rule.d.ts +19 -0
  22. package/dist/linters/house/max-params-own.rule.d.ts.map +1 -0
  23. package/dist/linters/house/max-params-own.rule.js +122 -0
  24. package/dist/linters/house/max-params-own.rule.js.map +1 -0
  25. package/dist/linters/house/no-new-error.rule.d.ts +15 -0
  26. package/dist/linters/house/no-new-error.rule.d.ts.map +1 -0
  27. package/dist/linters/house/no-new-error.rule.js +43 -0
  28. package/dist/linters/house/no-new-error.rule.js.map +1 -0
  29. package/dist/linters/house/plugin.d.ts +4 -0
  30. package/dist/linters/house/plugin.d.ts.map +1 -0
  31. package/dist/linters/house/plugin.js +15 -0
  32. package/dist/linters/house/plugin.js.map +1 -0
  33. package/dist/linters/index.d.ts +1 -0
  34. package/dist/linters/index.d.ts.map +1 -1
  35. package/dist/linters/index.js +1 -0
  36. package/dist/linters/index.js.map +1 -1
  37. package/dist/linters/oxlint.d.ts +25 -0
  38. package/dist/linters/oxlint.d.ts.map +1 -1
  39. package/dist/linters/oxlint.js +43 -1
  40. package/dist/linters/oxlint.js.map +1 -1
  41. package/dist/linters/react.d.ts +3 -2
  42. package/dist/linters/react.d.ts.map +1 -1
  43. package/dist/linters/react.js +19 -5
  44. package/dist/linters/react.js.map +1 -1
  45. package/dist/linters/rules/no-unused-vars.rule.d.ts +5 -0
  46. package/dist/linters/rules/no-unused-vars.rule.d.ts.map +1 -1
  47. package/dist/linters/rules/no-unused-vars.rule.js +2 -2
  48. package/dist/linters/rules/no-unused-vars.rule.js.map +1 -1
  49. package/dist/linters/rules/prefer-nullish-coalescing.rule.d.ts +7 -0
  50. package/dist/linters/rules/prefer-nullish-coalescing.rule.d.ts.map +1 -1
  51. package/dist/linters/rules/prefer-nullish-coalescing.rule.js.map +1 -1
  52. package/dist/testing/index.d.ts +2 -0
  53. package/dist/testing/index.d.ts.map +1 -0
  54. package/dist/testing/index.js +18 -0
  55. package/dist/testing/index.js.map +1 -0
  56. package/dist/testing/rejection.helper.d.ts +21 -0
  57. package/dist/testing/rejection.helper.d.ts.map +1 -0
  58. package/dist/testing/rejection.helper.js +37 -0
  59. package/dist/testing/rejection.helper.js.map +1 -0
  60. package/package.json +5 -1
package/README.md CHANGED
@@ -35,10 +35,10 @@ export default defineConfig(oxfmtConfigs);
35
35
  ```
36
36
 
37
37
  ```typescript
38
- // .configs/eslint.config.mjs - the one rule oxlint cannot run yet
39
- import { namingConventionConfigs } from '@venizia/dev-configs/linters';
38
+ // .configs/eslint.config.mjs - what oxlint cannot run: naming convention + house rules
39
+ import { houseConfigs } from '@venizia/dev-configs/linters';
40
40
 
41
- export default namingConventionConfigs;
41
+ export default houseConfigs;
42
42
  ```
43
43
 
44
44
  ```bash
@@ -76,7 +76,7 @@ browser version. A React project swaps it for the React version, which builds on
76
76
  | :--- | :--- | :--- | :--- |
77
77
  | oxlint | `oxlintConfigs` | `BrowserOxlintConfigs.create()` | `ReactOxlintConfigs.create()` |
78
78
  | oxfmt | `oxfmtConfigs` | `browserOxfmtConfigs` | `browserOxfmtConfigs` |
79
- | ESLint | `namingConventionConfigs` | `namingConventionConfigs` | `reactNamingConventionConfigs` |
79
+ | ESLint | `houseConfigs` | `houseConfigs` | `reactHouseConfigs` |
80
80
  | tsconfig | `tsconfig.common.json` | `tsconfig.browser.json` | `tsconfig.react.json` |
81
81
 
82
82
  ## Restate the runtime options in your own tsconfig
@@ -104,7 +104,7 @@ Every IGNIS package and example does.
104
104
  | Flag | Base value | Why |
105
105
  | :--- | :--- | :--- |
106
106
  | `experimentalDecorators` | `true` | `@inject`, `@controller`, `@repository` and the other decorators need it |
107
- | `emitDecoratorMetadata` | `true` | Optional - restate it only if your code reads `design:*` metadata. IGNIS reads `design:paramtypes` once, to validate a `@repository` constructor, and skips the check when the metadata is absent. Under Bun it turns an interface-typed constructor parameter into a runtime import, so import such names with `import type` |
107
+ | `emitDecoratorMetadata` | `true` | Optional - restate it only if your code reads `design:*` metadata. IGNIS reads `design:paramtypes` once, to validate a `@repository` constructor, and skips the check when the metadata is absent. Under Bun it turns an interface-typed constructor parameter into a runtime import (`Export named 'X' not found`), so import such names with `import type`; `tsc --noEmit --isolatedModules` (TS1272) finds most of them, loading `src/index.ts` under Bun the rest |
108
108
  | `useDefineForClassFields` | `false` | Class fields are assigned, not defined, so a subclass field initializer does not shadow a value the base constructor set |
109
109
 
110
110
  ## Entry points
@@ -114,7 +114,8 @@ Every IGNIS package and example does.
114
114
  | `@venizia/dev-configs` | Everything below, re-exported |
115
115
  | `@venizia/dev-configs/compilers` | `BunCompiler` |
116
116
  | `@venizia/dev-configs/formatters` | `oxfmtConfigs`, `browserOxfmtConfigs`, `prettierConfigs` |
117
- | `@venizia/dev-configs/linters` | `oxlintConfigs`, `BrowserOxlintConfigs`, `ReactOxlintConfigs`, `namingConventionConfigs`, `reactNamingConventionConfigs`, `eslintConfigs`, `ReactEslintConfigs`, the rule classes and their types |
117
+ | `@venizia/dev-configs/testing` | `rejectionOf`, `expectRejection` - test helpers for a promise that must reject (imports `bun:test`; tests only) |
118
+ | `@venizia/dev-configs/linters` | `oxlintConfigs`, `OxlintConfigs`, `BrowserOxlintConfigs`, `ReactOxlintConfigs`, `namingConventionConfigs`, `reactNamingConventionConfigs`, `eslintConfigs`, `ReactEslintConfigs`, the rule classes and their types |
118
119
  | `@venizia/dev-configs/tsconfig.base.json` | Target and lib ES2025, `module` Node16, strict mode with `noImplicitAny`, `strictPropertyInitialization` and `useUnknownInCatchVariables` off, `noEmitOnError`, tests excluded |
119
120
  | `@venizia/dev-configs/tsconfig.common.json` | Extends the base and switches `module` and `moduleResolution` to `nodenext` |
120
121
  | `@venizia/dev-configs/tsconfig.browser.json` | Extends the base for a browser library built with a bundler: `module` ESNext, `moduleResolution` bundler, lib ES2025 + `DOM` + `DOM.Iterable`, `types: []` so no Bun types reach `dist` |
@@ -126,7 +127,10 @@ Every IGNIS package and example does.
126
127
 
127
128
  `oxlintConfigs` (type `OxlintConfig`) is a static port of the `eslintConfigs` rules, generated with
128
129
  `@oxlint/migrate`. It enables the `typescript` and `unicorn` plugins and type-aware linting, so it needs
129
- `oxlint-tsgolint`.
130
+ `oxlint-tsgolint`. It also enforces `typescript/consistent-type-imports` (`prefer: type-imports`,
131
+ `fixStyle: inline-type-imports`; `import('pkg').T` annotations stay allowed): a value import of a type
132
+ becomes a runtime import when Bun runs a decorated class's source, and loading fails with
133
+ `Export named 'X' not found`. `oxlint --fix` rewrites them.
130
134
 
131
135
  Not ported:
132
136
 
@@ -137,6 +141,35 @@ Not ported:
137
141
  | `no-invalid-this` | `noImplicitThis` in `tsconfig.base.json` covers it |
138
142
  | `n/prefer-node-protocol` | Maps to `unicorn/prefer-node-protocol` |
139
143
 
144
+ #### lenientFallback
145
+
146
+ `prefer-nullish-coalescing` flags `||` on any nullable left side, so `opts.name || 'guest'` fails when
147
+ `name` is `string | undefined`. That is the default: `||` also swallows a real `''` or `0`. A project
148
+ where `''` and `0` fall back on purpose opts out in one line:
149
+
150
+ ```ts
151
+ // .configs/oxlint.config.mts
152
+ import { defineConfig } from 'oxlint';
153
+ import { OxlintConfigs } from '@venizia/dev-configs/linters';
154
+
155
+ export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
156
+ ```
157
+
158
+ It allows `||` where the left side is a string or a number, and still flags it on objects and
159
+ booleans. `BrowserOxlintConfigs.create()` and `ReactOxlintConfigs.create()` take the same option.
160
+ `OxlintConfigs.create()` with no option is `oxlintConfigs`.
161
+
162
+ ### houseConfigs and the house rules
163
+
164
+ `houseConfigs` is `namingConventionConfigs` plus the house rules oxlint cannot express;
165
+ `reactHouseConfigs` is the same over `reactNamingConventionConfigs`. The rules ship as the ESLint plugin
166
+ `houseEslintPlugin`, registered as `venizia`:
167
+
168
+ | Class | Rule | Default | What it enforces |
169
+ | :--- | :--- | :--- | :--- |
170
+ | `MaxParamsOwnRule` | `venizia/max-params-own` | `build({ max: 5 })` | A function we write takes at most `max` positional parameters. Not counted: an inline callback passed to a call or a JSX prop, a signature a declared type fixes, a constructor whose parameters are all `@inject`. A hook callback counts. |
171
+ | `NoNewErrorRule` | `venizia/no-new-error` | `error` | Throw through `getError` (or an `ApplicationError`), never `new Error(...)` / `Error(...)`. Off in tests. |
172
+
140
173
  ### namingConventionConfigs
141
174
 
142
175
  `namingConventionConfigs` (type `Linter.Config[]`) sets only `@typescript-eslint/naming-convention`, with
@@ -152,11 +185,11 @@ entry with the IGNIS defaults. Every `severity` defaults to `'error'`.
152
185
  | Class | Rule name | `build` options (default) |
153
186
  | :--- | :--- | :--- |
154
187
  | `EqeqeqRule` | `eqeqeq` | `mode`: `'always' \| 'smart'` (`'smart'`) |
155
- | `NoUnusedVarsRule` | `no-unused-vars` | `vars` (`'all'`), `args` (`'none'`), `ignoreRestSiblings` (`false`) |
188
+ | `NoUnusedVarsRule` | `no-unused-vars` | `vars` (`'all'`), `args` (`'none'`), `ignoreRestSiblings` (`false`), `argsIgnorePattern` / `varsIgnorePattern` / `caughtErrorsIgnorePattern` / `destructuredArrayIgnorePattern` (none) |
156
189
  | `SwitchCaseBracesRule` | `unicorn/switch-case-braces` | `mode`: `'always' \| 'avoid'` (`'always'`) |
157
190
  | `NoRestrictedImportsRule` | `no-restricted-imports` | `extraPaths`: `IRestrictedImportPath[]` (none), added to `PATHS` (lodash) |
158
191
  | `NoRestrictedPropertiesRule` | `no-restricted-properties` | `extraProperties`: `IRestrictedProperty[]` (none), added to `SECURE_CONTEXT` (`crypto.randomUUID`) |
159
- | `PreferNullishCoalescingRule` | `typescript/prefer-nullish-coalescing` | `ignoreConditionalTests`, `ignoreMixedLogicalExpressions`, `ignoreTernaryTests` (oxlint's own defaults) |
192
+ | `PreferNullishCoalescingRule` | `typescript/prefer-nullish-coalescing` | `ignoreConditionalTests`, `ignoreMixedLogicalExpressions`, `ignoreTernaryTests`, `ignorePrimitives` (`{ string: true, ... }`; oxlint's own defaults) |
160
193
  | `NamingConventionRule` | `@typescript-eslint/naming-convention` | `extraSelectors`: `TNamingSelector[]` (none), added after `SELECTORS` |
161
194
 
162
195
  Types: `TRuleSeverity`, `TOxlintRuleEntry`, `TNamingSelector`, `IRestrictedImportPath`.
@@ -242,7 +275,7 @@ export default [
242
275
  | React correctness (`jsx-key`, `no-children-prop`, `no-deprecated`, ... - 14 rules) | `error`, `.jsx`/`.tsx` |
243
276
  | `jsx-a11y` basics (`alt-text`, `aria-props`, `aria-role`, ... - 9 rules) | `error`, `.jsx`/`.tsx` |
244
277
  | `react-hooks/rules-of-hooks` / `exhaustive-deps` | `error`, every source file |
245
- | `@typescript-eslint/consistent-type-imports` | `['error', { prefer: 'type-imports' }]` |
278
+ | `@typescript-eslint/consistent-type-imports` | `['error', { prefer: 'type-imports', fixStyle: 'inline-type-imports', disallowTypeAnnotations: false }]` |
246
279
  | `naming-convention` | the base rule, plus PascalCase functions (`function App()`), `.jsx`/`.tsx` |
247
280
  | `no-restricted-properties` | `NoRestrictedPropertiesRule.build()` - bans `crypto.randomUUID` |
248
281
 
@@ -255,8 +288,7 @@ Rules the automatic JSX runtime or `tsc` already enforce (`react-in-jsx-scope`,
255
288
  - `reactVersion` defaults to `'detect'`. Under ESLint 10, eslint-plugin-react 7 cannot detect it and
256
289
  aborts - pass the version: `create({ plugins, reactVersion: '19.2' })`.
257
290
  - In an `eslint.config.ts`, `eslint-plugin-jsx-a11y` needs `@types/eslint-plugin-jsx-a11y`.
258
- - `consistent-type-imports` keeps the default `fixStyle`; a codebase that prefers
259
- `inline-type-imports` sets it on top.
291
+ - `consistent-type-imports` uses `fixStyle: inline-type-imports`, the same as the base preset.
260
292
 
261
293
  ### BrowserOxlintConfigs
262
294
 
@@ -322,7 +354,7 @@ await BunCompiler.compile({ entrypoint: './src/index.ts', outfile: './dist/app'
322
354
  ## Where it sits
323
355
 
324
356
  The root of the chain, with no IGNIS dependency: **dev-configs** -> inversion -> {filter, helpers}
325
- -> {boot, kernel} -> connectors -> {core-worker, core-server} -> atlas.
357
+ -> {boot, kernel} -> connectors -> {core-worker, core-server}.
326
358
 
327
359
  ## Links
328
360
 
@@ -1 +1 @@
1
- {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":"AAIA,gHAAgH;AAChH,qBAAa,WAAW;IACtB;;;;OAIG;WACU,OAAO,CAClB,IAAI,GAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;KACtB,GACL,OAAO,CAAC,IAAI,CAAC;CAgCjB"}
1
+ {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":"AAIA,gHAAgH;AAChH,qBAAa,WAAW;IACtB;;;;OAIG;WACU,OAAO,CAClB,IAAI,GAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;KACtB,GACL,OAAO,CAAC,IAAI,CAAC;CAiCjB"}
@@ -28,6 +28,7 @@ class BunCompiler {
28
28
  if (!built.success) {
29
29
  // `getError` lives in `inversion`, which depends on `dev-configs` - importing it here would
30
30
  // create a circular workspace dependency, so a failed compile throws a plain `Error` instead.
31
+ // eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle
31
32
  throw new Error([
32
33
  `[BunCompiler] compile failed for entrypoint "${entrypoint}":`,
33
34
  ...built.logs.map(log => `[${log.level}] ${log.message}`),
@@ -1 +1 @@
1
- {"version":3,"file":"bun.js","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAC7C,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAE/C,gHAAgH;AAChH,MAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,OAKI,EAAE;QAEN,MAAM,EACJ,UAAU,GAAG,kBAAkB,EAC/B,OAAO,GAAG,eAAe,EACzB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,EACrD,OAAO,GAAG,EAAE,GACb,GAAG,IAAI,CAAC;QAET,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC;YAC5B,WAAW,EAAE,CAAC,UAAU,CAAC;YACzB,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;YAC1C,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACP,MAAM,EAAE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AAC,OAAO,EAAE,CAAC;YACnB,4FAA4F;YAC5F,8FAA8F;YAC9F,sGAAsG;YACtG,MAAM,IAAI,KAAK,CACb;gBACE,gDAAgD,UAAU,IAAI;gBAC9D,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;aAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA9CD,kCA8CC"}
@@ -1,8 +1,9 @@
1
1
  import type { OxlintConfig } from 'oxlint';
2
+ import { type IOxlintPresetOptions } from './oxlint';
2
3
  /**
3
4
  * `oxlintConfigs` for code that runs in a browser, React or not: the base rules plus the
4
5
  * secure-context ban (`crypto.randomUUID` is `undefined` on a plain-http origin). Nothing in the base
5
- * is relaxed. `ReactOxlintConfigs` builds on this preset.
6
+ * is relaxed. `ReactOxlintConfigs` builds on this preset. Takes the same options as `OxlintConfigs`.
6
7
  *
7
8
  * ```ts
8
9
  * // .configs/oxlint.config.mts
@@ -13,6 +14,6 @@ import type { OxlintConfig } from 'oxlint';
13
14
  * ```
14
15
  */
15
16
  export declare class BrowserOxlintConfigs {
16
- static create(): OxlintConfig;
17
+ static create(opts?: IOxlintPresetOptions): OxlintConfig;
17
18
  }
18
19
  //# sourceMappingURL=browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/linters/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,MAAM,IAAI,YAAY;CAS9B"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/linters/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,KAAK,oBAAoB,EAAiB,MAAM,UAAU,CAAC;AAGpE;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,oBAAyB,GAAG,YAAY;CAW7D"}
@@ -6,7 +6,7 @@ const rules_1 = require("./rules");
6
6
  /**
7
7
  * `oxlintConfigs` for code that runs in a browser, React or not: the base rules plus the
8
8
  * secure-context ban (`crypto.randomUUID` is `undefined` on a plain-http origin). Nothing in the base
9
- * is relaxed. `ReactOxlintConfigs` builds on this preset.
9
+ * is relaxed. `ReactOxlintConfigs` builds on this preset. Takes the same options as `OxlintConfigs`.
10
10
  *
11
11
  * ```ts
12
12
  * // .configs/oxlint.config.mts
@@ -17,11 +17,12 @@ const rules_1 = require("./rules");
17
17
  * ```
18
18
  */
19
19
  class BrowserOxlintConfigs {
20
- static create() {
20
+ static create(opts = {}) {
21
+ const baseConfigs = oxlint_1.OxlintConfigs.create(opts);
21
22
  return {
22
- ...oxlint_1.oxlintConfigs,
23
+ ...baseConfigs,
23
24
  rules: {
24
- ...oxlint_1.oxlintConfigs.rules,
25
+ ...baseConfigs.rules,
25
26
  [rules_1.NoRestrictedPropertiesRule.NAME]: rules_1.NoRestrictedPropertiesRule.build(),
26
27
  },
27
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/linters/browser.ts"],"names":[],"mappings":";;;AACA,qCAAyC;AACzC,mCAAqD;AAErD;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAoB;IAC/B,MAAM,CAAC,MAAM;QACX,OAAO;YACL,GAAG,sBAAa;YAChB,KAAK,EAAE;gBACL,GAAG,sBAAa,CAAC,KAAK;gBACtB,CAAC,kCAA0B,CAAC,IAAI,CAAC,EAAE,kCAA0B,CAAC,KAAK,EAAE;aACtE;SACF,CAAC;IACJ,CAAC;CACF;AAVD,oDAUC"}
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/linters/browser.ts"],"names":[],"mappings":";;;AACA,qCAAoE;AACpE,mCAAqD;AAErD;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAoB;IAC/B,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,MAAM,WAAW,GAAG,sBAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE/C,OAAO;YACL,GAAG,WAAW;YACd,KAAK,EAAE;gBACL,GAAG,WAAW,CAAC,KAAK;gBACpB,CAAC,kCAA0B,CAAC,IAAI,CAAC,EAAE,kCAA0B,CAAC,KAAK,EAAE;aACtE;SACF,CAAC;IACJ,CAAC;CACF;AAZD,oDAYC"}
@@ -0,0 +1,20 @@
1
+ /** The estree node types the house rules visit - computed visitor keys, so the names stay PascalCase as ESLint needs them. */
2
+ export declare class AstNodeTypes {
3
+ static readonly NEW_EXPRESSION = "NewExpression";
4
+ static readonly CALL_EXPRESSION = "CallExpression";
5
+ static readonly FUNCTION_DECLARATION = "FunctionDeclaration";
6
+ static readonly FUNCTION_EXPRESSION = "FunctionExpression";
7
+ static readonly ARROW_FUNCTION_EXPRESSION = "ArrowFunctionExpression";
8
+ }
9
+ /** The ESLint namespace the house rules live under: `venizia/<rule>`. */
10
+ export declare const HOUSE_PLUGIN_NAMESPACE = "venizia";
11
+ /** A field of an AST node, read without trusting its type: TypeScript nodes carry fields estree does not declare. */
12
+ export declare const readField: (opts: {
13
+ node: unknown;
14
+ key: string;
15
+ }) => unknown;
16
+ /** The node's `type`, or `undefined` for anything that is not an AST node. */
17
+ export declare const nodeType: (opts: {
18
+ node: unknown;
19
+ }) => string | undefined;
20
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/linters/house/common.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,cAAc,mBAAmB;IACjD,MAAM,CAAC,QAAQ,CAAC,eAAe,oBAAoB;IACnD,MAAM,CAAC,QAAQ,CAAC,oBAAoB,yBAAyB;IAC7D,MAAM,CAAC,QAAQ,CAAC,mBAAmB,wBAAwB;IAC3D,MAAM,CAAC,QAAQ,CAAC,yBAAyB,6BAA6B;CACvE;AAED,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,qHAAqH;AACrH,eAAO,MAAM,SAAS,GAAI,MAAM;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,KAAG,OAKhE,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,GAAI,MAAM;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,KAAG,MAAM,GAAG,SAG3D,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeType = exports.readField = exports.HOUSE_PLUGIN_NAMESPACE = exports.AstNodeTypes = void 0;
4
+ /** The estree node types the house rules visit - computed visitor keys, so the names stay PascalCase as ESLint needs them. */
5
+ class AstNodeTypes {
6
+ static { this.NEW_EXPRESSION = 'NewExpression'; }
7
+ static { this.CALL_EXPRESSION = 'CallExpression'; }
8
+ static { this.FUNCTION_DECLARATION = 'FunctionDeclaration'; }
9
+ static { this.FUNCTION_EXPRESSION = 'FunctionExpression'; }
10
+ static { this.ARROW_FUNCTION_EXPRESSION = 'ArrowFunctionExpression'; }
11
+ }
12
+ exports.AstNodeTypes = AstNodeTypes;
13
+ /** The ESLint namespace the house rules live under: `venizia/<rule>`. */
14
+ exports.HOUSE_PLUGIN_NAMESPACE = 'venizia';
15
+ /** A field of an AST node, read without trusting its type: TypeScript nodes carry fields estree does not declare. */
16
+ const readField = (opts) => {
17
+ const { node, key } = opts;
18
+ return typeof node === 'object' && node !== null && key in node
19
+ ? Reflect.get(node, key)
20
+ : undefined;
21
+ };
22
+ exports.readField = readField;
23
+ /** The node's `type`, or `undefined` for anything that is not an AST node. */
24
+ const nodeType = (opts) => {
25
+ const type = (0, exports.readField)({ node: opts.node, key: 'type' });
26
+ return typeof type === 'string' ? type : undefined;
27
+ };
28
+ exports.nodeType = nodeType;
29
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/linters/house/common.ts"],"names":[],"mappings":";;;AAAA,8HAA8H;AAC9H,MAAa,YAAY;aACP,mBAAc,GAAG,eAAe,CAAC;aACjC,oBAAe,GAAG,gBAAgB,CAAC;aACnC,yBAAoB,GAAG,qBAAqB,CAAC;aAC7C,wBAAmB,GAAG,oBAAoB,CAAC;aAC3C,8BAAyB,GAAG,yBAAyB,CAAC;;AALxE,oCAMC;AAED,yEAAyE;AAC5D,QAAA,sBAAsB,GAAG,SAAS,CAAC;AAEhD,qHAAqH;AAC9G,MAAM,SAAS,GAAG,CAAC,IAAoC,EAAW,EAAE;IACzE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI;QAC7D,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC;QACxB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB;AAEF,8EAA8E;AACvE,MAAM,QAAQ,GAAG,CAAC,IAAuB,EAAsB,EAAE;IACtE,MAAM,IAAI,GAAG,IAAA,iBAAS,EAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC,CAAC;AAHW,QAAA,QAAQ,YAGnB"}
@@ -0,0 +1,16 @@
1
+ import type { Linter } from 'eslint';
2
+ /**
3
+ * The ESLint side of a project that lints with oxlint: the naming convention plus the house rules -
4
+ * everything oxlint cannot express. Run it next to `oxlintConfigs`.
5
+ *
6
+ * ```js
7
+ * // .configs/eslint.config.mjs
8
+ * import { houseConfigs } from '@venizia/dev-configs/linters';
9
+ *
10
+ * export default houseConfigs;
11
+ * ```
12
+ */
13
+ export declare const houseConfigs: Linter.Config[];
14
+ /** `houseConfigs` for a React project: `reactNamingConventionConfigs` plus the house rules. */
15
+ export declare const reactHouseConfigs: Linter.Config[];
16
+ //# sourceMappingURL=configs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../../src/linters/house/configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA4BrC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAsD,CAAC;AAE/F,+FAA+F;AAC/F,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAG5C,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reactHouseConfigs = exports.houseConfigs = void 0;
4
+ const eslint_1 = require("../eslint");
5
+ const react_1 = require("../react");
6
+ const common_1 = require("./common");
7
+ const max_params_own_rule_1 = require("./max-params-own.rule");
8
+ const no_new_error_rule_1 = require("./no-new-error.rule");
9
+ const plugin_1 = require("./plugin");
10
+ const SOURCE_FILES = ['**/*.{ts,tsx,mts,cts}'];
11
+ const TEST_FILES = ['**/__tests__/**', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'];
12
+ /**
13
+ * The house rules: at most 5 positional parameters on a function we write, and errors thrown through
14
+ * `getError` only. Tests are exempt from `no-new-error`: a test throws a plain `Error` on purpose, to
15
+ * stand in for what a driver or a third-party library throws.
16
+ */
17
+ const houseRuleConfigs = [
18
+ {
19
+ files: SOURCE_FILES,
20
+ plugins: { [common_1.HOUSE_PLUGIN_NAMESPACE]: plugin_1.houseEslintPlugin },
21
+ rules: {
22
+ [max_params_own_rule_1.MaxParamsOwnRule.NAME]: max_params_own_rule_1.MaxParamsOwnRule.build(),
23
+ [no_new_error_rule_1.NoNewErrorRule.NAME]: no_new_error_rule_1.NoNewErrorRule.build(),
24
+ },
25
+ },
26
+ { files: TEST_FILES, rules: { [no_new_error_rule_1.NoNewErrorRule.NAME]: 'off' } },
27
+ ];
28
+ /**
29
+ * The ESLint side of a project that lints with oxlint: the naming convention plus the house rules -
30
+ * everything oxlint cannot express. Run it next to `oxlintConfigs`.
31
+ *
32
+ * ```js
33
+ * // .configs/eslint.config.mjs
34
+ * import { houseConfigs } from '@venizia/dev-configs/linters';
35
+ *
36
+ * export default houseConfigs;
37
+ * ```
38
+ */
39
+ exports.houseConfigs = [...eslint_1.namingConventionConfigs, ...houseRuleConfigs];
40
+ /** `houseConfigs` for a React project: `reactNamingConventionConfigs` plus the house rules. */
41
+ exports.reactHouseConfigs = [
42
+ ...react_1.reactNamingConventionConfigs,
43
+ ...houseRuleConfigs,
44
+ ];
45
+ //# sourceMappingURL=configs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configs.js","sourceRoot":"","sources":["../../../src/linters/house/configs.ts"],"names":[],"mappings":";;;AACA,sCAAoD;AACpD,oCAAwD;AACxD,qCAAkD;AAClD,+DAAyD;AACzD,2DAAqD;AACrD,qCAA6C;AAE7C,MAAM,YAAY,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AAEnF;;;;GAIG;AACH,MAAM,gBAAgB,GAAoB;IACxC;QACE,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,EAAE,CAAC,+BAAsB,CAAC,EAAE,0BAAiB,EAAE;QACxD,KAAK,EAAE;YACL,CAAC,sCAAgB,CAAC,IAAI,CAAC,EAAE,sCAAgB,CAAC,KAAK,EAAE;YACjD,CAAC,kCAAc,CAAC,IAAI,CAAC,EAAE,kCAAc,CAAC,KAAK,EAAE;SAC9C;KACF;IACD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,kCAAc,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;CAC/D,CAAC;AAEF;;;;;;;;;;GAUG;AACU,QAAA,YAAY,GAAoB,CAAC,GAAG,gCAAuB,EAAE,GAAG,gBAAgB,CAAC,CAAC;AAE/F,+FAA+F;AAClF,QAAA,iBAAiB,GAAoB;IAChD,GAAG,oCAA4B;IAC/B,GAAG,gBAAgB;CACpB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './common';
2
+ export * from './max-params-own.rule';
3
+ export * from './no-new-error.rule';
4
+ export * from './plugin';
5
+ export * from './configs';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/linters/house/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./common"), exports);
18
+ __exportStar(require("./max-params-own.rule"), exports);
19
+ __exportStar(require("./no-new-error.rule"), exports);
20
+ __exportStar(require("./plugin"), exports);
21
+ __exportStar(require("./configs"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/linters/house/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,wDAAsC;AACtC,sDAAoC;AACpC,2CAAyB;AACzB,4CAA0B"}
@@ -0,0 +1,19 @@
1
+ import type { Linter, Rule } from 'eslint';
2
+ import type { TRuleSeverity } from '../rules/common';
3
+ /**
4
+ * `venizia/max-params-own`. A function we write takes at most `max` (default 5) positional parameters;
5
+ * beyond that it takes one options object. A signature that belongs to someone else is not counted: an
6
+ * inline callback handed to a call (map, reduce, sort, a library handler) or to a JSX prop, a function a
7
+ * declared type fixes (`const x: TFn = (...)`, a member of a typed or `satisfies` object), and a
8
+ * constructor whose every parameter is injected (`@inject`). A hook's callback (`useCallback(...)`) is ours.
9
+ */
10
+ export declare class MaxParamsOwnRule {
11
+ static readonly NAME = "venizia/max-params-own";
12
+ static readonly DEFAULT_MAX = 5;
13
+ static readonly RULE: Rule.RuleModule;
14
+ static build(opts?: {
15
+ severity?: TRuleSeverity;
16
+ max?: number;
17
+ }): Linter.RuleEntry;
18
+ }
19
+ //# sourceMappingURL=max-params-own.rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"max-params-own.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/house/max-params-own.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAyDrD;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,IAAI,4BAA8C;IAElE,MAAM,CAAC,QAAQ,CAAC,WAAW,KAAK;IAEhC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAmFnC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,MAAM,CAAC,SAAS;CAItF"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MaxParamsOwnRule = void 0;
4
+ const common_1 = require("./common");
5
+ const HOOK_NAME = /^use[A-Z]/;
6
+ const CALL_TYPES = new Set(['CallExpression', 'NewExpression']);
7
+ const isArrayContaining = (opts) => Array.isArray(opts.list) && opts.list.includes(opts.item);
8
+ /** `useX(...)`: a hook's callback is ours, so it counts. */
9
+ const isHookCall = (call) => {
10
+ const callee = (0, common_1.readField)({ node: call, key: 'callee' });
11
+ const name = (0, common_1.readField)({ node: callee, key: 'name' });
12
+ return ((0, common_1.nodeType)({ node: callee }) === 'Identifier' && typeof name === 'string' && HOOK_NAME.test(name));
13
+ };
14
+ /** `node` is an argument of a call or `new` that is not a hook. */
15
+ const isLibraryArgument = (opts) => CALL_TYPES.has((0, common_1.nodeType)({ node: opts.parent }) ?? '') &&
16
+ isArrayContaining({
17
+ list: (0, common_1.readField)({ node: opts.parent, key: 'arguments' }),
18
+ item: opts.node,
19
+ }) &&
20
+ !isHookCall(opts.parent);
21
+ /**
22
+ * An object literal whose shape something else declares: a typed variable, `satisfies`, or an argument
23
+ * of a non-hook call (a library option bag). A nested literal inherits it.
24
+ */
25
+ const hasDeclaredShape = (object) => {
26
+ let current = object;
27
+ while (current) {
28
+ const parent = (0, common_1.readField)({ node: current, key: 'parent' });
29
+ const parentType = (0, common_1.nodeType)({ node: parent });
30
+ const isTypedVariable = parentType === 'VariableDeclarator' &&
31
+ Boolean((0, common_1.readField)({ node: (0, common_1.readField)({ node: parent, key: 'id' }), key: 'typeAnnotation' }));
32
+ if (isTypedVariable ||
33
+ parentType === 'TSSatisfiesExpression' ||
34
+ isLibraryArgument({ node: current, parent })) {
35
+ return true;
36
+ }
37
+ const isNestedValue = parentType === 'Property' && (0, common_1.readField)({ node: parent, key: 'value' }) === current;
38
+ current = isNestedValue ? (0, common_1.readField)({ node: parent, key: 'parent' }) : undefined;
39
+ }
40
+ return false;
41
+ };
42
+ /**
43
+ * `venizia/max-params-own`. A function we write takes at most `max` (default 5) positional parameters;
44
+ * beyond that it takes one options object. A signature that belongs to someone else is not counted: an
45
+ * inline callback handed to a call (map, reduce, sort, a library handler) or to a JSX prop, a function a
46
+ * declared type fixes (`const x: TFn = (...)`, a member of a typed or `satisfies` object), and a
47
+ * constructor whose every parameter is injected (`@inject`). A hook's callback (`useCallback(...)`) is ours.
48
+ */
49
+ class MaxParamsOwnRule {
50
+ static { this.NAME = `${common_1.HOUSE_PLUGIN_NAMESPACE}/max-params-own`; }
51
+ static { this.DEFAULT_MAX = 5; }
52
+ static { this.RULE = {
53
+ meta: {
54
+ type: 'suggestion',
55
+ schema: [{ type: 'integer', minimum: 0 }],
56
+ messages: {
57
+ tooMany: 'A function we write takes up to {{max}} positional parameters, not {{count}}: take one options object.',
58
+ },
59
+ },
60
+ create: context => {
61
+ const max = typeof context.options[0] === 'number' ? context.options[0] : MaxParamsOwnRule.DEFAULT_MAX;
62
+ const isCallback = (node) => {
63
+ const parent = node.parent;
64
+ const isJsxProp = (0, common_1.nodeType)({ node: parent }) === 'JSXExpressionContainer' &&
65
+ (0, common_1.nodeType)({ node: (0, common_1.readField)({ node: parent, key: 'parent' }) }) === 'JSXAttribute';
66
+ return isJsxProp || isLibraryArgument({ node, parent });
67
+ };
68
+ const isInjectedConstructor = (opts) => {
69
+ const parent = opts.node.parent;
70
+ const isDecorated = (param) => {
71
+ const own = (0, common_1.readField)({ node: param, key: 'decorators' });
72
+ const property = (0, common_1.readField)({
73
+ node: (0, common_1.readField)({ node: param, key: 'parameter' }),
74
+ key: 'decorators',
75
+ });
76
+ return ((Array.isArray(own) && own.length > 0) ||
77
+ (Array.isArray(property) && property.length > 0));
78
+ };
79
+ return ((0, common_1.nodeType)({ node: parent }) === 'MethodDefinition' &&
80
+ (0, common_1.readField)({ node: parent, key: 'kind' }) === 'constructor' &&
81
+ opts.params.every(isDecorated));
82
+ };
83
+ const isTypedByContext = (node) => {
84
+ const parent = node.parent;
85
+ const parentType = (0, common_1.nodeType)({ node: parent });
86
+ const isTypedInit = parentType === 'VariableDeclarator' &&
87
+ (0, common_1.readField)({ node: parent, key: 'init' }) === node &&
88
+ Boolean((0, common_1.readField)({ node: (0, common_1.readField)({ node: parent, key: 'id' }), key: 'typeAnnotation' }));
89
+ const grandParent = (0, common_1.readField)({ node: parent, key: 'parent' });
90
+ const isMember = parentType === 'Property' &&
91
+ (0, common_1.readField)({ node: parent, key: 'value' }) === node &&
92
+ (0, common_1.nodeType)({ node: grandParent }) === 'ObjectExpression';
93
+ return isTypedInit || (isMember && hasDeclaredShape(grandParent));
94
+ };
95
+ const check = (node) => {
96
+ const params = (0, common_1.readField)({ node, key: 'params' });
97
+ if (!Array.isArray(params) || params.length <= max) {
98
+ return;
99
+ }
100
+ if (isCallback(node) || isInjectedConstructor({ node, params }) || isTypedByContext(node)) {
101
+ return;
102
+ }
103
+ context.report({
104
+ node,
105
+ messageId: 'tooMany',
106
+ data: { count: String(params.length), max: String(max) },
107
+ });
108
+ };
109
+ return {
110
+ [common_1.AstNodeTypes.FUNCTION_DECLARATION]: check,
111
+ [common_1.AstNodeTypes.FUNCTION_EXPRESSION]: check,
112
+ [common_1.AstNodeTypes.ARROW_FUNCTION_EXPRESSION]: check,
113
+ };
114
+ },
115
+ }; }
116
+ static build(opts = {}) {
117
+ const { severity = 'error', max = MaxParamsOwnRule.DEFAULT_MAX } = opts;
118
+ return [severity, max];
119
+ }
120
+ }
121
+ exports.MaxParamsOwnRule = MaxParamsOwnRule;
122
+ //# sourceMappingURL=max-params-own.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"max-params-own.rule.js","sourceRoot":"","sources":["../../../src/linters/house/max-params-own.rule.ts"],"names":[],"mappings":";;;AAEA,qCAAqF;AAErF,MAAM,SAAS,GAAG,WAAW,CAAC;AAC9B,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,IAAsC,EAAE,EAAE,CACnE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE5D,4DAA4D;AAC5D,MAAM,UAAU,GAAG,CAAC,IAAa,EAAE,EAAE;IACnC,MAAM,MAAM,GAAG,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACtD,OAAO,CACL,IAAA,iBAAQ,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,YAAY,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAChG,CAAC;AACJ,CAAC,CAAC;AAEF,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,CAAC,IAAwC,EAAE,EAAE,CACrE,UAAU,CAAC,GAAG,CAAC,IAAA,iBAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,iBAAiB,CAAC;QAChB,IAAI,EAAE,IAAA,kBAAS,EAAC,EAAE,I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BACzC,CAAC,qBAAY,CAAC,yBAAyB,CAAC,EAAE,KAAK;aAChD,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,OAAmD,EAAE;QAChE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,GAAG,gBAAgB,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;QACxE,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACzB,CAAC;;AA7FH,4CA8FC"}
@@ -0,0 +1,15 @@
1
+ import type { Rule } from 'eslint';
2
+ import type { TRuleSeverity } from '../rules/common';
3
+ /**
4
+ * `venizia/no-new-error`. An error is thrown through `getError({ message })` (or an `ApplicationError`),
5
+ * never `new Error(...)` or `Error(...)`: only an ApplicationError carries the status, the message code and
6
+ * args, and the `extra` every IGNIS layer reads.
7
+ */
8
+ export declare class NoNewErrorRule {
9
+ static readonly NAME = "venizia/no-new-error";
10
+ static readonly RULE: Rule.RuleModule;
11
+ static build(opts?: {
12
+ severity?: TRuleSeverity;
13
+ }): TRuleSeverity;
14
+ }
15
+ //# sourceMappingURL=no-new-error.rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-new-error.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/house/no-new-error.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;;;GAIG;AACH,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,CAAC,IAAI,0BAA4C;IAEhE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CA8BnC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,aAAa,CAAA;KAAO,GAAG,aAAa;CAGrE"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoNewErrorRule = void 0;
4
+ const common_1 = require("./common");
5
+ /**
6
+ * `venizia/no-new-error`. An error is thrown through `getError({ message })` (or an `ApplicationError`),
7
+ * never `new Error(...)` or `Error(...)`: only an ApplicationError carries the status, the message code and
8
+ * args, and the `extra` every IGNIS layer reads.
9
+ */
10
+ class NoNewErrorRule {
11
+ static { this.NAME = `${common_1.HOUSE_PLUGIN_NAMESPACE}/no-new-error`; }
12
+ static { this.RULE = {
13
+ meta: {
14
+ type: 'problem',
15
+ schema: [],
16
+ messages: {
17
+ newError: 'Throw through getError({ message }) (or an ApplicationError), not `{{form}}`: only an ApplicationError carries the status, code and args.',
18
+ },
19
+ },
20
+ create: context => {
21
+ const report = (opts) => context.report({ node: opts.node, messageId: 'newError', data: { form: opts.form } });
22
+ const isErrorIdentifier = (callee) => (0, common_1.nodeType)({ node: callee }) === 'Identifier' &&
23
+ (0, common_1.readField)({ node: callee, key: 'name' }) === 'Error';
24
+ return {
25
+ [common_1.AstNodeTypes.NEW_EXPRESSION]: (node) => {
26
+ if (isErrorIdentifier((0, common_1.readField)({ node, key: 'callee' }))) {
27
+ report({ node, form: 'new Error(...)' });
28
+ }
29
+ },
30
+ [common_1.AstNodeTypes.CALL_EXPRESSION]: (node) => {
31
+ if (isErrorIdentifier((0, common_1.readField)({ node, key: 'callee' }))) {
32
+ report({ node, form: 'Error(...)' });
33
+ }
34
+ },
35
+ };
36
+ },
37
+ }; }
38
+ static build(opts = {}) {
39
+ return opts.severity ?? 'error';
40
+ }
41
+ }
42
+ exports.NoNewErrorRule = NoNewErrorRule;
43
+ //# sourceMappingURL=no-new-error.rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-new-error.rule.js","sourceRoot":"","sources":["../../../src/linters/house/no-new-error.rule.ts"],"names":[],"mappings":";;;AAEA,qCAAqF;AAErF;;;;GAIG;AACH,MAAa,cAAc;aACT,SAAI,GAAG,GAAG,+BAAsB,eAAe,CAA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KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,OAAqC,EAAE;QAClD,OAAO,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;IAClC,CAAC;;AArCH,wCAsCC"}
@@ -0,0 +1,4 @@
1
+ import type { ESLint } from 'eslint';
2
+ /** The ESLint plugin that carries the house rules oxlint cannot express, registered as `venizia`. */
3
+ export declare const houseEslintPlugin: ESLint.Plugin;
4
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/linters/house/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKrC,qGAAqG;AACrG,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAMtC,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.houseEslintPlugin = void 0;
4
+ const common_1 = require("./common");
5
+ const max_params_own_rule_1 = require("./max-params-own.rule");
6
+ const no_new_error_rule_1 = require("./no-new-error.rule");
7
+ /** The ESLint plugin that carries the house rules oxlint cannot express, registered as `venizia`. */
8
+ exports.houseEslintPlugin = {
9
+ meta: { name: `eslint-plugin-${common_1.HOUSE_PLUGIN_NAMESPACE}` },
10
+ rules: {
11
+ 'max-params-own': max_params_own_rule_1.MaxParamsOwnRule.RULE,
12
+ 'no-new-error': no_new_error_rule_1.NoNewErrorRule.RULE,
13
+ },
14
+ };
15
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/linters/house/plugin.ts"],"names":[],"mappings":";;;AACA,qCAAkD;AAClD,+DAAyD;AACzD,2DAAqD;AAErD,qGAAqG;AACxF,QAAA,iBAAiB,GAAkB;IAC9C,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,+BAAsB,EAAE,EAAE;IACzD,KAAK,EAAE;QACL,gBAAgB,EAAE,sCAAgB,CAAC,IAAI;QACvC,cAAc,EAAE,kCAAc,CAAC,IAAI;KACpC;CACF,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from './browser';
2
2
  export * from './eslint';
3
+ export * from './house';
3
4
  export * from './oxlint';
4
5
  export * from './react';
5
6
  export * from './rules';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./browser"), exports);
18
18
  __exportStar(require("./eslint"), exports);
19
+ __exportStar(require("./house"), exports);
19
20
  __exportStar(require("./oxlint"), exports);
20
21
  __exportStar(require("./react"), exports);
21
22
  __exportStar(require("./rules"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB"}
@@ -14,6 +14,31 @@ import type { OxlintConfig } from 'oxlint';
14
14
  *
15
15
  * export default defineConfig(oxlintConfigs);
16
16
  * ```
17
+ *
18
+ * `OxlintConfigs.create({ lenientFallback: true })` is the same preset with `||` allowed on string
19
+ * and number operands.
17
20
  */
18
21
  export declare const oxlintConfigs: OxlintConfig;
22
+ export interface IOxlintPresetOptions {
23
+ /**
24
+ * Allow `||` / `||=` where the left side is a string or a number, so `name || 'guest'` and
25
+ * `limit || 20` pass: `''` and `0` fall back on purpose. Off by default - the base catches a real
26
+ * `''` or `0` swallowed by `||`.
27
+ */
28
+ lenientFallback?: boolean;
29
+ }
30
+ /**
31
+ * Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.
32
+ *
33
+ * ```ts
34
+ * // .configs/oxlint.config.mts
35
+ * import { defineConfig } from 'oxlint';
36
+ * import { OxlintConfigs } from '@venizia/dev-configs/linters';
37
+ *
38
+ * export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
39
+ * ```
40
+ */
41
+ export declare class OxlintConfigs {
42
+ static create(opts?: IOxlintPresetOptions): OxlintConfig;
43
+ }
19
44
  //# sourceMappingURL=oxlint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oxlint.d.ts","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAa3C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,EAAE,YAgJ3B,CAAC"}
1
+ {"version":3,"file":"oxlint.d.ts","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAa3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,EAAE,YA2J3B,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACxB,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,oBAAyB,GAAG,YAAY;CAe7D"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oxlintConfigs = void 0;
3
+ exports.OxlintConfigs = exports.oxlintConfigs = void 0;
4
4
  const rules_1 = require("./rules");
5
5
  /** File globs the rules are scoped to. */
6
6
  const TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
@@ -20,6 +20,9 @@ const JS_TS_FILES = ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx', ...TS_FILES]
20
20
  *
21
21
  * export default defineConfig(oxlintConfigs);
22
22
  * ```
23
+ *
24
+ * `OxlintConfigs.create({ lenientFallback: true })` is the same preset with `||` allowed on string
25
+ * and number operands.
23
26
  */
24
27
  exports.oxlintConfigs = {
25
28
  plugins: ['typescript', 'unicorn'],
@@ -146,6 +149,17 @@ exports.oxlintConfigs = {
146
149
  'prefer-const': 'error',
147
150
  'prefer-rest-params': 'error',
148
151
  'prefer-spread': 'error',
152
+ // A value import of a type becomes a runtime import when Bun runs a decorated class's source
153
+ // (emitDecoratorMetadata) and fails with `Export named 'X' not found`. `import('pkg').T` type
154
+ // annotations stay allowed: they are type-only by construction, and type an optional peer.
155
+ 'typescript/consistent-type-imports': [
156
+ 'error',
157
+ {
158
+ prefer: 'type-imports',
159
+ fixStyle: 'inline-type-imports',
160
+ disallowTypeAnnotations: false,
161
+ },
162
+ ],
149
163
  },
150
164
  },
151
165
  {
@@ -163,4 +177,32 @@ exports.oxlintConfigs = {
163
177
  },
164
178
  ],
165
179
  };
180
+ /**
181
+ * Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.
182
+ *
183
+ * ```ts
184
+ * // .configs/oxlint.config.mts
185
+ * import { defineConfig } from 'oxlint';
186
+ * import { OxlintConfigs } from '@venizia/dev-configs/linters';
187
+ *
188
+ * export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
189
+ * ```
190
+ */
191
+ class OxlintConfigs {
192
+ static create(opts = {}) {
193
+ if (!opts.lenientFallback) {
194
+ return exports.oxlintConfigs;
195
+ }
196
+ return {
197
+ ...exports.oxlintConfigs,
198
+ rules: {
199
+ ...exports.oxlintConfigs.rules,
200
+ [rules_1.PreferNullishCoalescingRule.NAME]: rules_1.PreferNullishCoalescingRule.build({
201
+ ignorePrimitives: { string: true, number: true },
202
+ }),
203
+ },
204
+ };
205
+ }
206
+ }
207
+ exports.OxlintConfigs = OxlintConfigs;
166
208
  //# sourceMappingURL=oxlint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":";;;AACA,mCAMiB;AAEjB,0CAA0C;AAC1C,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;GAeG;AACU,QAAA,aAAa,GAAiB;IACzC,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;IAClC,UAAU,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;IAClC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtB,cAAc,EAAE,CAAC,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC;IACzF,KAAK,EAAE;QACL,qBAAqB;QACrB,mBAAmB,EAAE,OAAO;QAC5B,eAAe,EAAE,OAAO;QACxB,eAAe,EAAE,OAAO;QACxB,2BAA2B,EAAE,OAAO;QACpC,sBAAsB,EAAE,OAAO;QAC/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E,qBAAqB;wBAC/B,uBAAuB,EAAE,KAAK;qBAC/B;iBACF;aACF;SACF;QACD;YACE,KAAK,EAAE,WAAW;YAClB,KAAK,EAAE;gBACL,uBAAuB,EAAE,KAAK;gBAC9B,cAAc,EAAE,OAAO;gBACvB,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;gBACvB,CAAC,+BAAuB,CAAC,IAAI,CAAC,EAAE,+BAAuB,CAAC,KAAK,EAAE;gBAC/D,oCAAoC,EAAE,KAAK;gBAC3C,0BAA0B,EAAE,KAAK;gBACjC,iCAAiC,EAAE,KAAK;aACzC;SACF;KACF;CACF,CAAC;AAWF;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IACxB,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,OAAO,qBAAa,CAAC;QACvB,CAAC;QAED,OAAO;YACL,GAAG,qBAAa;YAChB,KAAK,EAAE;gBACL,GAAG,qBAAa,CAAC,KAAK;gBACtB,CAAC,mCAA2B,CAAC,IAAI,CAAC,EAAE,mCAA2B,CAAC,KAAK,CAAC;oBACpE,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;iBACjD,CAAC;aACH;SACF,CAAC;IACJ,CAAC;CACF;AAhBD,sCAgBC"}
@@ -1,5 +1,6 @@
1
1
  import type { ESLint, Linter } from 'eslint';
2
2
  import type { OxlintConfig } from 'oxlint';
3
+ import type { IOxlintPresetOptions } from './oxlint';
3
4
  /** Without `configs`: each plugin types its presets its own way, and only the rules are used here. */
4
5
  type TRulesPlugin = Omit<ESLint.Plugin, 'configs'>;
5
6
  export interface IReactEslintPlugins {
@@ -37,7 +38,7 @@ export declare class ReactEslintConfigs {
37
38
  * port and is left out.
38
39
  *
39
40
  * Nothing in the base is relaxed - frontend code meets the backend's standard - and
40
- * `exhaustive-deps` is an error.
41
+ * `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
41
42
  *
42
43
  * ```ts
43
44
  * // .configs/oxlint.config.mts
@@ -48,7 +49,7 @@ export declare class ReactEslintConfigs {
48
49
  * ```
49
50
  */
50
51
  export declare class ReactOxlintConfigs {
51
- static create(): OxlintConfig;
52
+ static create(opts?: IOxlintPresetOptions): OxlintConfig;
52
53
  }
53
54
  /**
54
55
  * `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAM3C,sGAAsG;AACtG,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,YAAY,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,mBAAmB,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE;CA8D9F;AAQD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,IAAI,YAAY;CAiD9B;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAYvD,CAAC"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIrD,sGAAsG;AACtG,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,YAAY,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,mBAAmB,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE;CAqE9F;AAQD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,oBAAyB,GAAG,YAAY;CAwD7D;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAYvD,CAAC"}
@@ -79,7 +79,14 @@ class ReactEslintConfigs {
79
79
  },
80
80
  {
81
81
  rules: {
82
- '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
82
+ '@typescript-eslint/consistent-type-imports': [
83
+ 'error',
84
+ {
85
+ prefer: 'type-imports',
86
+ fixStyle: 'inline-type-imports',
87
+ disallowTypeAnnotations: false,
88
+ },
89
+ ],
83
90
  [rules_1.NoRestrictedPropertiesRule.NAME]: rules_1.NoRestrictedPropertiesRule.build(),
84
91
  },
85
92
  },
@@ -98,7 +105,7 @@ const COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase'
98
105
  * port and is left out.
99
106
  *
100
107
  * Nothing in the base is relaxed - frontend code meets the backend's standard - and
101
- * `exhaustive-deps` is an error.
108
+ * `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
102
109
  *
103
110
  * ```ts
104
111
  * // .configs/oxlint.config.mts
@@ -109,8 +116,8 @@ const COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase'
109
116
  * ```
110
117
  */
111
118
  class ReactOxlintConfigs {
112
- static create() {
113
- const browserConfigs = browser_1.BrowserOxlintConfigs.create();
119
+ static create(opts = {}) {
120
+ const browserConfigs = browser_1.BrowserOxlintConfigs.create(opts);
114
121
  return {
115
122
  ...browserConfigs,
116
123
  plugins: [...new Set([...(browserConfigs.plugins ?? []), 'react', 'jsx-a11y'])],
@@ -150,7 +157,14 @@ class ReactOxlintConfigs {
150
157
  rules: {
151
158
  'react/rules-of-hooks': 'error',
152
159
  'react/exhaustive-deps': 'error',
153
- 'typescript/consistent-type-imports': ['error', { prefer: 'type-imports' }],
160
+ 'typescript/consistent-type-imports': [
161
+ 'error',
162
+ {
163
+ prefer: 'type-imports',
164
+ fixStyle: 'inline-type-imports',
165
+ disallowTypeAnnotations: false,
166
+ },
167
+ ],
154
168
  },
155
169
  },
156
170
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAyC;AACzC,uCAAiD;AACjD,qCAAkE;AAClE,mCAA2E;AAW3E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAA6D;QACzE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACpD,MAAM,EAAE,YAAY,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEzC,OAAO;YACL,GAAG,sBAAa;YAChB;gBACE,KAAK,EAAE,CAAC,gBAAgB,CAAC;gBACzB,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE;gBACvC,QA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AK,EAAE;YACL,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,CAAC;gBACtD,cAAc,EAAE,CAAC,2BAA2B,CAAC;aAC9C,CAAC;SACH;KACF;CACF,CAAC"}
@@ -7,6 +7,11 @@ export declare class NoUnusedVarsRule {
7
7
  vars?: 'all' | 'local';
8
8
  args?: 'all' | 'after-used' | 'none';
9
9
  ignoreRestSiblings?: boolean;
10
+ /** Names that may stay unused, e.g. `^_` - a placeholder a signature needs. */
11
+ argsIgnorePattern?: string;
12
+ varsIgnorePattern?: string;
13
+ caughtErrorsIgnorePattern?: string;
14
+ destructuredArrayIgnorePattern?: string;
10
15
  }): TOxlintRuleEntry<'no-unused-vars'>;
11
16
  }
12
17
  //# sourceMappingURL=no-unused-vars.rule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-unused-vars.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,2FAA2F;AAC3F,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,IAAI,oBAAoB;IAExC,MAAM,CAAC,KAAK,CACV,IAAI,GAAE;QACJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC;QACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;KACzB,GACL,gBAAgB,CAAC,gBAAgB,CAAC;CAItC"}
1
+ {"version":3,"file":"no-unused-vars.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,2FAA2F;AAC3F,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,IAAI,oBAAoB;IAExC,MAAM,CAAC,KAAK,CACV,IAAI,GAAE;QACJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC;QACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,+EAA+E;QAC/E,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,yBAAyB,CAAC,EAAE,MAAM,CAAC;QACnC,8BAA8B,CAAC,EAAE,MAAM,CAAC;KACpC,GACL,gBAAgB,CAAC,gBAAgB,CAAC;CAUtC"}
@@ -5,8 +5,8 @@ exports.NoUnusedVarsRule = void 0;
5
5
  class NoUnusedVarsRule {
6
6
  static { this.NAME = 'no-unused-vars'; }
7
7
  static build(opts = {}) {
8
- const { severity = 'error', vars = 'all', args = 'none', ignoreRestSiblings = false } = opts;
9
- return [severity, { vars, args, ignoreRestSiblings }];
8
+ const { severity = 'error', vars = 'all', args = 'none', ignoreRestSiblings = false, ...patterns } = opts;
9
+ return [severity, { vars, args, ignoreRestSiblings, ...patterns }];
10
10
  }
11
11
  }
12
12
  exports.NoUnusedVarsRule = NoUnusedVarsRule;
@@ -1 +1 @@
1
- {"version":3,"file":"no-unused-vars.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":";;;AAEA,2FAA2F;AAC3F,MAAa,gBAAgB;aACX,SAAI,GAAG,gBAAgB,CAAC;IAExC,MAAM,CAAC,KAAK,CACV,OAKI,EAAE;QAEN,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,kBAAkB,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC;QAC7F,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACxD,CAAC;;AAbH,4CAcC"}
1
+ {"version":3,"file":"no-unused-vars.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":";;;AAEA,2FAA2F;AAC3F,MAAa,gBAAgB;aACX,SAAI,GAAG,gBAAgB,CAAC;IAExC,MAAM,CAAC,KAAK,CACV,OAUI,EAAE;QAEN,MAAM,EACJ,QAAQ,GAAG,OAAO,EAClB,IAAI,GAAG,KAAK,EACZ,IAAI,GAAG,MAAM,EACb,kBAAkB,GAAG,KAAK,EAC1B,GAAG,QAAQ,EACZ,GAAG,IAAI,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;;AAxBH,4CAyBC"}
@@ -7,6 +7,13 @@ export declare class PreferNullishCoalescingRule {
7
7
  ignoreConditionalTests?: boolean;
8
8
  ignoreMixedLogicalExpressions?: boolean;
9
9
  ignoreTernaryTests?: boolean;
10
+ /** Allow `||` / `||=` where the left side is this primitive, e.g. `{ string: true, number: true }`. */
11
+ ignorePrimitives?: {
12
+ bigint?: boolean;
13
+ boolean?: boolean;
14
+ number?: boolean;
15
+ string?: boolean;
16
+ };
10
17
  }): TOxlintRuleEntry<'typescript/prefer-nullish-coalescing'>;
11
18
  }
12
19
  //# sourceMappingURL=prefer-nullish-coalescing.rule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-nullish-coalescing.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,gGAAgG;AAChG,qBAAa,2BAA2B;IACtC,MAAM,CAAC,QAAQ,CAAC,IAAI,0CAA0C;IAE9D,MAAM,CAAC,KAAK,CACV,IAAI,GAAE;QACJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,6BAA6B,CAAC,EAAE,OAAO,CAAC;QACxC,kBAAkB,CAAC,EAAE,OAAO,CAAC;KACzB,GACL,gBAAgB,CAAC,sCAAsC,CAAC;CAI5D"}
1
+ {"version":3,"file":"prefer-nullish-coalescing.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,gGAAgG;AAChG,qBAAa,2BAA2B;IACtC,MAAM,CAAC,QAAQ,CAAC,IAAI,0CAA0C;IAE9D,MAAM,CAAC,KAAK,CACV,IAAI,GAAE;QACJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,6BAA6B,CAAC,EAAE,OAAO,CAAC;QACxC,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,uGAAuG;QACvG,gBAAgB,CAAC,EAAE;YACjB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,MAAM,CAAC,EAAE,OAAO,CAAC;SAClB,CAAC;KACE,GACL,gBAAgB,CAAC,sCAAsC,CAAC;CAI5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-nullish-coalescing.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":";;;AAEA,gGAAgG;AAChG,MAAa,2BAA2B;aACtB,SAAI,GAAG,sCAAsC,CAAC;IAE9D,MAAM,CAAC,KAAK,CACV,OAKI,EAAE;QAEN,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAChD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;;AAbH,kEAcC"}
1
+ {"version":3,"file":"prefer-nullish-coalescing.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":";;;AAEA,gGAAgG;AAChG,MAAa,2BAA2B;aACtB,SAAI,GAAG,sCAAsC,CAAC;IAE9D,MAAM,CAAC,KAAK,CACV,OAYI,EAAE;QAEN,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAChD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;;AApBH,kEAqBC"}
@@ -0,0 +1,2 @@
1
+ export * from './rejection.helper';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./rejection.helper"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Awaits a task that must reject and returns what it rejected with; throws when the task resolves.
3
+ *
4
+ * bun types the async matchers (`expect(task).rejects` / `.resolves`) as `void`, so
5
+ * `await expect(task).rejects.toThrow()` is refused by `await-thenable` - and left un-awaited the
6
+ * assertion never runs. Awaiting the task itself needs no matcher and no cast:
7
+ * `expectRejection({ task, message })` or `expect(await rejectionOf(task)).toBeInstanceOf(Error)`,
8
+ * and for a resolution `expect(await task).toMatchObject(...)`.
9
+ */
10
+ export declare const rejectionOf: (task: Promise<unknown>) => Promise<unknown>;
11
+ /**
12
+ * The task rejects with an Error whose message contains `message` (a string) or matches it (a
13
+ * RegExp). The message is compared as a string on purpose: bun 1.4.2 `toMatchObject` with an
14
+ * asymmetric matcher overwrites the matched property on the object it checks, so a later read of
15
+ * `error.message` gets the matcher back.
16
+ */
17
+ export declare const expectRejection: (opts: {
18
+ task: Promise<unknown>;
19
+ message: string | RegExp;
20
+ }) => Promise<void>;
21
+ //# sourceMappingURL=rejection.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rejection.helper.d.ts","sourceRoot":"","sources":["../../src/testing/rejection.helper.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAU,MAAM,OAAO,CAAC,OAAO,CAAC,KAAG,OAAO,CAAC,OAAO,CAQzE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAU,MAAM;IAC1C,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B,KAAG,OAAO,CAAC,IAAI,CAMf,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expectRejection = exports.rejectionOf = void 0;
4
+ const bun_test_1 = require("bun:test");
5
+ /**
6
+ * Awaits a task that must reject and returns what it rejected with; throws when the task resolves.
7
+ *
8
+ * bun types the async matchers (`expect(task).rejects` / `.resolves`) as `void`, so
9
+ * `await expect(task).rejects.toThrow()` is refused by `await-thenable` - and left un-awaited the
10
+ * assertion never runs. Awaiting the task itself needs no matcher and no cast:
11
+ * `expectRejection({ task, message })` or `expect(await rejectionOf(task)).toBeInstanceOf(Error)`,
12
+ * and for a resolution `expect(await task).toMatchObject(...)`.
13
+ */
14
+ const rejectionOf = async (task) => {
15
+ try {
16
+ await task;
17
+ }
18
+ catch (error) {
19
+ return error;
20
+ }
21
+ return bun_test_1.expect.unreachable('Expected the task to reject, but it resolved');
22
+ };
23
+ exports.rejectionOf = rejectionOf;
24
+ /**
25
+ * The task rejects with an Error whose message contains `message` (a string) or matches it (a
26
+ * RegExp). The message is compared as a string on purpose: bun 1.4.2 `toMatchObject` with an
27
+ * asymmetric matcher overwrites the matched property on the object it checks, so a later read of
28
+ * `error.message` gets the matcher back.
29
+ */
30
+ const expectRejection = async (opts) => {
31
+ const { task, message } = opts;
32
+ const reason = await (0, exports.rejectionOf)(task);
33
+ (0, bun_test_1.expect)(reason).toBeInstanceOf(Error);
34
+ (0, bun_test_1.expect)(reason instanceof Error ? reason.message : String(reason)).toMatch(message);
35
+ };
36
+ exports.expectRejection = expectRejection;
37
+ //# sourceMappingURL=rejection.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rejection.helper.js","sourceRoot":"","sources":["../../src/testing/rejection.helper.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAElC;;;;;;;;GAQG;AACI,MAAM,WAAW,GAAG,KAAK,EAAE,IAAsB,EAAoB,EAAE;IAC5E,IAAI,CAAC;QACH,MAAM,IAAI,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,iBAAM,CAAC,WAAW,CAAC,8CAA8C,CAAC,CAAC;AAC5E,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB;AAEF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,IAGrC,EAAiB,EAAE;IAClB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;IAEvC,IAAA,iBAAM,EAAC,MAAM,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,IAAA,iBAAM,EAAC,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACrF,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/dev-configs",
3
- "version": "0.3.1-0",
3
+ "version": "0.3.1-1",
4
4
  "description": "Shareable development configurations for TypeScript projects: oxlint and oxfmt presets with per-rule builders, the ESLint naming-convention rule, the legacy ESLint flat config and Prettier presets, and TypeScript compiler options with critical decorator support (experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields). Single source of truth for consistent code style, type checking, and build settings across monorepo packages.",
5
5
  "keywords": [
6
6
  "build-tools",
@@ -78,6 +78,10 @@
78
78
  "types": "./dist/linters/index.d.ts",
79
79
  "default": "./dist/linters/index.js"
80
80
  },
81
+ "./testing": {
82
+ "types": "./dist/testing/index.d.ts",
83
+ "default": "./dist/testing/index.js"
84
+ },
81
85
  "./tsconfig.base.json": "./src/tsconfig/tsconfig.base.json",
82
86
  "./tsconfig.common.json": "./src/tsconfig/tsconfig.common.json",
83
87
  "./tsconfig.browser.json": "./src/tsconfig/tsconfig.browser.json",