11import path from "path" ;
22import escope from "eslint-scope" ;
33import unpad from "dedent" ;
4- import { fileURLToPath } from "url" ;
5- import { createRequire } from "module" ;
64import { parseForESLint as parseForESLintOriginal } from "../lib/index.cjs" ;
75import { ESLint } from "eslint" ;
6+ import { itDummy , commonJS } from "$repo-utils" ;
87
98function parseForESLint ( code , options ) {
109 return parseForESLintOriginal ( code , {
@@ -19,11 +18,12 @@ function parseForESLint(code, options) {
1918
2019const ESLINT_VERSION = ESLint . version ;
2120const isESLint7 = ESLINT_VERSION . startsWith ( "7." ) ;
22- const dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
21+ const { __dirname : dirname , require } = commonJS ( import . meta. url ) ;
2322
2423// @babel /eslint-parser 8 will drop ESLint 7 support
25- const itESLint7 = isESLint7 && ! process . env . BABEL_8_BREAKING ? it : it . skip ;
26- const itESLint8 = isESLint7 ? it . skip : it ;
24+
25+ const itESLint7 = isESLint7 && ! process . env . BABEL_8_BREAKING ? it : itDummy ;
26+ const itESLint8 = isESLint7 ? itDummy : it ;
2727
2828const BABEL_OPTIONS = {
2929 configFile : path . resolve (
@@ -122,8 +122,6 @@ describe("Babel and Espree", () => {
122122 }
123123
124124 beforeAll ( ( ) => {
125- const require = createRequire ( import . meta. url ) ;
126-
127125 // Use the version of Espree that is a dependency of
128126 // the version of ESLint we are testing against.
129127 const espreePath = require . resolve ( "espree" , {
0 commit comments