@noego/trust 0.5.0-dev.2 → 0.5.0-dev.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.
@@ -1,5 +1,5 @@
1
- import { T as TypeScript, a as TsconfigMapping, Z as ZoneGroup, F as Finding } from '../baseline-Bkav9mS0.js';
2
- export { B as BaselineCounts, b as BaselineDelta, c as BaselineFinding, d as BaselineScope, e as LineDirective, W as WHOLE_BASELINE, f as Zone, g as Zones, h as compareToBaseline, i as countFindings, j as describeBaselineDelta, k as directiveDirectlyAbove, l as directiveReason, m as groupMatches, n as isNamedDirective, o as lineDirectivesIn, p as loadTypeScript, q as matchesPatterns, r as nearestPackageName, s as nodeBelow, t as normalizePattern, u as parseBaseline, v as readBaseline, w as realpathOrSelf, x as relativeInside, y as serializeBaseline, z as toPosix, A as updateBaseline } from '../baseline-Bkav9mS0.js';
1
+ import { T as TypeScript, a as TsconfigMapping, Z as ZoneGroup, F as Finding } from '../baseline-DQGyHwig.js';
2
+ export { B as BaselineCounts, b as BaselineDelta, c as BaselineFinding, d as BaselineScope, e as LineDirective, W as WHOLE_BASELINE, f as Zone, g as Zones, h as compareToBaseline, i as countFindings, j as describeBaselineDelta, k as directiveDirectlyAbove, l as directiveReason, m as groupMatches, n as isNamedDirective, o as lineDirectivesIn, p as loadTypeScript, q as matchesPatterns, r as nearestPackageName, s as nodeBelow, t as normalizePattern, u as parseBaseline, v as readBaseline, w as realpathOrSelf, x as relativeInside, y as serializeBaseline, z as toPosix, A as updateBaseline } from '../baseline-DQGyHwig.js';
3
3
  import * as TS from 'typescript';
4
4
 
5
5
  /** Absolute paths, sorted and deduplicated: named files as-is, directories walked for .ts/.tsx. */
@@ -5,7 +5,7 @@ import {
5
5
  formatWalkFailure,
6
6
  relativeTo,
7
7
  resolveFiles
8
- } from "../chunk-XXLWC5DB.js";
8
+ } from "../chunk-TQWRH47T.js";
9
9
  import {
10
10
  WHOLE_BASELINE,
11
11
  Zones,
@@ -34,7 +34,7 @@ import {
34
34
  sourceFileOf,
35
35
  toPosix,
36
36
  updateBaseline
37
- } from "../chunk-UG6D3V4M.js";
37
+ } from "../chunk-6YBPW4NP.js";
38
38
 
39
39
  // src/core/tool-config.ts
