Skip to content

Crash on TSEmptyBodyFunctionExpression AST node #2559

Closed
@guillaumewuip

Description

@guillaumewuip

I use eslint-config-airbnb-typescript. When linting the file copied below, eslint crash with this error:

Error: TSEmptyBodyFunctionExpression ASTNodes are not handled by markPropTypesAsUsed
Occurred while linting .../a/Thing.d.ts:2
    at markPropTypesAsUsed (.../node_modules/eslint-plugin-react/lib/util/usedPropTypes.js:335:15)
    at ObjectPattern (.../node_modules/eslint-plugin-react/lib/util/usedPropTypes.js:526:9)
    at updatedRuleInstructions.(anonymous function) (.../node_modules/eslint-plugin-react/lib/util/Components.js:886:47)
    at listeners.(anonymous function).forEach.listener (.../node_modules/eslint/lib/linter/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (.../node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (.../node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (.../node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (.../node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (.../node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:634:23)

File to reproduce:

// Thing.d.ts
declare class Thing {
  constructor({ id }: { id: string });
}

export default Thing;

eslint version: 6.8.0
eslint-plugin-react version: 7.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions