Add governed module and interface controls
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user