Skip to content

Commit

Permalink
Remove places where CLIEngine is used
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jan 26, 2023
1 parent 81aa4c6 commit 4bc5785
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions tests/lib/util/define-regexp-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,18 @@ describe("define-regexp-handler", () => {
})

function lint(text) {
if (ESLint) {
const eslint = new ESLint({
cwd: TEST_CWD,
plugins: { "eslint-plugin-es-x": plugin },
useEslintrc: false,
overrideConfig: {
parserOptions: {
ecmaVersion: 2019,
},
plugins: ["es-x"],
},
})
return eslint
.lintText(text, { filePath: "test.js" })
.then((results) => results[0])
}
const engine = new (require("eslint").CLIEngine)({
const eslint = new ESLint({
cwd: TEST_CWD,
plugins: { "eslint-plugin-es-x": plugin },
useEslintrc: false,
plugins: ["es-x"],
parserOptions: {
ecmaVersion: 2019,
overrideConfig: {
parserOptions: {
ecmaVersion: 2019,
},
plugins: ["es-x"],
},
})
engine.addPlugin("eslint-plugin-es-x", plugin)
return Promise.resolve(engine.executeOnText(text, "test.js").results[0])
return eslint
.lintText(text, { filePath: "test.js" })
.then((results) => results[0])
}

0 comments on commit 4bc5785

Please sign in to comment.