@noego/trust 0.5.0-dev.5 → 0.5.0-dev.6
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.
- package/dist/{baseline-DQGyHwig.d.ts → baseline-D0Ok-NGU.d.ts} +7 -0
- package/dist/{chunk-EJ4O7BCA.js → chunk-BHBYQYJJ.js} +8 -5
- package/dist/{chunk-EJ4O7BCA.js.map → chunk-BHBYQYJJ.js.map} +1 -1
- package/dist/{chunk-GJUWPZZJ.js → chunk-RVTPDLEW.js} +8 -1
- package/dist/chunk-RVTPDLEW.js.map +1 -0
- package/dist/{chunk-WCC25ZAI.js → chunk-V4FYZG5Q.js} +2 -2
- package/dist/cli/index.js +4 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/eslint/index.d.ts +2 -2
- package/dist/eslint/index.js +2 -2
- package/dist/native/trust_native_wasm.wasm +0 -0
- package/package.json +4 -4
- package/dist/chunk-GJUWPZZJ.js.map +0 -1
- /package/dist/{chunk-WCC25ZAI.js.map → chunk-V4FYZG5Q.js.map} +0 -0
|
@@ -80,6 +80,12 @@ interface TrustConfig {
|
|
|
80
80
|
}
|
|
81
81
|
/** An opt-in rule's switch. */
|
|
82
82
|
type RuleSwitch = 'on' | 'off';
|
|
83
|
+
/**
|
|
84
|
+
* `result-lookalike`'s setting: `strict` (default) reports only in strict files (`trust check --strict`, or the
|
|
85
|
+
* config's `strict` globs), as errors; `on` reports in every checked file (an error where the file is strict, a
|
|
86
|
+
* warning elsewhere); `off` reports nothing.
|
|
87
|
+
*/
|
|
88
|
+
type ResultLookalikeSetting = 'off' | 'strict' | 'on';
|
|
83
89
|
/** Which callback parameters are untrusted-value sources (see the file comment). */
|
|
84
90
|
type UntrustedCallbacks = 'off' | 'inline' | 'all';
|
|
85
91
|
/** The rules that are off unless a config turns them on. */
|
|
@@ -89,6 +95,7 @@ interface TrustRuleSettings {
|
|
|
89
95
|
readonly 'untrusted-value': RuleSwitch;
|
|
90
96
|
readonly 'dropped-result': RuleSwitch;
|
|
91
97
|
readonly 'redundant-guard': RuleSwitch;
|
|
98
|
+
readonly 'result-lookalike': ResultLookalikeSetting;
|
|
92
99
|
readonly untrustedCallbacks: UntrustedCallbacks;
|
|
93
100
|
}
|
|
94
101
|
/** What a config that sets nothing gets: the opt-in rules off, callbacks as today. */
|
|
@@ -47,10 +47,11 @@ import {
|
|
|
47
47
|
isTrustPackageFile,
|
|
48
48
|
nodeBelow,
|
|
49
49
|
realpathOrSelf,
|
|
50
|
+
reportsResultLookalikes,
|
|
50
51
|
resultLookalikeMessage,
|
|
51
52
|
svelteFor,
|
|
52
53
|
trustDirectivesIn
|
|
53
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-RVTPDLEW.js";
|
|
54
55
|
|
|
55
56
|
// src/core/guard.ts
|
|
56
57
|
function unparen(ts, node) {
|
|
@@ -3213,9 +3214,11 @@ function checkSourceFileWithAccepted(options) {
|
|
|
3213
3214
|
};
|
|
3214
3215
|
visit(sourceFile);
|
|
3215
3216
|
const strict = options.strict ?? isStrictByConfig(config, sourceFile.fileName);
|
|
3216
|
-
|
|
3217
|
-
const
|
|
3218
|
-
|
|
3217
|
+
if (reportsResultLookalikes(config, strict)) {
|
|
3218
|
+
for (const lookalike of resultLookalikesIn(ts, sourceFile)) {
|
|
3219
|
+
const finding = findingAt(lookalike.start, RESULT_LOOKALIKE_RULE, RESULT_LOOKALIKE_ORIGIN, resultLookalikeMessage(lookalike.name));
|
|
3220
|
+
findings.push(strict ? finding : { ...finding, severity: "warning" });
|
|
3221
|
+
}
|
|
3219
3222
|
}
|
|
3220
3223
|
if (isRuleEnabled(config, DROPPED_RESULT_RULE)) {
|
|
3221
3224
|
for (const dropped of droppedResultsIn(sourceFile, droppedResultContext(ts, checker, policy))) {
|
|
@@ -3287,4 +3290,4 @@ export {
|
|
|
3287
3290
|
checkSourceFile,
|
|
3288
3291
|
checkSourceFileWithAccepted
|
|
3289
3292
|
};
|
|
3290
|
-
//# sourceMappingURL=chunk-
|
|
3293
|
+
//# sourceMappingURL=chunk-BHBYQYJJ.js.map
|