@jterrazz/test 8.0.0 → 9.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.
Files changed (48) hide show
  1. package/README.md +209 -230
  2. package/dist/checker.d.ts +1 -0
  3. package/dist/checker.js +741 -0
  4. package/dist/index.d.ts +1249 -728
  5. package/dist/index.js +3133 -1538
  6. package/dist/intercept.js +129 -299
  7. package/dist/match.js +153 -0
  8. package/dist/oxlint.cjs +2931 -0
  9. package/dist/oxlint.d.cts +150 -0
  10. package/dist/oxlint.d.ts +150 -0
  11. package/dist/oxlint.js +2925 -0
  12. package/package.json +47 -41
  13. package/dist/chunk.cjs +0 -28
  14. package/dist/index.cjs +0 -2264
  15. package/dist/index.cjs.map +0 -1
  16. package/dist/index.d.cts +0 -980
  17. package/dist/index.js.map +0 -1
  18. package/dist/intercept.cjs +0 -323
  19. package/dist/intercept.cjs.map +0 -1
  20. package/dist/intercept.d.cts +0 -115
  21. package/dist/intercept.d.ts +0 -115
  22. package/dist/intercept.js.map +0 -1
  23. package/dist/intercept2.cjs +0 -81
  24. package/dist/intercept2.cjs.map +0 -1
  25. package/dist/intercept2.js +0 -81
  26. package/dist/intercept2.js.map +0 -1
  27. package/dist/mock-of.cjs +0 -32
  28. package/dist/mock-of.cjs.map +0 -1
  29. package/dist/mock-of.d.cts +0 -27
  30. package/dist/mock-of.d.ts +0 -27
  31. package/dist/mock-of.js +0 -19
  32. package/dist/mock-of.js.map +0 -1
  33. package/dist/mock.cjs +0 -4
  34. package/dist/mock.d.cts +0 -2
  35. package/dist/mock.d.ts +0 -2
  36. package/dist/mock.js +0 -2
  37. package/dist/services.cjs +0 -5
  38. package/dist/services.d.cts +0 -2
  39. package/dist/services.d.ts +0 -2
  40. package/dist/services.js +0 -2
  41. package/dist/sqlite.cjs +0 -350
  42. package/dist/sqlite.cjs.map +0 -1
  43. package/dist/sqlite.d.cts +0 -209
  44. package/dist/sqlite.d.ts +0 -209
  45. package/dist/sqlite.js +0 -331
  46. package/dist/sqlite.js.map +0 -1
  47. package/dist/types.d.cts +0 -42
  48. package/dist/types.d.ts +0 -42
