We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
require()
1 parent 4d5f5cb commit 393e8e1Copy full SHA for 393e8e1
rules/import-index.js
@@ -6,7 +6,7 @@ const isImportingIndex = value => regexp.test(value);
6
const normalize = value => value.replace(regexp, '$1');
7
8
const importIndex = (context, node, argument) => {
9
- if (isImportingIndex(argument.value)) {
+ if (argument && isImportingIndex(argument.value)) {
10
context.report({
11
node,
12
message: 'Do not reference the index file directly.',
test/import-index.js
@@ -18,6 +18,7 @@ const error = {
18
19
ruleTester.run('import-index', rule, {
20
valid: [
21
+ 'const m = require()',
22
'const m = require(\'.\')',
23
'const m = require(\'..\')',
24
'const m = require(\'../..\')',
0 commit comments