Skip to content

Commit b517b9e

Browse files
guillaumewuipljharb
authored andcommitted
[Fix] no-unused-prop-types: make markPropTypesAsUsed work with TSEmptyBodyFunctionExpression AST node
Fixes #2559.
1 parent 66c0d66 commit b517b9e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/util/usedPropTypes.js

+2
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
339339
type = 'destructuring';
340340
properties = node.properties;
341341
break;
342+
case 'TSEmptyBodyFunctionExpression':
343+
break;
342344
default:
343345
throw new Error(`${node.type} ASTNodes are not handled by markPropTypesAsUsed`);
344346
}

tests/lib/rules/no-unused-prop-types.js

+9
Original file line numberDiff line numberDiff line change
@@ -3202,6 +3202,15 @@ ruleTester.run('no-unused-prop-types', rule, {
32023202
}
32033203
`,
32043204
parser: parsers.TYPESCRIPT_ESLINT
3205+
},
3206+
{
3207+
code: [
3208+
'declare class Thing {',
3209+
' constructor({ id }: { id: string });',
3210+
'}',
3211+
'export default Thing;'
3212+
].join('\n'),
3213+
parser: parsers.TYPESCRIPT_ESLINT
32053214
}
32063215
],
32073216

0 commit comments

Comments
 (0)