Bundle plugin in ESM format
The current bundle is in CJS format. Since ESLint flat config default format is ESM, we need to build the plugin for this format by default. Let's keep compatibility with CJS format for now, so we get both (we will have to point to the corresponding dist/ paths for each in the exports field of the package.json.
Some resources on how to publish in both CJS and ESM with TS:
- https://blog.logrocket.com/publishing-node-modules-typescript-es-modules/
- https://thesametech.com/how-to-build-typescript-project/
Any update?
Flat config has been the default for 10 months now.
While you are at it, you might want to update README.md with flat config examples as well.
Does not work:
eslint.config.js
import testingLibrary from 'eslint-plugin-testing-library';
export default [
{
files: ['**/*.test.js'],
...testingLibrary.configs['flat/dom'],
},
];
Edit: It works.
@sdavids could you open a new issue with more information on how it's not working, ideally with a reproduction? We already support ESLint v9 + flat config (with examples of that in our README), and I personally have been using it in cjs and mjs configs without any issues
https://github.com/testing-library/eslint-plugin-testing-library/issues/900#issuecomment-2592836914 is obsolete.