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

Skip to content

Commit 56bb308

Browse files
armano2JamesHenry
authored andcommitted
fix(plugin-typescript): fix issues in no-misused-new rule
1 parent 64e9320 commit 56bb308

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/eslint-plugin-typescript/lib/rules/adjacent-overload-signatures.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ module.exports = {
4949
}
5050
case 'TSDeclareFunction':
5151
case 'FunctionDeclaration':
52-
case 'TSNamespaceFunctionDeclaration':
53-
case 'TSEmptyBodyFunctionDeclaration': {
52+
case 'TSNamespaceFunctionDeclaration': {
5453
return member.id && member.id.name;
5554
}
5655
case 'TSMethodSignature': {

packages/eslint-plugin-typescript/lib/rules/no-misused-new.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = {
6666

6767
return {
6868
'TSInterfaceBody > TSConstructSignatureDeclaration'(node) {
69-
if (isMatchingParentType(node.parent.parent, node.typeAnnotation)) {
69+
if (isMatchingParentType(node.parent.parent, node.returnType)) {
7070
// constructor
7171
context.report({
7272
node,
@@ -84,7 +84,7 @@ module.exports = {
8484
if (
8585
node.value &&
8686
(node.value.type === 'TSEmptyBodyFunctionExpression' ||
87-
node.value.type === 'TSEmptyBodyFunctionDeclaration')
87+
(node.value.type === 'TSDeclareFunction' && !node.value.body))
8888
) {
8989
if (isMatchingParentType(node.parent.parent, node.value.returnType)) {
9090
context.report({

0 commit comments

Comments
 (0)