eslint-plugin-testing-library icon indicating copy to clipboard operation
eslint-plugin-testing-library copied to clipboard

Bundle plugin in ESM format

Open Belco90 opened this issue 1 year ago • 4 comments

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/

Belco90 avatar Apr 16 '24 14:04 Belco90

Any update?

Flat config has been the default for 10 months now.

ESLint 8 has reached EOL

While you are at it, you might want to update README.md with flat config examples as well.

sdavids avatar Jan 15 '25 13:01 sdavids

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 avatar Jan 15 '25 13:01 sdavids

@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

G-Rath avatar Jan 15 '25 20:01 G-Rath

https://github.com/testing-library/eslint-plugin-testing-library/issues/900#issuecomment-2592836914 is obsolete.

sdavids avatar Jan 16 '25 16:01 sdavids