@bleedingdev/modern-js-code-tools 3.9.0-ultramodern.2 → 3.9.0-ultramodern.4

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.
@@ -0,0 +1,338 @@
1
+ import node_fs from "node:fs";
2
+ import node_path from "node:path";
3
+ import { parse } from "@babel/parser";
4
+ import traverse, { Hub, NodePath } from "@babel/traverse";
5
+ import * as __rspack_external__babel_types_6e8337dd from "@babel/types";
6
+ const edge = '@modern-js/plugin-bff/effect-edge';
7
+ const sharedRuntime = /^@[^/]+\/shared-contracts\/server\/effect-bff-runtime$/u;
8
+ const failure = 'Generated API entries must export defineEffectBff(...) or the server-only shared Effect BFF assembly helper with an explicitly composed handler Layer and an unshadowed executable root; entries must implement handlers through HttpApiBuilder.group.';
9
+ const invalidSources = new WeakSet();
10
+ function invalidSource(message) {
11
+ const error = new Error(message);
12
+ invalidSources.add(error);
13
+ return error;
14
+ }
15
+ class SourceValidationHub extends Hub {
16
+ buildError(_node, message) {
17
+ return invalidSource(message);
18
+ }
19
+ }
20
+ function createEffectApiImportResolver(filename) {
21
+ const directory = node_fs.realpathSync(node_path.dirname(filename));
22
+ const owner = node_fs.realpathSync(node_path.resolve(directory, '..'));
23
+ const resolve = (from)=>(specifier)=>{
24
+ if (!specifier.startsWith('.')) return;
25
+ const target = node_path.resolve(node_path.dirname(from), specifier);
26
+ if (!target.startsWith(`${owner}${node_path.sep}`)) return;
27
+ for (const candidate of [
28
+ target,
29
+ `${target}.ts`,
30
+ `${target}.mts`
31
+ ])try {
32
+ const real = node_fs.realpathSync(candidate);
33
+ if (!real.startsWith(`${owner}${node_path.sep}`) || node_fs.statSync(real).size > 1000000) return;
34
+ return {
35
+ id: real,
36
+ source: node_fs.readFileSync(real, 'utf8'),
37
+ resolveImport: resolve(real)
38
+ };
39
+ } catch {}
40
+ };
41
+ return resolve(node_path.join(directory, node_path.basename(filename)));
42
+ }
43
+ function strictEffectRuntimeTopologyViolation(source, resolveImport) {
44
+ const modules = new Map();
45
+ const owners = new Map();
46
+ const paths = new Map();
47
+ const mutated = new Set();
48
+ const load = (input)=>{
49
+ const existing = modules.get(input.id);
50
+ if (existing) return existing;
51
+ if (modules.size >= 64 || input.source.length > 1000000) throw invalidSource('API source budget exceeded');
52
+ let file;
53
+ try {
54
+ file = parse(input.source, {
55
+ sourceType: 'module',
56
+ sourceFilename: input.id,
57
+ plugins: [
58
+ "typescript"
59
+ ]
60
+ });
61
+ } catch (cause) {
62
+ if ('object' == typeof cause && null !== cause && 'code' in cause && 'BABEL_PARSER_SYNTAX_ERROR' === cause.code && 'reasonCode' in cause && 'string' == typeof cause.reasonCode) throw invalidSource('Invalid API syntax');
63
+ throw cause;
64
+ }
65
+ const module = {
66
+ ...input,
67
+ file
68
+ };
69
+ modules.set(input.id, module);
70
+ const program = NodePath.get({
71
+ hub: new SourceValidationHub(),
72
+ parentPath: void 0,
73
+ parent: file,
74
+ container: file,
75
+ key: 'program'
76
+ });
77
+ program.setContext();
78
+ traverse(file, {
79
+ enter (nodePath) {
80
+ paths.set(nodePath.node, nodePath);
81
+ owners.set(nodePath.node, module);
82
+ if (nodePath.isAssignmentExpression() || nodePath.isUpdateExpression() || nodePath.isUnaryExpression({
83
+ operator: 'delete'
84
+ })) {
85
+ let target = nodePath.isAssignmentExpression() ? nodePath.node.left : nodePath.node.argument;
86
+ while(__rspack_external__babel_types_6e8337dd.isMemberExpression(target))target = target.object;
87
+ if (__rspack_external__babel_types_6e8337dd.isIdentifier(target)) {
88
+ const binding = nodePath.scope.getBinding(target.name);
89
+ if (binding) mutated.add(binding);
90
+ }
91
+ }
92
+ if (nodePath.isTSModuleDeclaration() && __rspack_external__babel_types_6e8337dd.isIdentifier(nodePath.node.id)) {
93
+ const binding = nodePath.scope.getBinding(nodePath.node.id.name);
94
+ if (binding) mutated.add(binding);
95
+ }
96
+ }
97
+ }, program.scope, void 0, program);
98
+ return module;
99
+ };
100
+ try {
101
+ const entry = load({
102
+ id: '/entry.ts',
103
+ source,
104
+ resolveImport
105
+ });
106
+ const unwrap = (node)=>{
107
+ while(__rspack_external__babel_types_6e8337dd.isParenthesizedExpression(node) || __rspack_external__babel_types_6e8337dd.isTSSatisfiesExpression(node) || __rspack_external__babel_types_6e8337dd.isTSAsExpression(node) || __rspack_external__babel_types_6e8337dd.isTSTypeAssertion(node) || __rspack_external__babel_types_6e8337dd.isTSNonNullExpression(node))node = node.expression;
108
+ return node;
109
+ };
110
+ const binding = (node)=>{
111
+ node = unwrap(node);
112
+ if (!__rspack_external__babel_types_6e8337dd.isIdentifier(node)) return;
113
+ const nodePath = paths.get(node);
114
+ if (!nodePath) throw new Error('Missing API lexical scope');
115
+ const value = nodePath.scope.getBinding(node.name);
116
+ return value?.constant && !mutated.has(value) ? value : void 0;
117
+ };
118
+ const declaration = (node)=>binding(node)?.path.node;
119
+ const imported = (node)=>{
120
+ const value = binding(node);
121
+ const decl = value?.path.node;
122
+ if (!decl || !__rspack_external__babel_types_6e8337dd.isImportSpecifier(decl) || 'type' === decl.importKind) return;
123
+ const statement = value.path.parent;
124
+ if (!__rspack_external__babel_types_6e8337dd.isImportDeclaration(statement) || 'type' === statement.importKind) return;
125
+ return {
126
+ name: __rspack_external__babel_types_6e8337dd.isIdentifier(decl.imported) ? decl.imported.name : decl.imported.value,
127
+ specifier: statement.source.value
128
+ };
129
+ };
130
+ const native = (node, name, sources = [
131
+ edge
132
+ ])=>{
133
+ const value = imported(node);
134
+ return value?.name === name && sources.includes(value.specifier);
135
+ };
136
+ const method = (node, namespace, member, sources = [
137
+ edge
138
+ ])=>{
139
+ node = unwrap(node);
140
+ return __rspack_external__babel_types_6e8337dd.isMemberExpression(node) && !node.computed && __rspack_external__babel_types_6e8337dd.isIdentifier(node.property, {
141
+ name: member
142
+ }) && native(node.object, namespace, sources);
143
+ };
144
+ const initialized = (node)=>{
145
+ const value = binding(node);
146
+ return value?.kind === 'const' && __rspack_external__babel_types_6e8337dd.isVariableDeclarator(value.path.node) ? value.path.node.init ?? void 0 : void 0;
147
+ };
148
+ const moduleFor = (node)=>{
149
+ const value = imported(node);
150
+ if (!value) return;
151
+ const input = owners.get(node)?.resolveImport?.(value.specifier);
152
+ return input ? {
153
+ module: load(input),
154
+ name: value.name
155
+ } : void 0;
156
+ };
157
+ const exported = (module, name)=>{
158
+ for (const statement of module.file.program.body)if (__rspack_external__babel_types_6e8337dd.isExportNamedDeclaration(statement) && 'type' !== statement.exportKind) {
159
+ if (__rspack_external__babel_types_6e8337dd.isVariableDeclaration(statement.declaration)) {
160
+ for (const decl of statement.declaration.declarations)if (__rspack_external__babel_types_6e8337dd.isIdentifier(decl.id, {
161
+ name
162
+ })) return decl.id;
163
+ }
164
+ if (!statement.source) {
165
+ const specifier = statement.specifiers.find((element)=>__rspack_external__babel_types_6e8337dd.isExportSpecifier(element) && 'type' !== element.exportKind && (__rspack_external__babel_types_6e8337dd.isIdentifier(element.exported) ? element.exported.name : element.exported.value) === name);
166
+ if (__rspack_external__babel_types_6e8337dd.isExportSpecifier(specifier)) return specifier.local;
167
+ }
168
+ }
169
+ };
170
+ const externalValue = (node)=>{
171
+ const value = moduleFor(node);
172
+ return value ? exported(value.module, value.name) : void 0;
173
+ };
174
+ const apiIdentity = (node, seen = new Set())=>{
175
+ node = unwrap(node);
176
+ if (seen.has(node)) return;
177
+ seen.add(node);
178
+ const value = imported(node);
179
+ if (value) {
180
+ if (!value.specifier.startsWith('.')) return;
181
+ const module = moduleFor(node);
182
+ const exportedValue = module && exported(module.module, module.name);
183
+ if (exportedValue) return apiIdentity(exportedValue, seen);
184
+ if (module && /(?:^|\/)shared\/(?:api|rpc)\.ts$/u.test(value.specifier)) return `${module.module.id}:import:${value.name}`;
185
+ if (!owners.get(node)?.resolveImport && /(?:^|\/)shared\/(?:api|rpc)\.ts$/u.test(value.specifier)) return `${value.specifier}:${value.name}`;
186
+ return;
187
+ }
188
+ const init = initialized(node);
189
+ if (init && __rspack_external__babel_types_6e8337dd.isIdentifier(unwrap(init))) return apiIdentity(init, seen);
190
+ const valueBinding = binding(node);
191
+ return valueBinding ? `${owners.get(valueBinding.path.node)?.id}:${valueBinding.identifier.start}` : void 0;
192
+ };
193
+ const properties = (node)=>{
194
+ node = unwrap(node);
195
+ if (!__rspack_external__babel_types_6e8337dd.isObjectExpression(node)) return;
196
+ const result = new Map();
197
+ for (const prop of node.properties){
198
+ if (!__rspack_external__babel_types_6e8337dd.isObjectProperty(prop) || prop.computed || !__rspack_external__babel_types_6e8337dd.isIdentifier(prop.key) || result.has(prop.key.name)) return;
199
+ result.set(prop.key.name, prop.value);
200
+ }
201
+ return result;
202
+ };
203
+ const active = new Set();
204
+ const guarded = (node, check)=>{
205
+ node = unwrap(node);
206
+ if (active.has(node) || active.size > 128) return false;
207
+ active.add(node);
208
+ try {
209
+ return check(node);
210
+ } finally{
211
+ active.delete(node);
212
+ }
213
+ };
214
+ const layerSources = [
215
+ edge,
216
+ 'effect'
217
+ ];
218
+ const returned = (body)=>{
219
+ if (!__rspack_external__babel_types_6e8337dd.isBlockStatement(body)) return body;
220
+ const statements = body.body;
221
+ const last = statements.at(-1);
222
+ return statements.slice(0, -1).every((statement)=>__rspack_external__babel_types_6e8337dd.isVariableDeclaration(statement)) && __rspack_external__babel_types_6e8337dd.isReturnStatement(last) ? last.argument : void 0;
223
+ };
224
+ const pipe = (node, check)=>__rspack_external__babel_types_6e8337dd.isMemberExpression(node.callee) && !node.callee.computed && __rspack_external__babel_types_6e8337dd.isIdentifier(node.callee.property, {
225
+ name: 'pipe'
226
+ }) && check(node.callee.object) && node.arguments.every((argument)=>method(argument, 'Layer', 'orDie', layerSources) || __rspack_external__babel_types_6e8337dd.isCallExpression(argument) && method(argument.callee, 'Layer', 'provide', layerSources) && argument.arguments.length > 0);
227
+ const handled = (node)=>{
228
+ node = unwrap(node);
229
+ if (!__rspack_external__babel_types_6e8337dd.isArrowFunctionExpression(node) && !__rspack_external__babel_types_6e8337dd.isFunctionExpression(node)) return false;
230
+ const parameter = node.params[0];
231
+ if (!__rspack_external__babel_types_6e8337dd.isIdentifier(parameter)) return false;
232
+ const body = returned(node.body);
233
+ const chain = (value, count = 0)=>{
234
+ value = unwrap(value);
235
+ if (__rspack_external__babel_types_6e8337dd.isIdentifier(value)) return count > 0 && declaration(value) === parameter;
236
+ return __rspack_external__babel_types_6e8337dd.isCallExpression(value) && __rspack_external__babel_types_6e8337dd.isMemberExpression(value.callee) && !value.callee.computed && __rspack_external__babel_types_6e8337dd.isIdentifier(value.callee.property) && [
237
+ 'handle',
238
+ 'handleRaw'
239
+ ].includes(value.callee.property.name) && 2 === value.arguments.length && chain(value.callee.object, count + 1);
240
+ };
241
+ return !!body && chain(body);
242
+ };
243
+ const handlers = (node, api)=>guarded(node, (node)=>{
244
+ const init = initialized(node) ?? externalValue(node);
245
+ if (init) return handlers(init, api);
246
+ if (!__rspack_external__babel_types_6e8337dd.isCallExpression(node)) return false;
247
+ if (pipe(node, (value)=>handlers(value, api))) return true;
248
+ if (method(node.callee, 'Layer', 'mergeAll', layerSources)) return node.arguments.length > 0 && node.arguments.every((argument)=>handlers(argument, api));
249
+ return method(node.callee, 'HttpApiBuilder', 'group') && 3 === node.arguments.length && apiIdentity(node.arguments[0]) === api && handled(node.arguments[2]);
250
+ });
251
+ const transport = (node)=>guarded(node, (node)=>{
252
+ const init = initialized(node);
253
+ if (init) return transport(init);
254
+ if (!__rspack_external__babel_types_6e8337dd.isCallExpression(node)) return method(node, 'Layer', 'empty', layerSources);
255
+ return pipe(node, transport) || method(node.callee, 'HttpRouter', 'cors') || method(node.callee, 'Layer', 'mergeAll', layerSources) && node.arguments.length > 0 && node.arguments.every(transport);
256
+ });
257
+ const directLayer = (node, api)=>guarded(node, (node)=>{
258
+ const init = initialized(node);
259
+ if (init) return directLayer(init, api);
260
+ if (!__rspack_external__babel_types_6e8337dd.isCallExpression(node) || !__rspack_external__babel_types_6e8337dd.isMemberExpression(node.callee) || node.callee.computed || !__rspack_external__babel_types_6e8337dd.isIdentifier(node.callee.property, {
261
+ name: 'pipe'
262
+ })) return false;
263
+ const base = unwrap(node.callee.object);
264
+ return __rspack_external__babel_types_6e8337dd.isCallExpression(base) && method(base.callee, 'HttpApiBuilder', 'layer') && 1 === base.arguments.length && apiIdentity(base.arguments[0]) === api && node.arguments.length > 0 && node.arguments.every((argument)=>__rspack_external__babel_types_6e8337dd.isCallExpression(argument) && method(argument.callee, 'Layer', 'provide', layerSources) && 1 === argument.arguments.length && handlers(argument.arguments[0], api));
265
+ });
266
+ const rpc = (values)=>{
267
+ const api = values.get('api');
268
+ const apiLayer = values.get('layer');
269
+ const apiInit = api && (initialized(api) ?? unwrap(api));
270
+ if (!apiInit || !__rspack_external__babel_types_6e8337dd.isCallExpression(apiInit) || !method(apiInit.callee, 'HttpApi', 'make') || 1 !== apiInit.arguments.length || !apiLayer || !transport(apiLayer)) return false;
271
+ const config = values.get('rpc');
272
+ const fields = config && properties(config);
273
+ const route = fields?.get('path');
274
+ const serialization = fields?.get('serialization');
275
+ if (!__rspack_external__babel_types_6e8337dd.isStringLiteral(route, {
276
+ value: '/rpc'
277
+ }) || !__rspack_external__babel_types_6e8337dd.isStringLiteral(serialization, {
278
+ value: 'json'
279
+ })) return false;
280
+ const group = fields?.get('group');
281
+ const layer = fields?.get('layer');
282
+ const value = group && imported(group);
283
+ if (!group || !layer || value?.specifier !== '../shared/rpc.ts') return false;
284
+ const groupValue = externalValue(group);
285
+ const groupInit = groupValue && initialized(groupValue);
286
+ if (!groupInit || !__rspack_external__babel_types_6e8337dd.isCallExpression(groupInit) || !method(groupInit.callee, 'RpcGroup', 'make', [
287
+ 'effect/unstable/rpc',
288
+ '@modern-js/plugin-bff/effect-client'
289
+ ])) return false;
290
+ const layerInit = initialized(layer) ?? unwrap(layer);
291
+ if (!__rspack_external__babel_types_6e8337dd.isCallExpression(layerInit) || !__rspack_external__babel_types_6e8337dd.isMemberExpression(layerInit.callee) || layerInit.callee.computed || !__rspack_external__babel_types_6e8337dd.isIdentifier(layerInit.callee.property, {
292
+ name: 'toLayer'
293
+ }) || apiIdentity(layerInit.callee.object) !== apiIdentity(group) || 1 !== layerInit.arguments.length) return false;
294
+ const implementation = unwrap(layerInit.arguments[0]);
295
+ if (!__rspack_external__babel_types_6e8337dd.isCallExpression(implementation) || !__rspack_external__babel_types_6e8337dd.isMemberExpression(implementation.callee) || implementation.callee.computed || !__rspack_external__babel_types_6e8337dd.isIdentifier(implementation.callee.property, {
296
+ name: 'of'
297
+ }) || apiIdentity(implementation.callee.object) !== apiIdentity(group) || 1 !== implementation.arguments.length) return false;
298
+ const entries = properties(implementation.arguments[0]);
299
+ return !!entries?.size && [
300
+ ...entries.values()
301
+ ].every((value)=>__rspack_external__babel_types_6e8337dd.isArrowFunctionExpression(value) || __rspack_external__babel_types_6e8337dd.isFunctionExpression(value));
302
+ };
303
+ const runtime = (node)=>guarded(node, (node)=>{
304
+ const init = initialized(node);
305
+ if (init) return runtime(init);
306
+ if (!__rspack_external__babel_types_6e8337dd.isCallExpression(node)) return false;
307
+ const value = imported(node.callee);
308
+ if (value?.name === 'defineEffectBff' && value.specifier === edge || value?.name === 'assembleEffectBffRuntime' && sharedRuntime.test(value.specifier)) {
309
+ if (1 !== node.arguments.length) return false;
310
+ const values = properties(node.arguments[0]);
311
+ if (!values) return false;
312
+ if ('defineEffectBff' === value.name && values.has('rpc')) return rpc(values);
313
+ const api = values.get('api');
314
+ const apiBinding = api && imported(api);
315
+ if (!api || apiBinding?.specifier !== '../shared/api.ts') return false;
316
+ const identity = apiIdentity(api);
317
+ if (!identity) return false;
318
+ const layer = values.get('defineEffectBff' === value.name ? 'layer' : 'handlers');
319
+ const extra = values.get('transport');
320
+ return void 0 !== layer && ('defineEffectBff' === value.name ? directLayer(layer, identity) : handlers(layer, identity)) && (!extra || transport(extra));
321
+ }
322
+ const decl = declaration(node.callee);
323
+ const factory = decl && __rspack_external__babel_types_6e8337dd.isFunctionDeclaration(decl) ? decl : initialized(node.callee);
324
+ if (!factory || !__rspack_external__babel_types_6e8337dd.isFunctionDeclaration(factory) && !__rspack_external__babel_types_6e8337dd.isArrowFunctionExpression(factory) && !__rspack_external__babel_types_6e8337dd.isFunctionExpression(factory) || !factory.body) return false;
325
+ const result = returned(factory.body);
326
+ return !!result && runtime(result);
327
+ });
328
+ const root = entry.file.program.body.find((statement)=>__rspack_external__babel_types_6e8337dd.isExportDefaultDeclaration(statement));
329
+ return root && runtime(root.declaration) ? void 0 : failure;
330
+ } catch (cause) {
331
+ if ('object' == typeof cause && null !== cause && invalidSources.has(cause)) return failure;
332
+ const message = 'object' == typeof cause && null !== cause && 'message' in cause && 'string' == typeof cause.message ? cause.message : String(cause);
333
+ throw new Error(`Strict Effect API analysis failed: ${message}`, {
334
+ cause
335
+ });
336
+ }
337
+ }
338
+ export { createEffectApiImportResolver, strictEffectRuntimeTopologyViolation };
@@ -4,7 +4,7 @@ import node_fs from "node:fs";
4
4
  import { createRequire } from "node:module";
