diff --git a/package.json b/package.json index 822bf422..2f7b2d2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-angular", - "version": "3.1.0", + "version": "3.1.1", "description": "ESLint rules for AngularJS projects", "main": "index.js", "scripts": { diff --git a/rules/file-name.js b/rules/file-name.js index 64576ae8..d5d47f8c 100644 --- a/rules/file-name.js +++ b/rules/file-name.js @@ -46,7 +46,7 @@ function handleModuleCase(node, context, defaultFilename) { }); // Check that the definition is an import declaration. - if (variable.defs[0].parent.type !== 'ImportDeclaration') { + if (!(variable && variable.defs && variable.defs[0] && variable.defs[0].parent && variable.defs[0].parent.type === 'ImportDeclaration')) { return defaultFilename; }