Skip to content

Commit 425ed94

Browse files
committed
Fix for uninitialized variables
1 parent e8215ae commit 425ed94

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const getImport = (context, callback) => ({
4747
},
4848
VariableDeclaration: node => {
4949
node.declarations.forEach(({ init }) => {
50-
if (isImportExpression(init)) {
50+
if (init && isImportExpression(init)) {
5151
callback(resolveImport(context, node, init.arguments[0]));
5252
}
5353
});

tests/rules/no-cross-imports.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ruleTester.run('no-cross-imports', rule, {
1111
"import 'module';",
1212
"import '../some/relative/path';",
1313
'someFunction();',
14+
'let a;',
1415
{
1516
options: [{ allow: '@test/workspace' }],
1617
filename: '/some/path.js',

0 commit comments

Comments
 (0)