File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
packages/plugins/eslint-plugin-react-x/src/rules Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -219,14 +219,18 @@ function reportUnusedProp(
219219 const declaration = prop . getDeclarations ( ) ?. [ 0 ] ;
220220 if ( declaration == null ) return ;
221221
222- const node = services . tsNodeToESTreeNodeMap . get ( declaration ) ;
223- const keyNode = node . type === T . TSPropertySignature
224- ? node . key
225- : node ;
222+ const declarationNode = services . tsNodeToESTreeNodeMap . get ( declaration ) ;
223+
224+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
225+ if ( declarationNode == null ) return ; // is undefined if declaration is in a different file
226+
227+ const nodeToReport = declarationNode . type === T . TSPropertySignature
228+ ? declarationNode . key
229+ : declarationNode ;
226230
227231 context . report ( {
228232 messageId : "noUnusedProps" ,
229- node : keyNode ,
233+ node : nodeToReport ,
230234 data : { name : prop . name } ,
231235 } ) ;
232236}
You can’t perform that action at this time.
0 commit comments