Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79fe2b7

Browse files
committed
duplicated logic in no-extraneous-class
1 parent ca5836e commit 79fe2b7

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

packages/eslint-plugin/src/rules/no-extraneous-class.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,6 @@ export default util.createRule<Options, MessageIds>({
5656
}
5757
],
5858
create(context, [{ allowConstructorOnly, allowEmpty, allowStaticOnly }]) {
59-
function getReportNode(node: TSESTree.ClassBody): TSESTree.Node {
60-
if (!node.parent) {
61-
return node;
62-
}
63-
if ('id' in node.parent && node.parent.id) {
64-
return node.parent.id;
65-
}
66-
67-
return node.parent;
68-
}
69-
7059
return {
7160
ClassBody(node: TSESTree.ClassBody) {
7261
const parent = node.parent as
@@ -78,7 +67,7 @@ export default util.createRule<Options, MessageIds>({
7867
return;
7968
}
8069

81-
const reportNode = getReportNode(node);
70+
const reportNode = 'id' in parent && parent.id ? parent.id : parent;
8271

8372
if (node.body.length === 0) {
8473
if (allowEmpty) {

0 commit comments

Comments
 (0)