Skip to content

Commit

Permalink
[Refactor] display-name: consolidate identical visitors
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 25, 2023
1 parent a684ae1 commit 8f24366
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions lib/rules/display-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module.exports = {
markDisplayNameAsDeclared(component.node.type === 'TSAsExpression' ? component.node.expression : component.node);
},

FunctionExpression(node) {
'FunctionExpression, FunctionDeclaration, ArrowFunctionExpression'(node) {
if (ignoreTranspilerName || !hasTranspilerName(node)) {
return;
}
Expand All @@ -207,40 +207,14 @@ module.exports = {
}
},

FunctionDeclaration(node) {
if (ignoreTranspilerName || !hasTranspilerName(node)) {
return;
}
if (components.get(node)) {
markDisplayNameAsDeclared(node);
}
},

ArrowFunctionExpression(node) {
if (ignoreTranspilerName || !hasTranspilerName(node)) {
return;
}

if (components.get(node)) {
markDisplayNameAsDeclared(node);
}
},

MethodDefinition(node) {
if (!propsUtil.isDisplayNameDeclaration(node.key)) {
return;
}
markDisplayNameAsDeclared(node);
},

ClassExpression(node) {
if (ignoreTranspilerName || !hasTranspilerName(node)) {
return;
}
markDisplayNameAsDeclared(node);
},

ClassDeclaration(node) {
'ClassExpression, ClassDeclaration'(node) {
if (ignoreTranspilerName || !hasTranspilerName(node)) {
return;
}
Expand Down

0 comments on commit 8f24366

Please sign in to comment.