Skip to content

Commit

Permalink
Chore: fix a require expression to work with webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Jul 25, 2018
1 parent a6156b8 commit 4045239
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,10 @@ export function parseScript(
code: string,
parserOptions: any,
): ESLintExtendedProgram {
const parser: ESLintCustomParser = require(parserOptions.parser || "espree") //eslint-disable-line @mysticatea/ts/no-var-requires
const parser: ESLintCustomParser =
typeof parserOptions.parser === "string"
? require(parserOptions.parser)
: require("espree")
const result: any =
typeof parser.parseForESLint === "function"
? parser.parseForESLint(code, parserOptions)
Expand Down

0 comments on commit 4045239

Please sign in to comment.