diff --git a/lib/rules/entry-points.js b/lib/rules/entry-points.js index 1cd4bf9..83c19c5 100644 --- a/lib/rules/entry-points.js +++ b/lib/rules/entry-points.js @@ -15,7 +15,7 @@ module.exports = { let hasValidEntryPoint = false; let scriptType = getScriptType(context); - if (!scriptType.value || !scriptType.def) { + if (!scriptType || !scriptType.value || !scriptType.def) { return; } diff --git a/tests/rules/entry-points.js b/tests/rules/entry-points.js index b274e6b..8c82071 100644 --- a/tests/rules/entry-points.js +++ b/tests/rules/entry-points.js @@ -101,6 +101,16 @@ define([], function() { }); `, }, + { + code: ` +// no @NScriptType comment + +define([], function() { + return { foo: 'bar' }; +}); + `, + // Should not error, since scriptType is null and rule should exit early + }, ], invalid: [