eslint-plugin-jest
eslint-plugin-jest copied to clipboard
`__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
},
},