@noego/trust 0.5.1-dev.3 → 0.5.1-dev.5

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.
@@ -89,13 +89,14 @@ type ResultLookalikeSetting = 'off' | 'strict' | 'on';
89
89
  /** Which callback parameters are untrusted-value sources (see the file comment). */
90
90
  type UntrustedCallbacks = 'off' | 'inline' | 'all';
91
91
  /** The rules that are off unless a config turns them on. */
92
- type OptInRule = 'type-claim' | 'untrusted-value' | 'dropped-result' | 'trusted-state' | 'redundant-guard';
92
+ type OptInRule = 'type-claim' | 'untrusted-value' | 'dropped-result' | 'trusted-state' | 'redundant-guard' | 'finally-return';
93
93
  interface TrustRuleSettings {
94
94
  readonly 'type-claim': RuleSwitch;
95
95
  readonly 'untrusted-value': RuleSwitch;
96
96
  readonly 'dropped-result': RuleSwitch;
97
97
  readonly 'trusted-state': RuleSwitch;
98
98
  readonly 'redundant-guard': RuleSwitch;
99
+ readonly 'finally-return': RuleSwitch;
99
100
  readonly 'result-lookalike': ResultLookalikeSetting;
100
101
  readonly untrustedCallbacks: UntrustedCallbacks;
101
102
  }
@@ -350,6 +351,12 @@ declare const REDUNDANT_GUARD_ORIGIN = "redundant";
350
351
  declare const REDUNDANT_GUARD_MESSAGES: {
351
352
  readonly redundant: "`{{guard}}` guards nothing that can fail: {{calls}}. It invents a failure path callers must unwrap for nothing. Call it directly and return its value; a trusted origin's failure is a programmer error, not a failure path. If the call can fail, remove its origin from \"trust\" in trust.config.json instead.";
352
353
  };
354
+ declare const FINALLY_RETURN_RULE = "finally-return";
355
+ /** Origin label of every finally-return finding (baseline key). */
356
+ declare const FINALLY_RETURN_ORIGIN = "return";
357
+ declare const FINALLY_RETURN_MESSAGES: {
358
+ readonly return: "`return` inside `finally` overwrites any Result (Err or StatedOk) or throw leaving `try` / `catch`. Do not return from `finally`; use `Trust.using(acquire, use, release)` when cleanup returns a Result.";
359
+ };
353
360
  declare const BOUNDARY_RULE = "boundary-result";
