Skip to content

Commit

Permalink
fix: use utils in eslint for getting extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
  • Loading branch information
tunnckoCore committed Sep 18, 2019
1 parent 58b6c82 commit fc4cdf7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions @tunnckocore/jest-runner-eslint/src/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import Module from 'module';

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

import { getExtensionsAndWorkspaces } from '@tunnckocore/utils';
import cosmiconfig from 'cosmiconfig';
import { CLIEngine } from 'eslint';

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

export default async function jestRunnerESLint({ testPath, config }) {
const start = Date.now();
const options = normalizeOptions(explorer.searchSync());
const options = normalizeOptions(explorer.searchSync(), config.rootDir);

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

function normalizeOptions(val) {
function normalizeOptions(val, rootDir) {
const { extensions } = getExtensionsAndWorkspaces(rootDir);
const cfg = val && val.config ? val.config : {};
const eslintOptions = {
// ignore: DEFAULT_IGNORE,
exit: true,
warnings: false,
maxWarnings: 10,
reporter: 'codeframe',
// eslint-disable-next-line no-underscore-dangle
extensions: Object.keys(Module._extensions),
extensions,
fix: true,
reportUnusedDisableDirectives: true,
...cfg.eslint,
Expand Down

0 comments on commit fc4cdf7

Please sign in to comment.