@noego/trust 0.5.0-dev.4 → 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/README.md +30 -0
- package/dist/{baseline-DQGyHwig.d.ts → baseline-D0Ok-NGU.d.ts} +7 -0
- package/dist/{chunk-LJJDRFO7.js → chunk-BHBYQYJJ.js} +50 -3
- package/dist/chunk-BHBYQYJJ.js.map +1 -0
- package/dist/{chunk-6YBPW4NP.js → chunk-RVTPDLEW.js} +17 -1
- package/dist/chunk-RVTPDLEW.js.map +1 -0
- package/dist/{chunk-TQWRH47T.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-6YBPW4NP.js.map +0 -1
- package/dist/chunk-LJJDRFO7.js.map +0 -1
- /package/dist/{chunk-TQWRH47T.js.map → chunk-V4FYZG5Q.js.map} +0 -0
|
@@ -2051,6 +2051,12 @@ var MISUSED_PROMISE_MESSAGES = {
|
|
|
2051
2051
|
var RESULT_CONDITION_RULE = "result-condition";
|
|
2052
2052
|
var RESULT_CONDITION_ORIGIN = "condition";
|
|
2053
2053
|
var RESULT_CONDITION_MESSAGE = "Result used as a condition is always truthy (Ok and Err are both objects); test `.ok` instead: `if (result.ok)` / `if (!result.ok)`.";
|
|
2054
|
+
var RESULT_LOOKALIKE_RULE = "result-lookalike";
|
|
2055
|
+
var RESULT_LOOKALIKE_ORIGIN = "declaration";
|
|
2056
|
+
var RESULT_LOOKALIKE_MESSAGE = 'Type "{{name}}" is a hand-written Result: it is told apart by `ok: true` / `ok: false` but is not @noego/trust\'s Result, so no rule follows its failure and nothing tells it from a real Result or an `{ ok, result }` envelope. Return Result<T, E> from @noego/trust inside the program; at an edge, decide the Result and return plain data with its own discriminant (`status`, `kind`).';
|
|
2057
|
+
function resultLookalikeMessage(name) {
|
|
2058
|
+
return fillMessage(RESULT_LOOKALIKE_MESSAGE, { name });
|
|
2059
|
+
}
|
|
2054
2060
|
var TYPE_CLAIM_RULE = "type-claim";
|
|
2055
2061
|
var TYPE_CLAIM_MESSAGES = {
|
|
2056
2062
|
"claim:as": 'Type assertion claims "{{from}}" is "{{to}}", but "{{from}}" is not assignable to "{{to}}": nothing proves it. Narrow or validate the value instead.',
|
|
@@ -6244,11 +6250,16 @@ var DEFAULT_RULE_SETTINGS = Object.freeze({
|
|
|
6244
6250
|
"untrusted-value": "off",
|
|
6245
6251
|
"dropped-result": "off",
|
|
6246
6252
|
"redundant-guard": "off",
|
|
6253
|
+
"result-lookalike": "strict",
|
|
6247
6254
|
untrustedCallbacks: "inline"
|
|
6248
6255
|
});
|
|
6249
6256
|
function isRuleEnabled(config, rule) {
|
|
6250
6257
|
return config.rules[rule] === "on";
|
|
6251
6258
|
}
|
|
6259
|
+
function reportsResultLookalikes(config, strict) {
|
|
6260
|
+
const setting = config.rules["result-lookalike"];
|
|
6261
|
+
return setting === "on" || setting === "strict" && strict;
|
|
6262
|
+
}
|
|
6252
6263
|
var BOUNDARY_EXCLUDE = /^(?:[^\s.#:*]+)?(?:\.(?:[^\s.#:*]+|\*))?$/;
|
|
6253
6264
|
var TrustConfigError = class extends Error {
|
|
6254
6265
|
name = "TrustConfigError";
|
|
@@ -6264,6 +6275,7 @@ var RULE_VALUES = {
|
|
|
6264
6275
|
"untrusted-value": ["on", "off"],
|
|
6265
6276
|
"dropped-result": ["on", "off"],
|
|
6266
6277
|
"redundant-guard": ["on", "off"],
|
|
6278
|
+
"result-lookalike": ["off", "strict", "on"],
|
|
6267
6279
|
untrustedCallbacks: ["off", "inline", "all"]
|
|
6268
6280
|
};
|
|
6269
6281
|
function normalizeOrigin(origin) {
|
|
@@ -6999,6 +7011,9 @@ export {
|
|
|
6999
7011
|
RESULT_CONDITION_RULE,
|
|
7000
7012
|
RESULT_CONDITION_ORIGIN,
|
|
7001
7013
|
RESULT_CONDITION_MESSAGE,
|
|
7014
|
+
RESULT_LOOKALIKE_RULE,
|
|
7015
|
+
RESULT_LOOKALIKE_ORIGIN,
|
|
7016
|
+
resultLookalikeMessage,
|
|
7002
7017
|
TYPE_CLAIM_RULE,
|
|
7003
7018
|
TYPE_CLAIM_MESSAGES,
|
|
7004
7019
|
ACCEPT_DIRECTIVE_MESSAGES,
|
|
@@ -7031,6 +7046,7 @@ export {
|
|
|
7031
7046
|
PRESETS,
|
|
7032
7047
|
DEFAULT_RULE_SETTINGS,
|
|
7033
7048
|
isRuleEnabled,
|
|
7049
|
+
reportsResultLookalikes,
|
|
7034
7050
|
TrustConfigError,
|
|
7035
7051
|
normalizeOrigin,
|
|
7036
7052
|
loadTrustConfig,
|
|
@@ -7063,4 +7079,4 @@ export {
|
|
|
7063
7079
|
readBaseline,
|
|
7064
7080
|
describeBaselineDelta
|
|
7065
7081
|
};
|
|
7066
|
-
//# sourceMappingURL=chunk-
|
|
7082
|
+
//# sourceMappingURL=chunk-RVTPDLEW.js.map
|