Skip to content

Commit

Permalink
[Fix] no-unused-prop-types: make markPropTypesAsUsed work with `T…
Browse files Browse the repository at this point in the history
…SEmptyBodyFunctionExpression` AST node

Fixes #2559.
  • Loading branch information
guillaumewuip authored and ljharb committed Feb 1, 2020
1 parent 66c0d66 commit b517b9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/util/usedPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
type = 'destructuring';
properties = node.properties;
break;
case 'TSEmptyBodyFunctionExpression':
break;
default:
throw new Error(`${node.type} ASTNodes are not handled by markPropTypesAsUsed`);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/lib/rules/no-unused-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -3202,6 +3202,15 @@ ruleTester.run('no-unused-prop-types', rule, {
}
`,
parser: parsers.TYPESCRIPT_ESLINT
},
{
code: [
'declare class Thing {',
' constructor({ id }: { id: string });',
'}',
'export default Thing;'
].join('\n'),
parser: parsers.TYPESCRIPT_ESLINT
}
],

Expand Down

0 comments on commit b517b9e

Please sign in to comment.