test: the store contract reads the last match without Array.at (the node tsconfig's lib)
This commit is contained in:
@@ -15,7 +15,7 @@ describe("a store's use()", () => {
|
||||
for (const m of src.matchAll(/\b\w+\.use\(\)/g)) {
|
||||
const before = src.slice(0, m.index);
|
||||
const owners = [...before.matchAll(/(?:function\s+(\w+)|const\s+(\w+)\s*=\s*\()/g)];
|
||||
const owner = owners.at(-1);
|
||||
const owner = owners[owners.length - 1];
|
||||
const name = owner?.[1] ?? owner?.[2] ?? "";
|
||||
if (!name.startsWith("use")) offenders.push(`${f}: ${m[0]} in ${name || "?"}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user