@wcstack/lint 4.1.0 → 4.1.1
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/cli.cjs +33 -5
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -10487,6 +10487,35 @@ function propertyKeyIs(property, name) {
|
|
|
10487
10487
|
if (!property.computed && key.type === "Identifier") return key.name === name;
|
|
10488
10488
|
return key.type === "Literal" && key.value === name;
|
|
10489
10489
|
}
|
|
10490
|
+
function findOwnThis(text3, kind) {
|
|
10491
|
+
let program;
|
|
10492
|
+
const prefix = kind === "body" ? PREFIX : VALUE_PREFIX;
|
|
10493
|
+
try {
|
|
10494
|
+
program = parse3(prefix + text3 + (kind === "body" ? SUFFIX : VALUE_SUFFIX), { ecmaVersion: "latest", sourceType: "module" });
|
|
10495
|
+
} catch {
|
|
10496
|
+
return null;
|
|
10497
|
+
}
|
|
10498
|
+
const wrapper = unwrapWrapper(program);
|
|
10499
|
+
if (wrapper === null) return null;
|
|
10500
|
+
let root = wrapper.body;
|
|
10501
|
+
if (kind === "value") {
|
|
10502
|
+
const statement = wrapper.body.body.length === 1 ? wrapper.body.body[0] : null;
|
|
10503
|
+
if (statement === null || statement.type !== "ExpressionStatement" || statement.expression.type !== "FunctionExpression") return null;
|
|
10504
|
+
root = statement.expression.body;
|
|
10505
|
+
}
|
|
10506
|
+
let found = null;
|
|
10507
|
+
const walk = (node) => {
|
|
10508
|
+
if (found !== null || isClassNode(node)) return;
|
|
10509
|
+
if (isFunctionNode(node) && node.type !== "ArrowFunctionExpression") return;
|
|
10510
|
+
if (node.type === "ThisExpression") {
|
|
10511
|
+
found = { start: node.start - prefix.length, end: node.end - prefix.length };
|
|
10512
|
+
return;
|
|
10513
|
+
}
|
|
10514
|
+
forEachChild(node, walk);
|
|
10515
|
+
};
|
|
10516
|
+
forEachChild(root, walk);
|
|
10517
|
+
return found;
|
|
10518
|
+
}
|
|
10490
10519
|
|
|
10491
10520
|
// src/core/messages.ts
|
|
10492
10521
|
function resolveLocale(locale2) {
|
|
@@ -13309,7 +13338,8 @@ var BUILTIN_TAGS = {
|
|
|
13309
13338
|
"downlink",
|
|
13310
13339
|
"rtt",
|
|
13311
13340
|
"saveData",
|
|
13312
|
-
"supported"
|
|
13341
|
+
"supported",
|
|
13342
|
+
"offline"
|
|
13313
13343
|
],
|
|
13314
13344
|
"commands": []
|
|
13315
13345
|
},
|
|
@@ -15918,14 +15948,12 @@ function hasOutOfRangeIndexName(script) {
|
|
|
15918
15948
|
}
|
|
15919
15949
|
return false;
|
|
15920
15950
|
}
|
|
15921
|
-
var ANY_MEMBER = { has: () => true };
|
|
15922
15951
|
function validateOnHandlerThis(script, scriptStart, locale2) {
|
|
15923
15952
|
const msgs = getMessages(locale2);
|
|
15924
15953
|
const out = [];
|
|
15925
15954
|
for (const handler of analyzeOnHandlerSources(script)) {
|
|
15926
|
-
const
|
|
15927
|
-
|
|
15928
|
-
if (first === void 0) continue;
|
|
15955
|
+
const first = findOwnThis(handler.text, handler.kind);
|
|
15956
|
+
if (first === null) continue;
|
|
15929
15957
|
out.push({
|
|
15930
15958
|
code: WcsDiagnosticCode.OnHandlerThis,
|
|
15931
15959
|
start: scriptStart + handler.start + first.start,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/lint",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Static-contract validator CLI (wcs-validate) for wcstack data-wcs bindings and wcstack.manifest.json sidecars. Thin npm wrapper around the wcstack-intellisense validator core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|