Skip to content

Commit fc4cdf7

Browse files
committed
fix: use utils in eslint for getting extensions
Signed-off-by: Charlike Mike Reagent <[email protected]>
1 parent 58b6c82 commit fc4cdf7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

@tunnckocore/jest-runner-eslint/src/runner.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import Module from 'module';
22

33
import { pass, fail, skip } from '@tunnckocore/create-jest-runner';
44

5+
import { getExtensionsAndWorkspaces } from '@tunnckocore/utils';
56
import cosmiconfig from 'cosmiconfig';
67
import { CLIEngine } from 'eslint';
78

89
const explorer = cosmiconfig('jest-runner');
910

1011
export default async function jestRunnerESLint({ testPath, config }) {
1112
const start = Date.now();
12-
const options = normalizeOptions(explorer.searchSync());
13+
const options = normalizeOptions(explorer.searchSync(), config.rootDir);
1314

1415
if (config.setupTestFrameworkScriptFile) {
1516
// eslint-disable-next-line import/no-dynamic-require,global-require
@@ -88,16 +89,16 @@ export default async function jestRunnerESLint({ testPath, config }) {
8889
return result;
8990
}
9091

91-
function normalizeOptions(val) {
92+
function normalizeOptions(val, rootDir) {
93+
const { extensions } = getExtensionsAndWorkspaces(rootDir);
9294
const cfg = val && val.config ? val.config : {};
9395
const eslintOptions = {
9496
// ignore: DEFAULT_IGNORE,
9597
exit: true,
9698
warnings: false,
9799
maxWarnings: 10,
98100
reporter: 'codeframe',
99-
// eslint-disable-next-line no-underscore-dangle
100-
extensions: Object.keys(Module._extensions),
101+
extensions,
101102
fix: true,
102103
reportUnusedDisableDirectives: true,
103104
...cfg.eslint,

0 commit comments

Comments
 (0)