Skip to content

Commit

Permalink
fix: add missing type check to no-unused-vars
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Feb 21, 2021
1 parent fe74a6f commit 34b9d6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/eslint-plugin/src/rules/no-unused-vars.ts
Expand Up @@ -408,10 +408,12 @@ export default util.createRule<Options, MessageIds>({
return cached;
}

for (const statement of node.body?.body ?? []) {
if (statement.type === AST_NODE_TYPES.TSExportAssignment) {
MODULE_DECL_CACHE.set(node, true);
return true;
if (node.body && node.body.type !== AST_NODE_TYPES.TSModuleDeclaration) {
for (const statement of node.body.body ?? []) {
if (statement.type === AST_NODE_TYPES.TSExportAssignment) {
MODULE_DECL_CACHE.set(node, true);
return true;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-estree/src/convert.ts
Expand Up @@ -1932,7 +1932,7 @@ export class Converter {
}

case SyntaxKind.NumericLiteral: {
return this.createNode<TSESTree.NumericLiteral>(node, {
return this.createNode<TSESTree.NumberLiteral>(node, {
type: AST_NODE_TYPES.Literal,
value: Number(node.text),
raw: node.getText(),
Expand Down

0 comments on commit 34b9d6a

Please sign in to comment.