5
5
  import node_os from "node:os";
6
6
  import node_path from "node:path";
7
- import { fileURLToPath } from "node:url";
7
+ import { fileURLToPath, pathToFileURL } from "node:url";
8
8
  const oxlint_require = createRequire(import.meta.url);
9
9
  const ignoredDirectories = new Set([
10
10
  '.modern',
@@ -74,22 +74,26 @@ const runOxlintRules = ({ cwd, targets, rules })=>{
74
74
  stdout: '',
75
75
  stderr: ''
76
76
  };
77
+ const pluginPath = resolvePluginPath();
77
78
  const tempDir = node_fs.mkdtempSync(node_path.join(node_os.tmpdir(), 'modern-code-tools-oxlint-'));
78
79
  const configPath = node_path.join(tempDir, 'oxlint.config.mjs');
79
- const pluginPath = resolvePluginPath();
80
- node_fs.writeFileSync(configPath, `export default {
81
- jsPlugins: [${JSON.stringify(pluginPath)}],
80
+ const adapterPath = node_path.join(tempDir, 'oxlint-plugin.mjs');
81
+ try {
82
+ node_fs.writeFileSync(adapterPath, `import plugin from ${JSON.stringify(pathToFileURL(pluginPath).href)};
83
+ export default plugin.rules ? plugin : plugin.default;
84
+ `, 'utf-8');
85
+ node_fs.writeFileSync(configPath, `export default {
86
+ jsPlugins: [${JSON.stringify(adapterPath)}],
82
87
  rules: ${JSON.stringify(rules, null, 2)}
83
88
  };
84
89
  `, 'utf-8');
85
- try {
86
90
  const result = spawnSync(process.execPath, [
87
91
  resolveOxlintBin(),
88
92
  ...resolvedTargets,
89
93
  '--config',
90
94
  configPath,
91
95
  '--format',
92
- 'unix',
96
+ 'default',
93
97
  '--quiet'
94
98
  ], {
95
99
  cwd,
@@ -1,4 +1,5 @@
1
1
  import "node:module";
2
+ import { createEffectApiImportResolver, strictEffectRuntimeTopologyViolation } from "../../strict-effect-runtime.js";
2
3
  import { getSourceText, isApiEntryFile, isApiSourceFile, isForbiddenGeneratedEffectPath, isSharedApiContractFile, normalizeFilename, reportMissingProgramPattern, reportProgramPattern } from "../ast.js";
3
4
  const createStrictEffectApiBoundariesRule = ()=>({
4
5
  meta: {
@@ -23,10 +24,11 @@ const createStrictEffectApiBoundariesRule = ()=>({
23
24
  reportProgramPattern(context, node, source, /(?:from|import)\s*['"][^'"]*(?:api\/effect|shared\/effect)[^'"]*['"]|shared-effect-api/u, 'Import API code from direct api/index.ts, shared/api.ts or src/api/* paths, not api/effect, shared/effect or shared Effect API packages.');
24
25
  reportProgramPattern(context, node, source, /\bstrictEffectApproach\s*(?::|=)\s*false\b/u, 'UltraModern API apps must keep strictEffectApproach enabled.');
25
26
  if (isApiEntryFile(filename)) {
26
- reportMissingProgramPattern(context, node, source, /\bdefineEffectBff\b/u, 'Generated API entries must export defineEffectBff(...).');
27
- reportMissingProgramPattern(context, node, source, /\bHttpApiBuilder\b/u, 'Generated API entries must implement handlers through HttpApiBuilder.');
28
- reportMissingProgramPattern(context, node, source, /\bLayer\b/u, 'Generated API entries must compose dependencies with Effect Layer.');
29
- reportMissingProgramPattern(context, node, source, /from\s+['"]\.\.\/shared\/api\.ts['"]/u, 'Generated API entries must import the contract from ../shared/api.ts.');
27
+ const violation = strictEffectRuntimeTopologyViolation(source, createEffectApiImportResolver(filename));
28
+ if (violation) context.report({
29
+ node,
30
+ message: violation
31
+ });
30
32
  }
31
33
  if (isSharedApiContractFile(filename)) {
32
34
  reportMissingProgramPattern(context, node, source, /\bHttpApi\.make\b/u, 'Generated shared API contracts must declare an HttpApi contract.');