@@ -0,0 +1,150 @@
1
+ //#region src/lint/types.d.ts
2
+ /**
3
+ * Local structural types for the slice of oxlint's JS-plugin API this layer uses.
4
+ *
5
+ * oxlint 1.74 does not publicly export its `Plugin` / `Rule` / `Context` types
6
+ * (only `RuleTester`, from `oxlint/plugins-dev`), so we describe the exact subset
7
+ * we depend on here. Declaring them locally keeps the rules layer importing
8
+ * NOTHING from the framework runtime — only these ambient shapes and, where a
9
+ * rule needs it, pure helpers from `core/` (e.g. the token list, the kebab-case
10
+ * utilities). The API is ESLint-compatible, so these shapes mirror ESTree.
11
+ */
12
+ /** A source comment, as exposed by oxlint's ESTree-compatible `sourceCode`. */
13
+ type Comment = {
14
+ range?: [number, number];
15
+ start?: number;
16
+ type: 'Block' | 'Line' | 'Shebang';
17
+ value: string;
18
+ };
19
+ /**
20
+ * Minimal AST node. Rules narrow by `type` and read known fields defensively —
21
+ * the full generated node union is not re-exported, and structural access keeps
22
+ * the layer decoupled from oxlint's internal type churn.
23
+ */
24
+ type AstNode = {
25
+ type: string;
26
+ [key: string]: unknown;
27
+ };
28
+ /** The slice of `context.sourceCode` the rules read. */
29
+ type SourceCode = {
30
+ getAllComments: () => Comment[];
31
+ getCommentsInside: (node: AstNode) => Comment[];
32
+ text: string;
33
+ };
34
+ /** A diagnostic accepted by `context.report`. */
35
+ type Diagnostic = {
36
+ data?: Record<string, number | string>;
37
+ messageId?: string;
38
+ message?: string;
39
+ node?: AstNode;
40
+ };
41
+ /** Rule context passed to `create`. */
42
+ type RuleContext = {
43
+ filename: string;
44
+ id: string;
45
+ /** Configured rule options (`['error', …options]` minus the severity). */
46
+ options: readonly unknown[];
47
+ physicalFilename: string;
48
+ report: (diagnostic: Diagnostic) => void;
49
+ sourceCode: SourceCode;
50
+ };
51
+ /** A visitor: node-type keys → handlers invoked on entry. */
52
+ type Visitor = Record<string, (node: AstNode) => void>;
53
+ /**
54
+ * The normative documentation a rule carries — the code is the source of truth
55
+ * for the mechanized catalogue (docs-as-code inversion). Every plugin rule sets
56
+ * `meta.docs` to its {@link RuleDoc} entry from `manifest.ts`; the catalogue
57
+ * generator reads these to (re)write `docs/10-linting.md` and the annex.
58
+ */
59
+ type RuleDoc = {
60
+ /** Enforcement channel — the four faces the manifest assembles. */
61
+ channel: 'checker' | 'process' | 'runtime' | 'statique';
62
+ /** The French normative sentence (the constitution's per-rule text, moved here). */
63
+ convention: string;
64
+ /** Convention family letter, e.g. `'A'`. */
65
+ family: string;
66
+ /** Convention code, e.g. `'A1'`. */
67
+ id: string;
68
+ /** One line: why the rule exists. */
69
+ rationale: string;
70
+ };
71
+ /** Rule metadata (the subset we set). */
72
+ type RuleMeta = {
73
+ defaultOptions?: unknown[];
74
+ docs?: RuleDoc & {
75
+ description?: string;
76
+ };
77
+ messages?: Record<string, string>;
78
+ /** JSON schema for options — required by oxlint for rules that take options. */
79
+ schema?: false | unknown[];
80
+ type?: 'layout' | 'problem' | 'suggestion';
81
+ };
82
+ /** A lint rule in oxlint's `create` form. */
83
+ type LintRule = {
84
+ create: (context: RuleContext) => Visitor;
85
+ meta?: RuleMeta;
86
+ };
87
+ /** An oxlint JS plugin: a namespace plus its rules. */
88
+ type LintPlugin = {
89
+ meta: {
90
+ name: string;
91
+ };
92
+ rules: Record<string, LintRule>;
93
+ };
94
+ //#endregion
95
+ //#region src/lint/plugin.d.ts
96
+ /**
97
+ * The `@jterrazz/test` oxlint plugin — the tool-facing lint layer that enforces
98
+ * the statically-checkable CONVENTIONS rules (the `Lint(statique)` catalogue).
99
+ *
100
+ * Registered in a consumer's (or this repo's own) `oxlint.config.ts` via
101
+ * `jsPlugins: ['@jterrazz/test/oxlint']` and referenced as `jterrazz/<rule>` in
102
+ * the `rules` map, e.g. `'jterrazz/j1-no-only-skip': 'error'` — or enabled
103
+ * wholesale by spreading {@link recommendedRules}.
104
+ *
105
+ * This entry is bundled by tsdown (`dist/oxlint.js`); rules import nothing from
106
+ * the framework runtime (only pure core helpers: the token list, the case
107
+ * conversions, the fixture-marker list), so the bundle stays free of the heavy
108
+ * adapters (msw, pg, testcontainers, …) that the main entry pulls in.
109
+ */
110
+ declare const plugin: LintPlugin;
111
+ /**
112
+ * The full catalogue at its intended severities — spread into an oxlint
113
+ * `rules` map to enable everything in one line:
114
+ *
115
+ * rules: { ...recommendedRules }
116
+ *
117
+ * Hard conventions are errors; redundancy heuristics (`<id>w-*` rule ids) are
118
+ * warnings. `b5-await-using` is enabled but inert until re-declared with the
119
+ * project's docker-aware runner names:
120
+ *
121
+ * 'jterrazz/b5-await-using': ['error', { runners: ['dockerCli'] }]
122
+ */
123
+ declare const recommendedRules: Record<string, 'error' | 'warn'>;
124
+ /**
125
+ * The composable testing fragment — wire the plugin, enable the whole
126
+ * catalogue, and ship the one override every strict consumer needs. Designed
127
+ * to be composed with a base preset (e.g. `@jterrazz/typescript/oxlint`):
128
+ *
129
+ * import { compose, node } from '@jterrazz/typescript/oxlint';
130
+ * import { testing } from '@jterrazz/test/oxlint';
131
+ * export default compose(node, testing);
132
+ *
133
+ * `jsPlugins` registers the tool-facing entry; `rules` is {@link recommendedRules};
134
+ * `overrides` relaxes `import/exports-last` for `*.specification.ts` — the A4 idiom
135
+ * (`export const { cli, cleanup } … ; afterAll(cleanup)`) legitimately ends a spec
136
+ * file on a non-export statement, so the relaxation ships here rather than being
137
+ * hand-rolled in every consumer.
138
+ */
139
+ declare const testing: {
140
+ jsPlugins: string[];
141
+ overrides: {
142
+ files: string[];
143
+ rules: {
144
+ 'import/exports-last': string;
145
+ };
146
+ }[];
147
+ rules: Record<string, "error" | "warn">;
148
+ };
149
+ //#endregion
150
+ export { plugin as default, recommendedRules, testing };
@@ -0,0 +1,150 @@
1
+ //#region src/lint/types.d.ts
2
+ /**
3
+ * Local structural types for the slice of oxlint's JS-plugin API this layer uses.
4
+ *
5
+ * oxlint 1.74 does not publicly export its `Plugin` / `Rule` / `Context` types
6
+ * (only `RuleTester`, from `oxlint/plugins-dev`), so we describe the exact subset
7
+ * we depend on here. Declaring them locally keeps the rules layer importing
8
+ * NOTHING from the framework runtime — only these ambient shapes and, where a
9
+ * rule needs it, pure helpers from `core/` (e.g. the token list, the kebab-case
10
+ * utilities). The API is ESLint-compatible, so these shapes mirror ESTree.
11
+ */
12
+ /** A source comment, as exposed by oxlint's ESTree-compatible `sourceCode`. */
13
+ type Comment = {
14
+ range?: [number, number];
15
+ start?: number;
16
+ type: 'Block' | 'Line' | 'Shebang';
17
+ value: string;
18
+ };
19
+ /**
20
+ * Minimal AST node. Rules narrow by `type` and read known fields defensively —
21
+ * the full generated node union is not re-exported, and structural access keeps
22
+ * the layer decoupled from oxlint's internal type churn.
23
+ */
24
+ type AstNode = {
25
+ type: string;
26
+ [key: string]: unknown;
27
+ };
28
+ /** The slice of `context.sourceCode` the rules read. */
29
+ type SourceCode = {
30
+ getAllComments: () => Comment[];
31
+ getCommentsInside: (node: AstNode) => Comment[];
32
+ text: string;
33
+ };
34
+ /** A diagnostic accepted by `context.report`. */
35
+ type Diagnostic = {
36
+ data?: Record<string, number | string>;
37
+ messageId?: string;
38
+ message?: string;
39
+ node?: AstNode;
40
+ };
41
+ /** Rule context passed to `create`. */
42
+ type RuleContext = {
43
+ filename: string;
44
+ id: string;
45
+ /** Configured rule options (`['error', …options]` minus the severity). */
46
+ options: readonly unknown[];
47
+ physicalFilename: string;
48
+ report: (diagnostic: Diagnostic) => void;
49
+ sourceCode: SourceCode;
50
+ };
51
+ /** A visitor: node-type keys → handlers invoked on entry. */
52
+ type Visitor = Record<string, (node: AstNode) => void>;
53
+ /**
54
+ * The normative documentation a rule carries — the code is the source of truth
55
+ * for the mechanized catalogue (docs-as-code inversion). Every plugin rule sets
56
+ * `meta.docs` to its {@link RuleDoc} entry from `manifest.ts`; the catalogue
57
+ * generator reads these to (re)write `docs/10-linting.md` and the annex.
58
+ */
59
+ type RuleDoc = {
60
+ /** Enforcement channel — the four faces the manifest assembles. */
61
+ channel: 'checker' | 'process' | 'runtime' | 'statique';
62
+ /** The French normative sentence (the constitution's per-rule text, moved here). */
63
+ convention: string;
64
+ /** Convention family letter, e.g. `'A'`. */
65
+ family: string;
66
+ /** Convention code, e.g. `'A1'`. */
67
+ id: string;
68
+ /** One line: why the rule exists. */
69
+ rationale: string;
70
+ };
71
+ /** Rule metadata (the subset we set). */
72
+ type RuleMeta = {
73
+ defaultOptions?: unknown[];
74
+ docs?: RuleDoc & {
75
+ description?: string;
76
+ };
77
+ messages?: Record<string, string>;
78
+ /** JSON schema for options — required by oxlint for rules that take options. */
79
+ schema?: false | unknown[];
80
+ type?: 'layout' | 'problem' | 'suggestion';
81
+ };
82
+ /** A lint rule in oxlint's `create` form. */
83
+ type LintRule = {
84
+ create: (context: RuleContext) => Visitor;
85
+ meta?: RuleMeta;
86
+ };
87
+ /** An oxlint JS plugin: a namespace plus its rules. */
88
+ type LintPlugin = {
89
+ meta: {
90
+ name: string;
91
+ };
92
+ rules: Record<string, LintRule>;
93
+ };
94
+ //#endregion
95
+ //#region src/lint/plugin.d.ts
96
+ /**
97
+ * The `@jterrazz/test` oxlint plugin — the tool-facing lint layer that enforces
98
+ * the statically-checkable CONVENTIONS rules (the `Lint(statique)` catalogue).
99
+ *
100
+ * Registered in a consumer's (or this repo's own) `oxlint.config.ts` via
101
+ * `jsPlugins: ['@jterrazz/test/oxlint']` and referenced as `jterrazz/<rule>` in
102
+ * the `rules` map, e.g. `'jterrazz/j1-no-only-skip': 'error'` — or enabled
103
+ * wholesale by spreading {@link recommendedRules}.
104
+ *
105
+ * This entry is bundled by tsdown (`dist/oxlint.js`); rules import nothing from
106
+ * the framework runtime (only pure core helpers: the token list, the case
107
+ * conversions, the fixture-marker list), so the bundle stays free of the heavy
108
+ * adapters (msw, pg, testcontainers, …) that the main entry pulls in.
109
+ */
110
+ declare const plugin: LintPlugin;
111
+ /**
112
+ * The full catalogue at its intended severities — spread into an oxlint
113
+ * `rules` map to enable everything in one line:
114
+ *
115
+ * rules: { ...recommendedRules }
116
+ *
117
+ * Hard conventions are errors; redundancy heuristics (`<id>w-*` rule ids) are
118
+ * warnings. `b5-await-using` is enabled but inert until re-declared with the
119
+ * project's docker-aware runner names:
120
+ *
121
+ * 'jterrazz/b5-await-using': ['error', { runners: ['dockerCli'] }]
122
+ */
123
+ declare const recommendedRules: Record<string, 'error' | 'warn'>;
124
+ /**
125
+ * The composable testing fragment — wire the plugin, enable the whole
126
+ * catalogue, and ship the one override every strict consumer needs. Designed
127
+ * to be composed with a base preset (e.g. `@jterrazz/typescript/oxlint`):
128
+ *
129
+ * import { compose, node } from '@jterrazz/typescript/oxlint';
130
+ * import { testing } from '@jterrazz/test/oxlint';
131
+ * export default compose(node, testing);
132
+ *
133
+ * `jsPlugins` registers the tool-facing entry; `rules` is {@link recommendedRules};
134
+ * `overrides` relaxes `import/exports-last` for `*.specification.ts` — the A4 idiom
135
+ * (`export const { cli, cleanup } … ; afterAll(cleanup)`) legitimately ends a spec
136
+ * file on a non-export statement, so the relaxation ships here rather than being
137
+ * hand-rolled in every consumer.
138
+ */
139
+ declare const testing: {
140
+ jsPlugins: string[];
141
+ overrides: {
142
+ files: string[];
143
+ rules: {
144
+ 'import/exports-last': string;
145
+ };
146
+ }[];
147
+ rules: Record<string, "error" | "warn">;
148
+ };
149
+ //#endregion
150
+ export { plugin as default, recommendedRules, testing };