Skip to content

Commit 4c7e313

Browse files
skip linting label and description in default interfaces
1 parent f126b8a commit 4c7e313

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ function isObjectWithProperties(node) {
2020
return true;
2121
}
2222

23+
// Default interface props don't need labels and descriptions
24+
function isDefaultInterfaceProperty(propertyName, properties) {
25+
if (propertyName === "label" || propertyName === "description") {
26+
const interfacePropValue = findPropertyWithName("type", properties).value;
27+
return (interfacePropValue.value === "$.interface.timer" || interfacePropValue.value === "$.interface.http");
28+
}
29+
return false;
30+
}
31+
2332
function getComponentFromNode(node) {
2433
if (isDefaultExport(node) && isObjectWithProperties(node.declaration)) {
2534
return node.declaration;
@@ -102,6 +111,7 @@ function componentPropsContainsPropertyCheck(context, node, propertyName) {
102111
// We don't want to lint app props or props that are defined in propDefinitions
103112
if (!isObjectWithProperties(propDef)) continue;
104113
if (astIncludesProperty("propDefinition", propDef.properties)) continue;
114+
if (isDefaultInterfaceProperty(propertyName, propDef.properties)) continue;
105115
if (!astIncludesProperty(propertyName, propDef.properties)) {
106116
context.report({
107117
node: prop,

0 commit comments

Comments
 (0)