• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

benmosher / eslint-plugin-import / #28399480

31 Aug 2017 08:48AM UTC coverage: 0.0% (-71.0%) from 71.019%
#28399480

push

ljharb
Handle unresolved js import when type is exported with the same name

0 of 1985 branches covered (0.0%)

0 of 8 new or added lines in 2 files covered. (0.0%)

2289 existing lines in 51 files now uncovered.

0 of 3012 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/rules/no-nodejs-modules.js
1
import importType from '../core/importType';
2
import moduleVisitor from 'eslint-module-utils/moduleVisitor';
3
import docsUrl from '../docsUrl';
4

5
function reportIfMissing(context, node, allowed, name) {
UNCOV
6
  if (allowed.indexOf(name) === -1 && importType(name, context) === 'builtin') {
×
UNCOV
7
    context.report(node, 'Do not import Node.js builtin module "' + name + '"');
×
8
  }
9
}
10

UNCOV
11
module.exports = {
×
12
  meta: {
13
    type: 'suggestion',
14
    docs: {
15
      url: docsUrl('no-nodejs-modules'),
16
    },
17
    schema: [
18
      {
19
        type: 'object',
20
        properties: {
21
          allow: {
22
            type: 'array',
23
            uniqueItems: true,
24
            items: {
25
              type: 'string',
26
            },
27
          },
28
        },
29
        additionalProperties: false,
30
      },
31
    ],
32
  },
33

34
  create: function (context) {
UNCOV
35
    const options = context.options[0] || {};
×
UNCOV
36
    const allowed = options.allow || [];
×
37

UNCOV
38
    return moduleVisitor((source, node) => {
×
UNCOV
39
      reportIfMissing(context, node, allowed, source.value);
×
40
    }, { commonjs: true });
41
  },
42
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc