Skip to content

Commit

Permalink
fix variable declaration by function (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
pipopotamasu authored Feb 21, 2024
1 parent 2ff4d66 commit 5e22a62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rules/no-implicit-any/variable-declarator/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ ruleTester.run('variable-declarator', rule, {
const { bar } = foo();
`,
},
{
code: `
const foo = (): any => 'test';
const val = foo();
`,
},
{
code: `
const foo = () => ([1, 2]);
Expand Down
1 change: 1 addition & 0 deletions rules/no-implicit-any/variable-declarator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const lintVariableDeclarator = (
node.id.typeAnnotation ||
node.id.type === AST_NODE_TYPES.ObjectPattern ||
node.id.type === AST_NODE_TYPES.ArrayPattern ||
node.init?.type === AST_NODE_TYPES.CallExpression ||
node.parent.type !== AST_NODE_TYPES.VariableDeclaration ||
node.parent.parent.type === AST_NODE_TYPES.ForOfStatement
)
Expand Down

0 comments on commit 5e22a62

Please sign in to comment.