Add governed module and interface controls

This commit is contained in:
2026-08-04 05:20:47 +02:00
parent 5bc7d748f8
commit d6e7c8b0b1
27 changed files with 1700 additions and 74 deletions
+11 -1
View File
@@ -40,7 +40,7 @@ function scanStructuralSourcePositions(roots) {
}
if (ts.isPropertyAssignment(node)) {
const name = nodeName(node.name);
if ((isStructuralName(name) || isAlgorithmNameProperty(node) || isListOptionValueProperty(node)) && hasI18nLiteral(node.initializer)) report(node, `object ${name}`);
if ((isStructuralName(name) || isAlgorithmNameProperty(node) || isListOptionValueProperty(node)) && hasI18nLiteral(node.initializer) && !isPresentationalBlockerProperty(node)) report(node, `object ${name}`);
if (hasI18nLiteral(node.name) && !isAllowedStructuralStringPosition(node.name, file)) report(node, "object key");
}
if (ts.isShorthandPropertyAssignment(node) && node.name.text.includes("i18n:")) report(node, "object key");
@@ -221,6 +221,16 @@ function isStructuralJsxValue(node) {
return parent.tagName.getText() === "option";
}
function isPresentationalBlockerProperty(node) {
if (nodeName(node.name) !== "target" || !ts.isObjectLiteralExpression(node.parent)) return false;
const propertyNames = new Set(
node.parent.properties
.filter((property) => ts.isPropertyAssignment(property))
.map((property) => nodeName(property.name))
);
return propertyNames.has("actor") && propertyNames.has("requiredAction");
}
function hasAncestorVariable(node, variableName) {
let current = node.parent;
while (current) {