`__dirname is not defined in ES module scope`
Hello, I'm getting __dirname not defined error when I use the plugin in an ESM ("type": "module") project and I believe this line is the source:
https://github.com/jest-community/eslint-plugin-jest/blob/33c5efef26a4c2d4f8a52d56720a954cc06f1f8d/src/index.ts#L23
I have seen from the node_modules directory that there's only CJS files and no ESM module. If there's no technical blocker, bundling and exposing ESM modules would be great.
Just to keep this in mind, the following declaration in package.json is needed
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js", // for esm
"require": "./dist/index.cjs" // for cjs
},
},
Given the nature of this package, I don't think there's much value in including two versions of the code in the published package though I don't mind potentially changing such lines to something more robust.
In saying that, I can't reproduce this - importing the plugin in a project with type: module in the package.json works fine; could you provide more details on your setup?
Yeah, we don't list module in our package.json, so js files should be treated as CJS. How are you importing?