354
361
  /**
355
362
  * The messages of `boundary-result` (core/boundaries.ts), keyed by origin: the baseline key, and the ESLint
@@ -435,4 +442,4 @@ declare function describeBaselineDelta(delta: BaselineDelta<BaselineFinding & {
435
442
  readonly message: string;
436
443
  }>): string[];
437
444
 
438
- export { REDUNDANT_GUARD_RULE as $, updateBaseline as A, type BaselineCounts as B, type TrustRuleSettings as C, type TrustConfig as D, type OriginInfo as E, type Finding as F, type CatchProblem as G, ACCEPT_DIRECTIVE as H, ACCEPT_DIRECTIVE_MESSAGES as I, BOUNDARY_MESSAGES as J, BOUNDARY_RULE as K, type BoundaryGroup as L, type BoundaryOrigin as M, CATCH_ORIGIN as N, OriginResolver as O, DEFAULT_RULE_SETTINGS as P, DIRECTIVE_ORIGIN as Q, DROPPED_RESULT_MESSAGES as R, DROPPED_RESULT_RULE as S, type TypeScript as T, type DroppedResultOrigin as U, type LoadTrustConfigOptions as V, WHOLE_BASELINE as W, type OptInRule as X, REDUNDANT_GUARD_MESSAGES as Y, type ZoneGroup as Z, REDUNDANT_GUARD_ORIGIN as _, type TsconfigMapping as a, type RuleSwitch as a0, THROW_MESSAGES as a1, THROW_RULE as a2, TRUSTED_STATE_MESSAGES as a3, TRUSTED_STATE_RULE as a4, TYPE_CLAIM_KINDS as a5, TYPE_CLAIM_MESSAGES as a6, TYPE_CLAIM_RULE as a7, TrustConfigError as a8, type TrustEntry as a9, type TrustLevel as aa, type TrustedStateOrigin as ab, type TypeClaimOrigin as ac, UNANALYZABLE_ORIGIN as ad, UNTRUSTED_CALL_MESSAGES as ae, UNTRUSTED_CALL_RULE as af, UNTRUSTED_VALUE_MESSAGES as ag, UNTRUSTED_VALUE_RULE as ah, type UntrustedCallbacks as ai, type UntrustedEntry as aj, VALIDATOR_DIRECTIVE as ak, effectiveTrustList as al, effectiveTypeTrustList as am, isInsideValidator as an, isMarkedValidator as ao, isRuleEnabled as ap, loadTrustConfig as aq, normalizeOrigin as ar, type BaselineDelta as b, type BaselineFinding as c, type BaselineScope as d, type TrustDirective as e, type Zone as f, Zones as g, compareToBaseline as h, countFindings as i, describeBaselineDelta as j, directiveDirectlyAbove as k, directiveReason as l, groupMatches as m, isNamedDirective as n, lineDirectivesIn as o, loadTypeScript as p, matchesPatterns as q, nearestPackageName as r, nodeBelow as s, normalizePattern as t, parseBaseline as u, readBaseline as v, realpathOrSelf as w, relativeInside as x, serializeBaseline as y, toPosix as z };
445
+ export { type OptInRule as $, updateBaseline as A, type BaselineCounts as B, type TrustRuleSettings as C, type TrustConfig as D, type OriginInfo as E, type Finding as F, type CatchProblem as G, ACCEPT_DIRECTIVE as H, ACCEPT_DIRECTIVE_MESSAGES as I, BOUNDARY_MESSAGES as J, BOUNDARY_RULE as K, type BoundaryGroup as L, type BoundaryOrigin as M, CATCH_ORIGIN as N, OriginResolver as O, DEFAULT_RULE_SETTINGS as P, DIRECTIVE_ORIGIN as Q, DROPPED_RESULT_MESSAGES as R, DROPPED_RESULT_RULE as S, type TypeScript as T, type DroppedResultOrigin as U, FINALLY_RETURN_MESSAGES as V, WHOLE_BASELINE as W, FINALLY_RETURN_ORIGIN as X, FINALLY_RETURN_RULE as Y, type ZoneGroup as Z, type LoadTrustConfigOptions as _, type TsconfigMapping as a, REDUNDANT_GUARD_MESSAGES as a0, REDUNDANT_GUARD_ORIGIN as a1, REDUNDANT_GUARD_RULE as a2, type RuleSwitch as a3, THROW_MESSAGES as a4, THROW_RULE as a5, TRUSTED_STATE_MESSAGES as a6, TRUSTED_STATE_RULE as a7, TYPE_CLAIM_KINDS as a8, TYPE_CLAIM_MESSAGES as a9, TYPE_CLAIM_RULE as aa, TrustConfigError as ab, type TrustEntry as ac, type TrustLevel as ad, type TrustedStateOrigin as ae, type TypeClaimOrigin as af, UNANALYZABLE_ORIGIN as ag, UNTRUSTED_CALL_MESSAGES as ah, UNTRUSTED_CALL_RULE as ai, UNTRUSTED_VALUE_MESSAGES as aj, UNTRUSTED_VALUE_RULE as ak, type UntrustedCallbacks as al, type UntrustedEntry as am, VALIDATOR_DIRECTIVE as an, effectiveTrustList as ao, effectiveTypeTrustList as ap, isInsideValidator as aq, isMarkedValidator as ar, isRuleEnabled as as, loadTrustConfig as at, normalizeOrigin as au, type BaselineDelta as b, type BaselineFinding as c, type BaselineScope as d, type TrustDirective as e, type Zone as f, Zones as g, compareToBaseline as h, countFindings as i, describeBaselineDelta as j, directiveDirectlyAbove as k, directiveReason as l, groupMatches as m, isNamedDirective as n, lineDirectivesIn as o, loadTypeScript as p, matchesPatterns as q, nearestPackageName as r, nodeBelow as s, normalizePattern as t, parseBaseline as u, readBaseline as v, realpathOrSelf as w, relativeInside as x, serializeBaseline as y, toPosix as z };
@@ -5371,6 +5371,7 @@ var DEFAULT_RULE_SETTINGS = Object.freeze({
5371
5371
  "dropped-result": "off",
5372
5372
  "trusted-state": "off",
5373
5373
  "redundant-guard": "off",
5374
+ "finally-return": "off",
5374
5375
  "result-lookalike": "strict",
5375
5376
  untrustedCallbacks: "inline"
5376
5377
  });
@@ -5397,6 +5398,7 @@ var RULE_VALUES = {
5397
5398
  "dropped-result": ["on", "off"],
5398
5399
  "trusted-state": ["on", "off"],
5399
5400
  "redundant-guard": ["on", "off"],
5401
+ "finally-return": ["on", "off"],
5400
5402
  "result-lookalike": ["off", "strict", "on"],
5401
5403
  untrustedCallbacks: ["off", "inline", "all"]
5402
5404
  };
@@ -5842,6 +5844,11 @@ var REDUNDANT_GUARD_ORIGIN = "redundant";
5842
5844
  var REDUNDANT_GUARD_MESSAGES = {
5843
5845
  redundant: '`{{guard}}` guards nothing that can fail: {{calls}}. It invents a failure path callers must unwrap for nothing. Call it directly and return its value; a trusted origin\'s failure is a programmer error, not a failure path. If the call can fail, remove its origin from "trust" in trust.config.json instead.'
5844
5846
  };
5847
+ var FINALLY_RETURN_RULE = "finally-return";
5848
+ var FINALLY_RETURN_ORIGIN = "return";
5849
+ var FINALLY_RETURN_MESSAGES = {
5850
+ return: "`return` inside `finally` overwrites any Result (Err or StatedOk) or throw leaving `try` / `catch`. Do not return from `finally`; use `Trust.using(acquire, use, release)` when cleanup returns a Result."
5851
+ };
5845
5852
  var BOUNDARY_RULE = "boundary-result";
5846
5853
  var BOUNDARY_MESSAGES = {
5847
5854
  "returns-ok-result": 'Boundary "{{member}}" returns a Result object: a Result must not cross the edge, even one that cannot fail. Return plain data (read the value, and give several outcomes their own discriminant), or leave it out by adding "{{member}}" to "exclude" of {{item}}.',
@@ -7065,6 +7072,9 @@ export {
7065
7072
  REDUNDANT_GUARD_RULE,
7066
7073
  REDUNDANT_GUARD_ORIGIN,
7067
7074
  REDUNDANT_GUARD_MESSAGES,
7075
+ FINALLY_RETURN_RULE,
7076
+ FINALLY_RETURN_ORIGIN,
7077
+ FINALLY_RETURN_MESSAGES,
7068
7078
  BOUNDARY_RULE,
7069
7079
  BOUNDARY_MESSAGES,
7070
7080
  formatFailureKinds,
@@ -7104,4 +7114,4 @@ export {
7104
7114
  readBaseline,
7105
7115
  describeBaselineDelta
7106
7116
  };
7107
- //# sourceMappingURL=chunk-VJGGEY4G.js.map
7117
+ //# sourceMappingURL=chunk-4XGOH7JE.js.map