40
40
  import { existsSync, readFileSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  import * as eslint from 'eslint';
2
2
  import { Linter, ESLint } from 'eslint';
3
- import { g as Zones, O as OriginResolver, C as TrustRuleSettings, T as TypeScript, D as TrustConfig, E as OriginInfo, G as CatchProblem } from '../baseline-Bkav9mS0.js';
4
- export { H as ACCEPT_DIRECTIVE, I as ACCEPT_DIRECTIVE_MESSAGES, B as BaselineCounts, b as BaselineDelta, d as BaselineScope, J as CATCH_ORIGIN, K as DEFAULT_RULE_SETTINGS, L as DIRECTIVE_ORIGIN, M as DROPPED_RESULT_MESSAGES, N as DROPPED_RESULT_RULE, P as DroppedResultOrigin, F as Finding, Q as LoadTrustConfigOptions, R as OptInRule, S as REDUNDANT_GUARD_MESSAGES, U as REDUNDANT_GUARD_ORIGIN, V as REDUNDANT_GUARD_RULE, X as RuleSwitch, Y as THROW_MESSAGES, _ as THROW_RULE, $ as TYPE_CLAIM_KINDS, a0 as TYPE_CLAIM_MESSAGES, a1 as TYPE_CLAIM_RULE, a2 as TrustConfigError, a3 as TrustEntry, a4 as TrustLevel, a as TsconfigMapping, a5 as TypeClaimOrigin, a6 as UNANALYZABLE_ORIGIN, a7 as UNTRUSTED_CALL_MESSAGES, a8 as UNTRUSTED_CALL_RULE, a9 as UNTRUSTED_VALUE_MESSAGES, aa as UNTRUSTED_VALUE_RULE, ab as UntrustedCallbacks, ac as UntrustedEntry, ad as VALIDATOR_DIRECTIVE, W as WHOLE_BASELINE, f as Zone, Z as ZoneGroup, h as compareToBaseline, i as countFindings, ae as effectiveTrustList, af as effectiveTypeTrustList, ag as isInsideValidator, ah as isMarkedValidator, ai as isRuleEnabled, aj as loadTrustConfig, ak as normalizeOrigin, u as parseBaseline, y as serializeBaseline, A as updateBaseline } from '../baseline-Bkav9mS0.js';
3
+ import { g as Zones, O as OriginResolver, C as TrustRuleSettings, T as TypeScript, D as TrustConfig, E as OriginInfo, G as CatchProblem } from '../baseline-DQGyHwig.js';
4
+ export { H as ACCEPT_DIRECTIVE, I as ACCEPT_DIRECTIVE_MESSAGES, J as BOUNDARY_MESSAGES, K as BOUNDARY_RULE, B as BaselineCounts, b as BaselineDelta, d as BaselineScope, L as BoundaryGroup, M as BoundaryOrigin, N as CATCH_ORIGIN, P as DEFAULT_RULE_SETTINGS, Q as DIRECTIVE_ORIGIN, R as DROPPED_RESULT_MESSAGES, S as DROPPED_RESULT_RULE, U as DroppedResultOrigin, F as Finding, V as LoadTrustConfigOptions, X as OptInRule, Y as REDUNDANT_GUARD_MESSAGES, _ as REDUNDANT_GUARD_ORIGIN, $ as REDUNDANT_GUARD_RULE, a0 as RuleSwitch, a1 as THROW_MESSAGES, a2 as THROW_RULE, a3 as TYPE_CLAIM_KINDS, a4 as TYPE_CLAIM_MESSAGES, a5 as TYPE_CLAIM_RULE, a6 as TrustConfigError, a7 as TrustEntry, a8 as TrustLevel, a as TsconfigMapping, a9 as TypeClaimOrigin, aa as UNANALYZABLE_ORIGIN, ab as UNTRUSTED_CALL_MESSAGES, ac as UNTRUSTED_CALL_RULE, ad as UNTRUSTED_VALUE_MESSAGES, ae as UNTRUSTED_VALUE_RULE, af as UntrustedCallbacks, ag as UntrustedEntry, ah as VALIDATOR_DIRECTIVE, W as WHOLE_BASELINE, f as Zone, Z as ZoneGroup, h as compareToBaseline, i as countFindings, ai as effectiveTrustList, aj as effectiveTypeTrustList, ak as isInsideValidator, al as isMarkedValidator, am as isRuleEnabled, an as loadTrustConfig, ao as normalizeOrigin, u as parseBaseline, y as serializeBaseline, A as updateBaseline } from '../baseline-DQGyHwig.js';
5
5
  import * as TS from 'typescript';
6
6
 
7
7
  interface PresetDefinition {
@@ -158,6 +158,7 @@ declare const rules: {
158
158
  'untrusted-value': eslint.Rule.RuleModule;
159
159
  'dropped-result': eslint.Rule.RuleModule;
160
160
  'redundant-guard': eslint.Rule.RuleModule;
161
+ 'boundary-result': eslint.Rule.RuleModule;
161
162
  };
162
163
  interface TypedConfigOptions {
163
164
  /** Files to check (flat-config globs). They must be in a tsconfig the project service can find. */
@@ -3,6 +3,8 @@ import {
3
3
  acceptDirectiveFindings,
4
4
  acceptanceOf,
5
5
  alwaysExits,
6
+ boundaryContext,
7
+ boundaryFindingsIn,
6
8
  catchProblem,
7
9
  claimSpan,
8
10
  droppedResultContext,
@@ -11,6 +13,7 @@ import {
11
13
  emptyTrustConfig,
12
14
  entryMatches,
13
15
  guardOf,
16
+ isStrictByConfig,
14
17
  nameBasedGuardContext,
15
18
  policyFor,
16
19
  redundantGuardData,
@@ -26,10 +29,12 @@ import {
26
29
  untrustedValueData,
27
30
  untrustedValueMessageId,
28
31
  untrustedValuesIn
29
- } from "../chunk-7PY2Q6OX.js";
32
+ } from "../chunk-LJJDRFO7.js";
30
33
  import {
31
34
  ACCEPT_DIRECTIVE,
32
35
  ACCEPT_DIRECTIVE_MESSAGES,
36
+ BOUNDARY_MESSAGES,
37
+ BOUNDARY_RULE,
33
38
  CATCH_ORIGIN,
34
39
  DEFAULT_RULE_SETTINGS,
35
40
  DIRECTIVE_ORIGIN,
@@ -68,7 +73,7 @@ import {
68
73
  parseBaseline,
69
74
  serializeBaseline,
70
75
  updateBaseline
71
- } from "../chunk-UG6D3V4M.js";
76
+ } from "../chunk-6YBPW4NP.js";
72
77
 
73
78
  // src/eslint/rule-setup.ts
74
79
  import { resolve } from "path";
@@ -118,7 +123,7 @@ function setupRule(context) {
118
123
  const { tsNode, sourceFile } = map ? mapLocator(ts, context, map) : rangeLocator(ts, context);
119
124
  if (!program || !map) {
120
125
  const zones = new Zones(config.rootDir, config.passthrough, config.ignore);
121
- return { ts, zone: zones.zoneOf(context.filename), policy: null, guardContext: nameBasedGuardContext(ts), tsNode, checker: null, rules: config.rules, sourceFile };
126
+ return { ts, zone: zones.zoneOf(context.filename), policy: null, guardContext: nameBasedGuardContext(ts), tsNode, checker: null, program: null, config, rules: config.rules, sourceFile };
122
127
  }
123
128
  const checker = program.getTypeChecker();
124
129
  const policy = policyFor(ts, checker, config, (options.trust ?? []).map(normalizeOrigin));
@@ -129,13 +134,45 @@ function setupRule(context) {
129
134
  guardContext: typedGuardContext(ts, checker, policy),
130
135
  tsNode,
131
136
  checker,
137
+ program,
138
+ config,
132
139
  rules: config.rules,
133
140
  sourceFile
134
141
  };
135
142
  }
136
143
 
137
- // src/eslint/rules/dropped-result.ts
144
+ // src/eslint/rules/boundary-result.ts
138
145
  var rule = {
146
+ meta: {
147
+ type: "problem",
148
+ docs: { description: "Report every boundary (exported function or public member of a configured boundary file) whose return value can fail." },
149
+ schema: OPTIONS_SCHEMA,
150
+ messages: BOUNDARY_MESSAGES
151
+ },
152
+ create(context) {
153
+ const setup = setupRule(context);
154
+ if (setup.config.boundaries.length === 0) return {};
155
+ if (!setup.policy || !setup.checker || !setup.program) {
156
+ throw new Error("boundary-result requires typed linting (parserOptions.projectService or project).");
157
+ }
158
+ if (setup.zone !== "checked") return {};
159
+ const { ts, tsNode, checker, policy, program, config } = setup;
160
+ const { sourceCode } = context;
161
+ return {
162
+ Program(node) {
163
+ const sourceFile = tsNode(node, ts.isSourceFile);
164
+ const strict = isStrictByConfig(config, sourceFile.fileName);
165
+ for (const found of boundaryFindingsIn(sourceFile, boundaryContext(ts, checker, program, policy, config), strict)) {
166
+ context.report({ loc: sourceCode.getLocFromIndex(found.start), messageId: found.origin, data: { ...found.data } });
167
+ }
168
+ }
169
+ };
170
+ }
171
+ };
172
+ var boundary_result_default = rule;
173
+
174
+ // src/eslint/rules/dropped-result.ts
175
+ var rule2 = {
139
176
  meta: {
140
177
  type: "problem",
141
178
  docs: { description: "Report every place a Result that can still fail is dropped instead of returned or handled." },
@@ -161,10 +198,10 @@ var rule = {
161
198
  };
162
199
  }
163
200
  };
164
- var dropped_result_default = rule;
201
+ var dropped_result_default = rule2;
165
202
 
166
203
  // src/eslint/rules/redundant-guard.ts
167
- var rule2 = {
204
+ var rule3 = {
168
205
  meta: {
169
206
  type: "problem",
170
207
  docs: { description: "Report every guard (Trust.try / Trust.tryAsync / try-catch) around code that cannot fail." },
@@ -191,10 +228,10 @@ var rule2 = {
191
228
  };
192
229
  }
193
230
  };
194
- var redundant_guard_default = rule2;
231
+ var redundant_guard_default = rule3;
195
232
 
196
233
  // src/eslint/rules/throw-must-return-result.ts
197
- var rule3 = {
234
+ var rule4 = {
198
235
  meta: {
199
236
  type: "problem",
200
237
  docs: { description: "Require every throw to be caught locally and returned as Result.err." },
@@ -223,10 +260,10 @@ var rule3 = {
223
260
  };
224
261
  }
225
262
  };
226
- var throw_must_return_result_default = rule3;
263
+ var throw_must_return_result_default = rule4;
227
264
 
228
265
  // src/eslint/rules/type-claim.ts
229
- var rule4 = {
266
+ var rule5 = {
230
267
  meta: {
231
268
  type: "problem",
232
269
  docs: { description: "Report every place a type is claimed instead of proven." },
@@ -254,10 +291,10 @@ var rule4 = {
254
291
  };
255
292
  }
256
293
  };
257
- var type_claim_default = rule4;
294
+ var type_claim_default = rule5;
258
295
 
259
296
  // src/eslint/rules/untrusted-call-must-return-result.ts
260
- var rule5 = {
297
+ var rule6 = {
261
298
  meta: {
262
299
  type: "problem",
263
300
  docs: { description: "Require calls into untrusted code to be handled locally and returned as Result.err." },
@@ -280,10 +317,10 @@ var rule5 = {
280
317
  return { CallExpression: check, NewExpression: check };
281
318
  }
282
319
  };
283
- var untrusted_call_must_return_result_default = rule5;
320
+ var untrusted_call_must_return_result_default = rule6;
284
321
 
285
322
  // src/eslint/rules/untrusted-value.ts
286
- var rule6 = {
323
+ var rule7 = {
287
324
  meta: {
288
325
  type: "problem",
289
326
  docs: { description: "Report every use of a value whose type was declared by an origin that is not type-trusted." },
@@ -315,7 +352,7 @@ var rule6 = {
315
352
  };
316
353
  }
317
354
  };
318
- var untrusted_value_default = rule6;
355
+ var untrusted_value_default = rule7;
319
356
 
320
357
  // src/eslint/index.ts
321
358
  var rules = {
@@ -324,7 +361,8 @@ var rules = {
324
361
  "type-claim": type_claim_default,
325
362
  "untrusted-value": untrusted_value_default,
326
363
  "dropped-result": dropped_result_default,
327
- "redundant-guard": redundant_guard_default
364
+ "redundant-guard": redundant_guard_default,
365
+ "boundary-result": boundary_result_default
328
366
  };
329
367
  var plugin = {
330
368
  meta: { name: "@noego/trust" },
@@ -346,7 +384,8 @@ function typedConfig(options) {
346
384
  "trust/type-claim": [severity, ruleOptions],
347
385
  "trust/untrusted-value": [severity, ruleOptions],
348
386
  "trust/dropped-result": [severity, ruleOptions],
349
- "trust/redundant-guard": [severity, ruleOptions]
387
+ "trust/redundant-guard": [severity, ruleOptions],
388
+ "trust/boundary-result": [severity, ruleOptions]
350
389
  }
351
390
  }
352
391
  ];
@@ -354,6 +393,8 @@ function typedConfig(options) {
354
393
  export {
355
394
  ACCEPT_DIRECTIVE,
356
395
  ACCEPT_DIRECTIVE_MESSAGES,
396
+ BOUNDARY_MESSAGES,
397
+ BOUNDARY_RULE,
357
398
  CATCH_ORIGIN,
358
399
  DEFAULT_RULE_SETTINGS,
359
400
  DIRECTIVE_ORIGIN,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/eslint/rule-setup.ts","../../src/eslint/rules/dropped-result.ts","../../src/eslint/rules/redundant-guard.ts","../../src/eslint/rules/throw-must-return-result.ts","../../src/eslint/rules/type-claim.ts","../../src/eslint/rules/untrusted-call-must-return-result.ts","../../src/eslint/rules/untrusted-value.ts","../../src/eslint/index.ts"],"sourcesContent":["// Shared per-file setup for both rules: trust config, file zone, guard context, and the mapping from\n// ESLint's ESTree nodes to the TypeScript nodes the shared rule logic (../core/rules.ts) works on.\nimport { resolve } from 'node:path';\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { emptyTrustConfig, policyFor } from '../core/check-file.js';\nimport type { GuardContext } from '../core/guard.js';\nimport { nameBasedGuardContext, typedGuardContext } from '../core/rules.js';\nimport { loadTrustConfigCached, normalizeOrigin, type TrustRuleSettings } from './config.js';\nimport type { TrustPolicy } from './policy.js';\nimport { loadTypeScript, type TypeScript } from './typescript.js';\nimport { Zones, type Zone } from './zones.js';\n\nexport interface TrustRuleOptions {\n /** trust.config.json path, relative to the ESLint cwd. */\n readonly configFile?: string;\n /** Extra trusted origins (applied before the config chain). */\n readonly trust?: readonly string[];\n}\n\nexport const OPTIONS_SCHEMA = [\n {\n type: 'object',\n properties: {\n configFile: { type: 'string' },\n trust: { type: 'array', items: { type: 'string' } },\n },\n additionalProperties: false,\n },\n] as const;\n\ninterface ParserServices {\n readonly program?: TS.Program | null;\n readonly esTreeNodeToTSNodeMap?: { get(node: unknown): TS.Node };\n}\n\n/** ESTree node as ESLint hands it to a rule (ranges are always present). */\ntype EsNode = Rule.Node | { readonly range?: [number, number] };\n\nexport interface RuleSetup {\n readonly ts: TypeScript;\n readonly zone: Zone;\n readonly policy: TrustPolicy | null;\n readonly guardContext: GuardContext;\n /** Maps an ESTree node to its TypeScript node of the given kind. */\n readonly tsNode: <T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T) => T;\n readonly checker: TS.TypeChecker | null;\n /** The trust config's per-rule settings: an opt-in rule that is not on reports nothing. */\n readonly rules: TrustRuleSettings;\n /** The TypeScript source file of the linted file (its comments are read from it). */\n readonly sourceFile: () => TS.SourceFile;\n}\n\n/**\n * Without parser services (e.g. ESLint's default parser) the file is parsed once with TypeScript and\n * nodes are found by their source range, which ESTree and TypeScript agree on.\n */\nfunction rangeLocator(ts: TypeScript, context: Rule.RuleContext): Pick<RuleSetup, 'tsNode' | 'sourceFile'> {\n let parsed: TS.SourceFile | undefined;\n const sourceFile = (): TS.SourceFile => (parsed ??= ts.createSourceFile(context.filename, context.sourceCode.text, ts.ScriptTarget.Latest, true));\n return { tsNode: locate, sourceFile };\n function locate<T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T): T {\n const file = sourceFile();\n const [start, end] = (node as { range: [number, number] }).range;\n let found: T | undefined;\n const visit = (candidate: TS.Node): void => {\n if (found || candidate.pos > start || candidate.end < end) return;\n if (candidate.end === end && candidate.getStart(file) === start && is(candidate)) found = candidate;\n else ts.forEachChild(candidate, visit);\n };\n visit(file);\n if (!found) throw new Error(`@noego/trust: no TypeScript node at ${context.filename}:${start}-${end}`);\n return found;\n }\n}\n\nfunction mapLocator(ts: TypeScript, context: Rule.RuleContext, map: NonNullable<ParserServices['esTreeNodeToTSNodeMap']>): Pick<RuleSetup, 'tsNode' | 'sourceFile'> {\n const tsNode = function mapped<T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T): T {\n const target = map.get(node);\n if (!target || !is(target)) throw new Error(`@noego/trust: unexpected TypeScript node in ${context.filename}`);\n return target;\n };\n return { tsNode, sourceFile: () => tsNode(context.sourceCode.ast, ts.isSourceFile) };\n}\n\nexport function setupRule(context: Rule.RuleContext): RuleSetup {\n const options = (context.options[0] ?? {}) as TrustRuleOptions;\n const ts = loadTypeScript(context.cwd);\n const config = options.configFile ? loadTrustConfigCached(resolve(context.cwd, options.configFile)) : emptyTrustConfig(context.cwd);\n const services = context.sourceCode.parserServices as ParserServices | undefined;\n const program = services?.program ?? null;\n const map = services?.esTreeNodeToTSNodeMap;\n const { tsNode, sourceFile } = map ? mapLocator(ts, context, map) : rangeLocator(ts, context);\n if (!program || !map) {\n const zones = new Zones(config.rootDir, config.passthrough, config.ignore);\n return { ts, zone: zones.zoneOf(context.filename), policy: null, guardContext: nameBasedGuardContext(ts), tsNode, checker: null, rules: config.rules, sourceFile };\n }\n const checker = program.getTypeChecker();\n const policy = policyFor(ts, checker, config, (options.trust ?? []).map(normalizeOrigin));\n return {\n ts,\n zone: policy.zones.zoneOf(context.filename),\n policy,\n guardContext: typedGuardContext(ts, checker, policy),\n tsNode,\n checker,\n rules: config.rules,\n sourceFile,\n };\n}\n","// ESLint adapter for dropped-result: a Result that can still fail must be passed up (returned) or handled\n// (Trust.decide / Trust.translate, a branch naming its kind); every place a failure is dropped instead is\n// reported, with the origin as messageId (`discarded`, `argument`, `stored`, `callback`, `return`, `end`,\n// `overwritten`).\n// The decisions are the shared core rule (../../core/dropped-results.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"dropped-result\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { droppedResultContext, droppedResultData, droppedResultsIn } from '../../core/dropped-results.js';\nimport { DROPPED_RESULT_MESSAGES, DROPPED_RESULT_RULE } from '../../core/messages.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { DROPPED_RESULT_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every place a Result that can still fail is dropped instead of returned or handled.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: DROPPED_RESULT_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, DROPPED_RESULT_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('dropped-result requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n for (const dropped of droppedResultsIn(sourceFile, droppedResultContext(ts, checker, policy))) {\n context.report({ loc: sourceCode.getLocFromIndex(dropped.start), messageId: dropped.origin, data: droppedResultData(dropped) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for redundant-guard: a Trust.try / Trust.tryAsync (or a `try` whose `catch` returns\n// Result.err) around code that cannot fail — every call inside is trusted, first-party, or declared to return\n// a Result — invents a failure path; it is reported at the guard (messageId `redundant`).\n// The decisions are the shared core rule (../../core/redundant-guards.ts), run once over the file's TypeScript\n// source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"redundant-guard\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { REDUNDANT_GUARD_MESSAGES, REDUNDANT_GUARD_RULE } from '../../core/messages.js';\nimport { redundantGuardData, redundantGuardsIn } from '../../core/redundant-guards.js';\nimport { typedGuardContext } from '../../core/rules.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { REDUNDANT_GUARD_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every guard (Trust.try / Trust.tryAsync / try-catch) around code that cannot fail.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: REDUNDANT_GUARD_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, REDUNDANT_GUARD_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('redundant-guard requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n const guardContext = typedGuardContext(ts, checker, policy);\n for (const guard of redundantGuardsIn(sourceFile, { ts, checker, policy, guardContext })) {\n context.report({ loc: sourceCode.getLocFromIndex(guard.start), messageId: 'redundant', data: redundantGuardData(guard) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for throw-must-return-result: every `throw` in checked code must be guarded —\n// inside a `try` (same function) whose `catch` returns Result.err(...) on every path, or inside a\n// Trust.try / Trust.tryAsync callback. The decision is the shared core rule (../../core/rules.ts);\n// this file only maps ESTree nodes to TypeScript nodes and reports.\n// Works with or without type information; with it, Result.err is recognised by declaration.\n// A `throw` in a statement marked `//trust:accept <reason>` is accepted, and every `//trust:accept` that\n// accepts nothing is reported here, at the comment (`directive`, ../../core/accept.ts). Without type\n// information an accept above a statement with nothing to accept (stale) cannot be told, so it is not reported.\nimport type { Rule } from 'eslint';\nimport { acceptanceOf, acceptDirectiveFindings } from '../../core/accept.js';\nimport { ACCEPT_DIRECTIVE_MESSAGES, THROW_MESSAGES } from '../../core/messages.js';\nimport { throwProblem } from '../../core/rules.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { THROW_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Require every throw to be caught locally and returned as Result.err.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: { ...THROW_MESSAGES, ...ACCEPT_DIRECTIVE_MESSAGES },\n },\n create(context) {\n const setup = setupRule(context);\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, guardContext, policy, checker } = setup;\n const { sourceCode } = context;\n return {\n Program() {\n const failureContext = policy && checker ? { ts, checker, policy, guardContext } : null;\n const sourceFile = setup.sourceFile();\n for (const found of acceptDirectiveFindings(ts, sourceFile, failureContext)) {\n const loc = { start: sourceCode.getLocFromIndex(found.directive.pos), end: sourceCode.getLocFromIndex(found.directive.end) };\n context.report({ loc, messageId: found.messageId, data: found.data });\n }\n },\n ThrowStatement(node) {\n const statement = tsNode(node, ts.isThrowStatement);\n const messageId = throwProblem(statement, guardContext);\n if (messageId && !acceptanceOf(ts, statement)) context.report({ node, messageId });\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for type-claim: every place a type is claimed instead of proven — a narrowing\n// `as`, `x!`, `any` in a typed position, a written type predicate, a caller-chosen generic return —\n// is reported, with the claim kind as messageId (`claim:as`, `claim:non-null`, `claim:any`,\n// `claim:predicate`, `claim:generic-return`; `unanalyzable` for a node whose type does not resolve;\n// `directive` for a `//trust:` comment that marks nothing). Claims inside a validator (a function marked\n// `//trust:validator_function`) are not reported.\n// The decisions are the shared core rule (../../core/type-claims.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"type-claim\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { TYPE_CLAIM_MESSAGES, TYPE_CLAIM_RULE } from '../../core/messages.js';\nimport { claimSpan, typeClaimContext, typeClaimsIn } from '../../core/type-claims.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { TYPE_CLAIM_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every place a type is claimed instead of proven.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: TYPE_CLAIM_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, TYPE_CLAIM_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('type-claim requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n for (const claim of typeClaimsIn(sourceFile, typeClaimContext(ts, checker, undefined, policy))) {\n const span = claimSpan(claim, sourceFile);\n const loc = { start: sourceCode.getLocFromIndex(span.start), end: sourceCode.getLocFromIndex(span.end) };\n context.report({ loc, messageId: claim.origin, data: claim.data });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for untrusted-call-must-return-result: every call or `new` whose callee is\n// untrusted must be guarded — inside a `try` (same function) whose `catch` returns Result.err(...)\n// on every path, or inside a Trust.try / Trust.tryAsync callback. Trust comes from\n// trust.config.json (see ../config.ts), from first-party checked code, or from a declared return\n// type of Result / Promise<Result> from @noego/trust. The decision is the shared core rule\n// (../../core/rules.ts); this file only maps ESTree nodes to TypeScript nodes and reports.\n// Requires typed linting (parserOptions.projectService or project). A call in a statement marked\n// `//trust:accept <reason>` is accepted (../../core/accept.ts).\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { acceptanceOf } from '../../core/accept.js';\nimport { UNTRUSTED_CALL_MESSAGES } from '../../core/messages.js';\nimport { untrustedCallProblem } from '../../core/rules.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { UNTRUSTED_CALL_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Require calls into untrusted code to be handled locally and returned as Result.err.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: UNTRUSTED_CALL_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!setup.policy || !setup.checker) {\n throw new Error('untrusted-call-must-return-result requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, policy, tsNode, checker, guardContext } = setup;\n const isCallOrNew = (node: TS.Node): node is TS.CallExpression | TS.NewExpression => ts.isCallExpression(node) || ts.isNewExpression(node);\n\n function check(node: Rule.Node): void {\n const call = tsNode(node, isCallOrNew);\n const problem = untrustedCallProblem(call, policy, checker, guardContext);\n if (problem && !acceptanceOf(ts, call)) context.report({ node, messageId: problem.messageId, data: { origin: problem.origin } });\n }\n\n return { CallExpression: check, NewExpression: check };\n },\n};\n\nexport default rule;\n","// ESLint adapter for untrusted-value: type trust is opt-in. A value whose type was declared by an origin\n// that is not on the type-trust list (`trust_type` in trust.config.json) — a call's return, a parameter of\n// a callback the outside calls, a property or global it declares — may only be passed to a validator, kept\n// as `unknown`, or tested by a built-in check; any other use is reported with the origin named.\n// The decisions are the shared core rule (../../core/untrusted-values.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"untrusted-value\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { UNTRUSTED_VALUE_MESSAGES, UNTRUSTED_VALUE_RULE } from '../../core/messages.js';\nimport {\n untrustedHandoffData,\n untrustedHandoffsIn,\n untrustedValueContext,\n untrustedValueData,\n untrustedValueMessageId,\n untrustedValuesIn,\n} from '../../core/untrusted-values.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { UNTRUSTED_VALUE_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every use of a value whose type was declared by an origin that is not type-trusted.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: UNTRUSTED_VALUE_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, UNTRUSTED_VALUE_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('untrusted-value requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n const valueContext = untrustedValueContext(ts, checker, policy);\n const locOf = (at: TS.Node) => ({ start: sourceCode.getLocFromIndex(at.getStart(sourceFile)), end: sourceCode.getLocFromIndex(at.getEnd()) });\n for (const value of untrustedValuesIn(sourceFile, valueContext)) {\n if (value.outcome !== 'finding') continue;\n context.report({ loc: locOf(value.node), messageId: untrustedValueMessageId(value), data: untrustedValueData(value) });\n }\n // `untrustedCallbacks: \"all\"`: functions handed to an origin that is not type-trusted, at the hand-off.\n for (const handoff of untrustedHandoffsIn(sourceFile, valueContext)) {\n context.report({ loc: locOf(handoff.node), messageId: 'handoff', data: untrustedHandoffData(handoff) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// @noego/trust/eslint — ESLint plugin, trust config loader, and policy.\n//\n// import { typedConfig } from '@noego/trust/eslint';\n// export default [\n// ...typedConfig({ files: ['server/**/*.ts'], configFile: 'trust.config.json' }),\n// ];\nimport type { ESLint, Linter } from 'eslint';\nimport droppedResult from './rules/dropped-result.js';\nimport redundantGuard from './rules/redundant-guard.js';\nimport throwMustReturnResult from './rules/throw-must-return-result.js';\nimport typeClaim from './rules/type-claim.js';\nimport untrustedCallMustReturnResult from './rules/untrusted-call-must-return-result.js';\nimport untrustedValue from './rules/untrusted-value.js';\n\nexport const rules = {\n 'untrusted-call-must-return-result': untrustedCallMustReturnResult,\n 'throw-must-return-result': throwMustReturnResult,\n 'type-claim': typeClaim,\n 'untrusted-value': untrustedValue,\n 'dropped-result': droppedResult,\n 'redundant-guard': redundantGuard,\n};\n\nexport interface TypedConfigOptions {\n /** Files to check (flat-config globs). They must be in a tsconfig the project service can find. */\n readonly files: readonly string[];\n readonly ignores?: readonly string[];\n /** trust.config.json path relative to the ESLint cwd (default \"trust.config.json\"). */\n readonly configFile?: string;\n readonly severity?: Linter.RuleSeverity;\n}\n\nconst plugin: ESLint.Plugin = {\n meta: { name: '@noego/trust' },\n rules,\n};\n\nexport default plugin;\n\n/**\n * Flat config that registers the plugin as `trust` and enables its rules (the two trust rules, `type-claim`,\n * `untrusted-value` and `dropped-result`) for `files`. Needs typed linting. `type-claim`, `untrusted-value` and\n * `dropped-result` are opt-in: they report only when the trust config turns them on\n * (`\"rules\": { \"type-claim\": \"on\", \"untrusted-value\": \"on\", \"dropped-result\": \"on\" }`), the same settings\n * `trust check` / `trust baseline` honour, so ESLint and the CLI always agree.\n */\nexport function typedConfig(options: TypedConfigOptions): Linter.Config[] {\n const severity = options.severity ?? 'warn';\n const ruleOptions = { configFile: options.configFile ?? 'trust.config.json' };\n return [\n {\n name: '@noego/trust/typed',\n files: [...options.files],\n ignores: [...(options.ignores ?? [])],\n plugins: { trust: plugin },\n rules: {\n 'trust/untrusted-call-must-return-result': [severity, ruleOptions],\n 'trust/throw-must-return-result': [severity, ruleOptions],\n 'trust/type-claim': [severity, ruleOptions],\n 'trust/untrusted-value': [severity, ruleOptions],\n 'trust/dropped-result': [severity, ruleOptions],\n 'trust/redundant-guard': [severity, ruleOptions],\n },\n },\n ];\n}\n\nexport {\n DEFAULT_RULE_SETTINGS,\n effectiveTrustList,\n effectiveTypeTrustList,\n isRuleEnabled,\n loadTrustConfig,\n normalizeOrigin,\n TrustConfigError,\n type LoadTrustConfigOptions,\n type OptInRule,\n type RuleSwitch,\n type TrustConfig,\n type TrustEntry,\n type TrustLevel,\n type TrustRuleSettings,\n type TsconfigMapping,\n type UntrustedCallbacks,\n} from './config.js';\nexport { PRESETS, type PresetDefinition } from './presets.js';\nexport { entryMatches, TrustPolicy, type MatchedEntry, type TypeVerdict, type Verdict } from './policy.js';\nexport { OriginResolver, type OriginInfo } from './origin.js';\nexport { Zones, type Zone, type ZoneGroup } from './zones.js';\nexport { alwaysExits, catchProblem, guardOf, type Guard, type GuardContext } from '../core/guard.js';\nexport type { CatchProblem } from '../core/messages.js';\nexport {\n compareToBaseline,\n countFindings,\n parseBaseline,\n serializeBaseline,\n THROW_RULE,\n UNTRUSTED_CALL_RULE,\n updateBaseline,\n WHOLE_BASELINE,\n type BaselineCounts,\n type BaselineDelta,\n type BaselineScope,\n type Finding,\n} from '../core/baseline.js';\nexport { DIRECTIVE_ORIGIN, TYPE_CLAIM_KINDS, TYPE_CLAIM_RULE, UNANALYZABLE_ORIGIN, type TypeClaimOrigin } from '../core/messages.js';\nexport { CATCH_ORIGIN, UNTRUSTED_VALUE_RULE, type UntrustedEntry } from '../core/messages.js';\nexport { DROPPED_RESULT_RULE, type DroppedResultOrigin } from '../core/messages.js';\nexport { DROPPED_RESULT_MESSAGES } from './rules/dropped-result.js';\nexport { REDUNDANT_GUARD_ORIGIN, REDUNDANT_GUARD_RULE } from '../core/messages.js';\nexport { REDUNDANT_GUARD_MESSAGES } from './rules/redundant-guard.js';\nexport { ACCEPT_DIRECTIVE, isInsideValidator, isMarkedValidator, VALIDATOR_DIRECTIVE } from '../core/validator.js';\nexport { ACCEPT_DIRECTIVE_MESSAGES } from '../core/messages.js';\nexport { THROW_MESSAGES } from './rules/throw-must-return-result.js';\nexport { TYPE_CLAIM_MESSAGES } from './rules/type-claim.js';\nexport { UNTRUSTED_CALL_MESSAGES } from './rules/untrusted-call-must-return-result.js';\nexport { UNTRUSTED_VALUE_MESSAGES } from './rules/untrusted-value.js';\nexport type { TrustRuleOptions } from './rule-setup.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,eAAe;AAkBjB,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,MAAM;AAAA,IACN,YAAY;AAAA,MACV,YAAY,EAAE,MAAM,SAAS;AAAA,MAC7B,OAAO,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,EAAE;AAAA,IACpD;AAAA,IACA,sBAAsB;AAAA,EACxB;AACF;AA4BA,SAAS,aAAa,IAAgB,SAAqE;AACzG,MAAI;AACJ,QAAM,aAAa,MAAsB,WAAW,GAAG,iBAAiB,QAAQ,UAAU,QAAQ,WAAW,MAAM,GAAG,aAAa,QAAQ,IAAI;AAC/I,SAAO,EAAE,QAAQ,QAAQ,WAAW;AACpC,WAAS,OAA0B,MAAc,IAAqC;AACpF,UAAM,OAAO,WAAW;AACxB,UAAM,CAAC,OAAO,GAAG,IAAK,KAAqC;AAC3D,QAAI;AACJ,UAAM,QAAQ,CAAC,cAA6B;AAC1C,UAAI,SAAS,UAAU,MAAM,SAAS,UAAU,MAAM,IAAK;AAC3D,UAAI,UAAU,QAAQ,OAAO,UAAU,SAAS,IAAI,MAAM,SAAS,GAAG,SAAS,EAAG,SAAQ;AAAA,UACrF,IAAG,aAAa,WAAW,KAAK;AAAA,IACvC;AACA,UAAM,IAAI;AACV,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,uCAAuC,QAAQ,QAAQ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AQ,WAAW,CAAC,CAAE;AAAA,MACpC,SAAS,EAAE,OAAO,OAAO;AAAA,MACzB,OAAO;AAAA,QACL,2CAA2C,CAAC,UAAU,WAAW;AAAA,QACjE,kCAAkC,CAAC,UAAU,WAAW;AAAA,QACxD,oBAAoB,CAAC,UAAU,WAAW;AAAA,QAC1C,yBAAyB,CAAC,UAAU,WAAW;AAAA,QAC/C,wBAAwB,CAAC,UAAU,WAAW;AAAA,QAC9C,yBAAyB,CAAC,UAAU,WAAW;AAAA,MACjD;AAAA,IACF;AAAA,EACF;AACF;","names":["rule","rule","rule","rule","rule"]}
1
+ {"version":3,"sources":["../../src/eslint/rule-setup.ts","../../src/eslint/rules/boundary-result.ts","../../src/eslint/rules/dropped-result.ts","../../src/eslint/rules/redundant-guard.ts","../../src/eslint/rules/throw-must-return-result.ts","../../src/eslint/rules/type-claim.ts","../../src/eslint/rules/untrusted-call-must-return-result.ts","../../src/eslint/rules/untrusted-value.ts","../../src/eslint/index.ts"],"sourcesContent":["// Shared per-file setup for both rules: trust config, file zone, guard context, and the mapping from\n// ESLint's ESTree nodes to the TypeScript nodes the shared rule logic (../core/rules.ts) works on.\nimport { resolve } from 'node:path';\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { emptyTrustConfig, policyFor } from '../core/check-file.js';\nimport type { GuardContext } from '../core/guard.js';\nimport { nameBasedGuardContext, typedGuardContext } from '../core/rules.js';\nimport { loadTrustConfigCached, normalizeOrigin, type TrustConfig, type TrustRuleSettings } from './config.js';\nimport type { TrustPolicy } from './policy.js';\nimport { loadTypeScript, type TypeScript } from './typescript.js';\nimport { Zones, type Zone } from './zones.js';\n\nexport interface TrustRuleOptions {\n /** trust.config.json path, relative to the ESLint cwd. */\n readonly configFile?: string;\n /** Extra trusted origins (applied before the config chain). */\n readonly trust?: readonly string[];\n}\n\nexport const OPTIONS_SCHEMA = [\n {\n type: 'object',\n properties: {\n configFile: { type: 'string' },\n trust: { type: 'array', items: { type: 'string' } },\n },\n additionalProperties: false,\n },\n] as const;\n\ninterface ParserServices {\n readonly program?: TS.Program | null;\n readonly esTreeNodeToTSNodeMap?: { get(node: unknown): TS.Node };\n}\n\n/** ESTree node as ESLint hands it to a rule (ranges are always present). */\ntype EsNode = Rule.Node | { readonly range?: [number, number] };\n\nexport interface RuleSetup {\n readonly ts: TypeScript;\n readonly zone: Zone;\n readonly policy: TrustPolicy | null;\n readonly guardContext: GuardContext;\n /** Maps an ESTree node to its TypeScript node of the given kind. */\n readonly tsNode: <T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T) => T;\n readonly checker: TS.TypeChecker | null;\n /** The program of typed linting (null without parser services). */\n readonly program: TS.Program | null;\n /** The loaded trust config (`boundaries`, `strict` globs, …). */\n readonly config: TrustConfig;\n /** The trust config's per-rule settings: an opt-in rule that is not on reports nothing. */\n readonly rules: TrustRuleSettings;\n /** The TypeScript source file of the linted file (its comments are read from it). */\n readonly sourceFile: () => TS.SourceFile;\n}\n\n/**\n * Without parser services (e.g. ESLint's default parser) the file is parsed once with TypeScript and\n * nodes are found by their source range, which ESTree and TypeScript agree on.\n */\nfunction rangeLocator(ts: TypeScript, context: Rule.RuleContext): Pick<RuleSetup, 'tsNode' | 'sourceFile'> {\n let parsed: TS.SourceFile | undefined;\n const sourceFile = (): TS.SourceFile => (parsed ??= ts.createSourceFile(context.filename, context.sourceCode.text, ts.ScriptTarget.Latest, true));\n return { tsNode: locate, sourceFile };\n function locate<T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T): T {\n const file = sourceFile();\n const [start, end] = (node as { range: [number, number] }).range;\n let found: T | undefined;\n const visit = (candidate: TS.Node): void => {\n if (found || candidate.pos > start || candidate.end < end) return;\n if (candidate.end === end && candidate.getStart(file) === start && is(candidate)) found = candidate;\n else ts.forEachChild(candidate, visit);\n };\n visit(file);\n if (!found) throw new Error(`@noego/trust: no TypeScript node at ${context.filename}:${start}-${end}`);\n return found;\n }\n}\n\nfunction mapLocator(ts: TypeScript, context: Rule.RuleContext, map: NonNullable<ParserServices['esTreeNodeToTSNodeMap']>): Pick<RuleSetup, 'tsNode' | 'sourceFile'> {\n const tsNode = function mapped<T extends TS.Node>(node: EsNode, is: (node: TS.Node) => node is T): T {\n const target = map.get(node);\n if (!target || !is(target)) throw new Error(`@noego/trust: unexpected TypeScript node in ${context.filename}`);\n return target;\n };\n return { tsNode, sourceFile: () => tsNode(context.sourceCode.ast, ts.isSourceFile) };\n}\n\nexport function setupRule(context: Rule.RuleContext): RuleSetup {\n const options = (context.options[0] ?? {}) as TrustRuleOptions;\n const ts = loadTypeScript(context.cwd);\n const config = options.configFile ? loadTrustConfigCached(resolve(context.cwd, options.configFile)) : emptyTrustConfig(context.cwd);\n const services = context.sourceCode.parserServices as ParserServices | undefined;\n const program = services?.program ?? null;\n const map = services?.esTreeNodeToTSNodeMap;\n const { tsNode, sourceFile } = map ? mapLocator(ts, context, map) : rangeLocator(ts, context);\n if (!program || !map) {\n const zones = new Zones(config.rootDir, config.passthrough, config.ignore);\n return { ts, zone: zones.zoneOf(context.filename), policy: null, guardContext: nameBasedGuardContext(ts), tsNode, checker: null, program: null, config, rules: config.rules, sourceFile };\n }\n const checker = program.getTypeChecker();\n const policy = policyFor(ts, checker, config, (options.trust ?? []).map(normalizeOrigin));\n return {\n ts,\n zone: policy.zones.zoneOf(context.filename),\n policy,\n guardContext: typedGuardContext(ts, checker, policy),\n tsNode,\n checker,\n program,\n config,\n rules: config.rules,\n sourceFile,\n };\n}\n","// ESLint adapter for boundary-result: in a file the trust config names as a boundary (`boundaries`), every\n// exported function and public member whose return value can fail is reported, with the origin as messageId\n// (`returns-result`, `unproven-return`, `stale-exclude`, `overlapping-items`).\n// The decisions are the shared core rule (../../core/boundaries.ts), run once over the file's TypeScript\n// source; this file only reports them at their source positions. A stale-exclude finding belongs to the config\n// file, which ESLint cannot report into: it is reported at the start of the file the core attributes it to.\n// ESLint has no per-finding severity, so an unproven return is reported like the rest (`trust check` warns).\n// Off unless the trust config has `boundaries`, the same setting `trust check` honours. When on, it requires\n// typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { boundaryContext, boundaryFindingsIn } from '../../core/boundaries.js';\nimport { isStrictByConfig } from '../../core/check-file.js';\nimport { BOUNDARY_MESSAGES } from '../../core/messages.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { BOUNDARY_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every boundary (exported function or public member of a configured boundary file) whose return value can fail.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: BOUNDARY_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (setup.config.boundaries.length === 0) return {};\n if (!setup.policy || !setup.checker || !setup.program) {\n throw new Error('boundary-result requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy, program, config } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n const strict = isStrictByConfig(config, sourceFile.fileName);\n for (const found of boundaryFindingsIn(sourceFile, boundaryContext(ts, checker, program, policy, config), strict)) {\n context.report({ loc: sourceCode.getLocFromIndex(found.start), messageId: found.origin, data: { ...found.data } });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for dropped-result: a Result that can still fail must be passed up (returned) or handled\n// (Trust.decide / Trust.translate, a branch naming its kind); every place a failure is dropped instead is\n// reported, with the origin as messageId (`discarded`, `argument`, `stored`, `callback`, `return`, `end`,\n// `overwritten`).\n// The decisions are the shared core rule (../../core/dropped-results.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"dropped-result\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { droppedResultContext, droppedResultData, droppedResultsIn } from '../../core/dropped-results.js';\nimport { DROPPED_RESULT_MESSAGES, DROPPED_RESULT_RULE } from '../../core/messages.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { DROPPED_RESULT_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every place a Result that can still fail is dropped instead of returned or handled.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: DROPPED_RESULT_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, DROPPED_RESULT_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('dropped-result requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n for (const dropped of droppedResultsIn(sourceFile, droppedResultContext(ts, checker, policy))) {\n context.report({ loc: sourceCode.getLocFromIndex(dropped.start), messageId: dropped.origin, data: droppedResultData(dropped) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for redundant-guard: a Trust.try / Trust.tryAsync (or a `try` whose `catch` returns\n// Result.err) around code that cannot fail — every call inside is trusted, first-party, or declared to return\n// a Result — invents a failure path; it is reported at the guard (messageId `redundant`).\n// The decisions are the shared core rule (../../core/redundant-guards.ts), run once over the file's TypeScript\n// source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"redundant-guard\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { REDUNDANT_GUARD_MESSAGES, REDUNDANT_GUARD_RULE } from '../../core/messages.js';\nimport { redundantGuardData, redundantGuardsIn } from '../../core/redundant-guards.js';\nimport { typedGuardContext } from '../../core/rules.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { REDUNDANT_GUARD_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every guard (Trust.try / Trust.tryAsync / try-catch) around code that cannot fail.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: REDUNDANT_GUARD_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, REDUNDANT_GUARD_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('redundant-guard requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n const guardContext = typedGuardContext(ts, checker, policy);\n for (const guard of redundantGuardsIn(sourceFile, { ts, checker, policy, guardContext })) {\n context.report({ loc: sourceCode.getLocFromIndex(guard.start), messageId: 'redundant', data: redundantGuardData(guard) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for throw-must-return-result: every `throw` in checked code must be guarded —\n// inside a `try` (same function) whose `catch` returns Result.err(...) on every path, or inside a\n// Trust.try / Trust.tryAsync callback. The decision is the shared core rule (../../core/rules.ts);\n// this file only maps ESTree nodes to TypeScript nodes and reports.\n// Works with or without type information; with it, Result.err is recognised by declaration.\n// A `throw` in a statement marked `//trust:accept <reason>` is accepted, and every `//trust:accept` that\n// accepts nothing is reported here, at the comment (`directive`, ../../core/accept.ts). Without type\n// information an accept above a statement with nothing to accept (stale) cannot be told, so it is not reported.\nimport type { Rule } from 'eslint';\nimport { acceptanceOf, acceptDirectiveFindings } from '../../core/accept.js';\nimport { ACCEPT_DIRECTIVE_MESSAGES, THROW_MESSAGES } from '../../core/messages.js';\nimport { throwProblem } from '../../core/rules.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { THROW_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Require every throw to be caught locally and returned as Result.err.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: { ...THROW_MESSAGES, ...ACCEPT_DIRECTIVE_MESSAGES },\n },\n create(context) {\n const setup = setupRule(context);\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, guardContext, policy, checker } = setup;\n const { sourceCode } = context;\n return {\n Program() {\n const failureContext = policy && checker ? { ts, checker, policy, guardContext } : null;\n const sourceFile = setup.sourceFile();\n for (const found of acceptDirectiveFindings(ts, sourceFile, failureContext)) {\n const loc = { start: sourceCode.getLocFromIndex(found.directive.pos), end: sourceCode.getLocFromIndex(found.directive.end) };\n context.report({ loc, messageId: found.messageId, data: found.data });\n }\n },\n ThrowStatement(node) {\n const statement = tsNode(node, ts.isThrowStatement);\n const messageId = throwProblem(statement, guardContext);\n if (messageId && !acceptanceOf(ts, statement)) context.report({ node, messageId });\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for type-claim: every place a type is claimed instead of proven — a narrowing\n// `as`, `x!`, `any` in a typed position, a written type predicate, a caller-chosen generic return —\n// is reported, with the claim kind as messageId (`claim:as`, `claim:non-null`, `claim:any`,\n// `claim:predicate`, `claim:generic-return`; `unanalyzable` for a node whose type does not resolve;\n// `directive` for a `//trust:` comment that marks nothing). Claims inside a validator (a function marked\n// `//trust:validator_function`) are not reported.\n// The decisions are the shared core rule (../../core/type-claims.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"type-claim\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport { TYPE_CLAIM_MESSAGES, TYPE_CLAIM_RULE } from '../../core/messages.js';\nimport { claimSpan, typeClaimContext, typeClaimsIn } from '../../core/type-claims.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { TYPE_CLAIM_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every place a type is claimed instead of proven.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: TYPE_CLAIM_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, TYPE_CLAIM_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('type-claim requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n for (const claim of typeClaimsIn(sourceFile, typeClaimContext(ts, checker, undefined, policy))) {\n const span = claimSpan(claim, sourceFile);\n const loc = { start: sourceCode.getLocFromIndex(span.start), end: sourceCode.getLocFromIndex(span.end) };\n context.report({ loc, messageId: claim.origin, data: claim.data });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// ESLint adapter for untrusted-call-must-return-result: every call or `new` whose callee is\n// untrusted must be guarded — inside a `try` (same function) whose `catch` returns Result.err(...)\n// on every path, or inside a Trust.try / Trust.tryAsync callback. Trust comes from\n// trust.config.json (see ../config.ts), from first-party checked code, or from a declared return\n// type of Result / Promise<Result> from @noego/trust. The decision is the shared core rule\n// (../../core/rules.ts); this file only maps ESTree nodes to TypeScript nodes and reports.\n// Requires typed linting (parserOptions.projectService or project). A call in a statement marked\n// `//trust:accept <reason>` is accepted (../../core/accept.ts).\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { acceptanceOf } from '../../core/accept.js';\nimport { UNTRUSTED_CALL_MESSAGES } from '../../core/messages.js';\nimport { untrustedCallProblem } from '../../core/rules.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { UNTRUSTED_CALL_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Require calls into untrusted code to be handled locally and returned as Result.err.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: UNTRUSTED_CALL_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!setup.policy || !setup.checker) {\n throw new Error('untrusted-call-must-return-result requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, policy, tsNode, checker, guardContext } = setup;\n const isCallOrNew = (node: TS.Node): node is TS.CallExpression | TS.NewExpression => ts.isCallExpression(node) || ts.isNewExpression(node);\n\n function check(node: Rule.Node): void {\n const call = tsNode(node, isCallOrNew);\n const problem = untrustedCallProblem(call, policy, checker, guardContext);\n if (problem && !acceptanceOf(ts, call)) context.report({ node, messageId: problem.messageId, data: { origin: problem.origin } });\n }\n\n return { CallExpression: check, NewExpression: check };\n },\n};\n\nexport default rule;\n","// ESLint adapter for untrusted-value: type trust is opt-in. A value whose type was declared by an origin\n// that is not on the type-trust list (`trust_type` in trust.config.json) — a call's return, a parameter of\n// a callback the outside calls, a property or global it declares — may only be passed to a validator, kept\n// as `unknown`, or tested by a built-in check; any other use is reported with the origin named.\n// The decisions are the shared core rule (../../core/untrusted-values.ts), run once over the file's\n// TypeScript source; this file only reports them at their source positions.\n// Opt-in: it reports nothing unless the trust config turns it on (`\"rules\": { \"untrusted-value\": \"on\" }`), the\n// same setting `trust check` honours. When on, it requires typed linting (parserOptions.projectService or project).\nimport type { Rule } from 'eslint';\nimport type * as TS from 'typescript';\nimport { UNTRUSTED_VALUE_MESSAGES, UNTRUSTED_VALUE_RULE } from '../../core/messages.js';\nimport {\n untrustedHandoffData,\n untrustedHandoffsIn,\n untrustedValueContext,\n untrustedValueData,\n untrustedValueMessageId,\n untrustedValuesIn,\n} from '../../core/untrusted-values.js';\nimport { isRuleEnabled } from '../config.js';\nimport { OPTIONS_SCHEMA, setupRule } from '../rule-setup.js';\n\nexport { UNTRUSTED_VALUE_MESSAGES };\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: { description: 'Report every use of a value whose type was declared by an origin that is not type-trusted.' },\n schema: OPTIONS_SCHEMA as unknown as Rule.RuleMetaData['schema'],\n messages: UNTRUSTED_VALUE_MESSAGES,\n },\n create(context) {\n const setup = setupRule(context);\n if (!isRuleEnabled(setup, UNTRUSTED_VALUE_RULE)) return {};\n if (!setup.policy || !setup.checker) {\n throw new Error('untrusted-value requires typed linting (parserOptions.projectService or project).');\n }\n if (setup.zone !== 'checked') return {};\n const { ts, tsNode, checker, policy } = setup;\n const { sourceCode } = context;\n\n return {\n Program(node) {\n const sourceFile = tsNode(node, ts.isSourceFile);\n const valueContext = untrustedValueContext(ts, checker, policy);\n const locOf = (at: TS.Node) => ({ start: sourceCode.getLocFromIndex(at.getStart(sourceFile)), end: sourceCode.getLocFromIndex(at.getEnd()) });\n for (const value of untrustedValuesIn(sourceFile, valueContext)) {\n if (value.outcome !== 'finding') continue;\n context.report({ loc: locOf(value.node), messageId: untrustedValueMessageId(value), data: untrustedValueData(value) });\n }\n // `untrustedCallbacks: \"all\"`: functions handed to an origin that is not type-trusted, at the hand-off.\n for (const handoff of untrustedHandoffsIn(sourceFile, valueContext)) {\n context.report({ loc: locOf(handoff.node), messageId: 'handoff', data: untrustedHandoffData(handoff) });\n }\n },\n };\n },\n};\n\nexport default rule;\n","// @noego/trust/eslint — ESLint plugin, trust config loader, and policy.\n//\n// import { typedConfig } from '@noego/trust/eslint';\n// export default [\n// ...typedConfig({ files: ['server/**/*.ts'], configFile: 'trust.config.json' }),\n// ];\nimport type { ESLint, Linter } from 'eslint';\nimport boundaryResult from './rules/boundary-result.js';\nimport droppedResult from './rules/dropped-result.js';\nimport redundantGuard from './rules/redundant-guard.js';\nimport throwMustReturnResult from './rules/throw-must-return-result.js';\nimport typeClaim from './rules/type-claim.js';\nimport untrustedCallMustReturnResult from './rules/untrusted-call-must-return-result.js';\nimport untrustedValue from './rules/untrusted-value.js';\n\nexport const rules = {\n 'untrusted-call-must-return-result': untrustedCallMustReturnResult,\n 'throw-must-return-result': throwMustReturnResult,\n 'type-claim': typeClaim,\n 'untrusted-value': untrustedValue,\n 'dropped-result': droppedResult,\n 'redundant-guard': redundantGuard,\n 'boundary-result': boundaryResult,\n};\n\nexport interface TypedConfigOptions {\n /** Files to check (flat-config globs). They must be in a tsconfig the project service can find. */\n readonly files: readonly string[];\n readonly ignores?: readonly string[];\n /** trust.config.json path relative to the ESLint cwd (default \"trust.config.json\"). */\n readonly configFile?: string;\n readonly severity?: Linter.RuleSeverity;\n}\n\nconst plugin: ESLint.Plugin = {\n meta: { name: '@noego/trust' },\n rules,\n};\n\nexport default plugin;\n\n/**\n * Flat config that registers the plugin as `trust` and enables its rules (the two trust rules, `type-claim`,\n * `untrusted-value` and `dropped-result`) for `files`. Needs typed linting. `type-claim`, `untrusted-value` and\n * `dropped-result` are opt-in: they report only when the trust config turns them on\n * (`\"rules\": { \"type-claim\": \"on\", \"untrusted-value\": \"on\", \"dropped-result\": \"on\" }`), the same settings\n * `trust check` / `trust baseline` honour, so ESLint and the CLI always agree.\n */\nexport function typedConfig(options: TypedConfigOptions): Linter.Config[] {\n const severity = options.severity ?? 'warn';\n const ruleOptions = { configFile: options.configFile ?? 'trust.config.json' };\n return [\n {\n name: '@noego/trust/typed',\n files: [...options.files],\n ignores: [...(options.ignores ?? [])],\n plugins: { trust: plugin },\n rules: {\n 'trust/untrusted-call-must-return-result': [severity, ruleOptions],\n 'trust/throw-must-return-result': [severity, ruleOptions],\n 'trust/type-claim': [severity, ruleOptions],\n 'trust/untrusted-value': [severity, ruleOptions],\n 'trust/dropped-result': [severity, ruleOptions],\n 'trust/redundant-guard': [severity, ruleOptions],\n 'trust/boundary-result': [severity, ruleOptions],\n },\n },\n ];\n}\n\nexport {\n DEFAULT_RULE_SETTINGS,\n effectiveTrustList,\n effectiveTypeTrustList,\n isRuleEnabled,\n loadTrustConfig,\n normalizeOrigin,\n TrustConfigError,\n type BoundaryGroup,\n type LoadTrustConfigOptions,\n type OptInRule,\n type RuleSwitch,\n type TrustConfig,\n type TrustEntry,\n type TrustLevel,\n type TrustRuleSettings,\n type TsconfigMapping,\n type UntrustedCallbacks,\n} from './config.js';\nexport { PRESETS, type PresetDefinition } from './presets.js';\nexport { entryMatches, TrustPolicy, type MatchedEntry, type TypeVerdict, type Verdict } from './policy.js';\nexport { OriginResolver, type OriginInfo } from './origin.js';\nexport { Zones, type Zone, type ZoneGroup } from './zones.js';\nexport { alwaysExits, catchProblem, guardOf, type Guard, type GuardContext } from '../core/guard.js';\nexport type { CatchProblem } from '../core/messages.js';\nexport {\n compareToBaseline,\n countFindings,\n parseBaseline,\n serializeBaseline,\n THROW_RULE,\n UNTRUSTED_CALL_RULE,\n updateBaseline,\n WHOLE_BASELINE,\n type BaselineCounts,\n type BaselineDelta,\n type BaselineScope,\n type Finding,\n} from '../core/baseline.js';\nexport { DIRECTIVE_ORIGIN, TYPE_CLAIM_KINDS, TYPE_CLAIM_RULE, UNANALYZABLE_ORIGIN, type TypeClaimOrigin } from '../core/messages.js';\nexport { CATCH_ORIGIN, UNTRUSTED_VALUE_RULE, type UntrustedEntry } from '../core/messages.js';\nexport { DROPPED_RESULT_RULE, type DroppedResultOrigin } from '../core/messages.js';\nexport { DROPPED_RESULT_MESSAGES } from './rules/dropped-result.js';\nexport { REDUNDANT_GUARD_ORIGIN, REDUNDANT_GUARD_RULE } from '../core/messages.js';\nexport { REDUNDANT_GUARD_MESSAGES } from './rules/redundant-guard.js';\nexport { BOUNDARY_RULE, type BoundaryOrigin } from '../core/messages.js';\nexport { BOUNDARY_MESSAGES } from './rules/boundary-result.js';\nexport { ACCEPT_DIRECTIVE, isInsideValidator, isMarkedValidator, VALIDATOR_DIRECTIVE } from '../core/validator.js';\nexport { ACCEPT_DIRECTIVE_MESSAGES } from '../core/messages.js';\nexport { THROW_MESSAGES } from './rules/throw-must-return-result.js';\nexport { TYPE_CLAIM_MESSAGES } from './rules/type-claim.js';\nexport { UNTRUSTED_CALL_MESSAGES } from './rules/untrusted-call-must-return-result.js';\nexport { UNTRUSTED_VALUE_MESSAGES } from './rules/untrusted-value.js';\nexport type { TrustRuleOptions } from './rule-setup.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,eAAe;AAkBjB,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,MAAM;AAAA,IACN,YAAY;AAAA,MACV,YAAY,EAAE,MAAM,SAAS;AAAA,MAC7B,OAAO,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,EAAE;AAAA,IACpD;AAAA,IACA,sBAAsB;AAAA,EACxB;AACF;AAgCA,SAAS,aAAa,IAAgB,SAAqE;AACzG,MAAI;AACJ,QAAM,aAAa,MAAsB,WAAW,GAAG,iBAAiB,QAAQ,UAAU,QAAQ,WAAW,MAAM,GAAG,aAAa,QAAQ,IAAI;AAC/I,SAAO,EAAE,QAAQ,QAAQ,WAAW;AACpC,WAAS,OAA0B,MAAc,IAAqC;AACpF,UAAM,OAAO,WAAW;AACxB,UAAM,CAAC,OAAO,GAAG,IAAK,KAAqC;AAC3D,QAAI;AACJ,UAAM,QAAQ,CAAC,cAA6B;AAC1C,UAAI,SAAS,UAAU,MAAM,SAAS,UAAU,MAAM,IAAK;AAC3D,UAAI,UAAU,QAAQ,OAAO,UAAU,SAAS,IAAI,MAAM,SAAS,GAAG,SAAS,EAAG,SAAQ;AAAA,UACrF,IAAG,aAAa,WAAW,KAAK;AAAA,IACvC;AACA,UAAM,IAAI;AACV,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,uCAAuC,QAAQ,QAAQ,IAAI,KAAK,IAAI,GAAG,EAAE;AACrG,WAAO;AAAA,EACT;AACF;AAEA,SAAS,WAAW,IAAgB,SAA2B,KAAqG;AAClK,QAAM,SAAS,SAAS,OAA0B,MAAc,IA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["rule","rule","rule","rule","rule","rule"]}
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noego/trust",
3
- "version": "0.5.0-dev.2",
3
+ "version": "0.5.0-dev.4",
4
4
  "description": "Result type plus type-aware ESLint rules that make failure handling explicit: untrusted calls and throws must be caught locally and returned as Result.err.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -73,11 +73,9 @@
73
73
  }
74
74
  },
75
75
  "optionalDependencies": {
76
- "@noego/trust-darwin-arm64": "0.5.0-dev.1",
77
- "@noego/trust-darwin-x64": "0.5.0-dev.1",
78
- "@noego/trust-linux-arm64-gnu": "0.5.0-dev.1",
79
- "@noego/trust-linux-x64-gnu": "0.5.0-dev.1",
80
- "@noego/trust-win32-x64-msvc": "0.5.0-dev.1"
76
+ "@noego/trust-darwin-arm64": "0.5.0-dev.3",
77
+ "@noego/trust-linux-x64-gnu": "0.5.0-dev.3",
78
+ "@noego/trust-win32-x64-msvc": "0.5.0-dev.3"
81
79
  },
82
80
  "devDependencies": {
83
81
  "@jridgewell/trace-mapping": "^0.3.31",