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

benmosher / eslint-plugin-import / #28399472

pending completion
#28399472

push

GitHub
<a href="https://github.com/benmosher/eslint-plugin-import/commit/<a class=hub.com/benmosher/eslint-plugin-import/commit/79ad37dfbf90869a29029b2bc556bd6108018c99">79ad37dfb<a href="https://github.com/benmosher/eslint-plugin-import/commit/79ad37dfbf90869a29029b2bc556bd6108018c99">">Merge </a><a class="double-link" href="https://github.com/benmosher/eslint-plugin-import/commit/<a class="double-link" href="https://github.com/benmosher/eslint-plugin-import/commit/44e85782da066487a4a5f5a62ae9b8d0c1d55aff">44e85782d</a>">44e85782d</a><a href="https://github.com/benmosher/eslint-plugin-import/commit/79ad37dfbf90869a29029b2bc556bd6108018c99"> into 4a9be6384">4a9be6384</a>

1363 of 1848 branches covered (73.76%)

1677 of 2595 relevant lines covered (64.62%)

38.84 hits per line

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

0.0
/utils/unambiguous.js
1
'use strict';
2
exports.__esModule = true;
×
3

4

5
const pattern = /(^|;)\s*(export|import)((\s+\w)|(\s*[{*=]))/m;
×
6
/**
7
 * detect possible imports/exports without a full parse.
8
 *
9
 * A negative test means that a file is definitely _not_ a module.
10
 * A positive test means it _could_ be.
11
 *
12
 * Not perfect, just a fast way to disqualify large non-ES6 modules and
13
 * avoid a parse.
14
 * @type {RegExp}
15
 */
16
exports.test = function isMaybeUnambiguousModule(content) {
×
17
  return pattern.test(content);
×
18
};
19

20
// future-/Babel-proof at the expense of being a little loose
21
const unambiguousNodeType = /^(?:(?:Exp|Imp)ort.*Declaration|TSExportAssignment)$/;
×
22

23
/**
24
 * Given an AST, return true if the AST unambiguously represents a module.
25
 * @param  {Program node}  ast
26
 * @return {Boolean}
27
 */
28
exports.isModule = function isUnambiguousModule(ast) {
×
29
  return ast.body.some(node => unambiguousNodeType.test(node.type));
×
30
};
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