Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle plugin in ESM format #900

Open
Belco90 opened this issue Apr 16, 2024 · 4 comments
Open

Bundle plugin in ESM format #900

Belco90 opened this issue Apr 16, 2024 · 4 comments
Assignees
Labels
chore Changes that affect the build system, CI config or other changes that don't modify src/test files enhancement New feature or request

Comments

@Belco90
Copy link
Member

Belco90 commented Apr 16, 2024

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:

@Belco90 Belco90 converted this from a draft issue Apr 16, 2024
@Belco90 Belco90 self-assigned this Apr 16, 2024
@Belco90 Belco90 added the chore Changes that affect the build system, CI config or other changes that don't modify src/test files label Apr 16, 2024
@Belco90 Belco90 changed the title Support both CJS and ESM Bundle plugin in ESM format Apr 16, 2024
@Belco90 Belco90 added BREAKING CHANGE This change will require a major version bump and removed BREAKING CHANGE This change will require a major version bump labels Apr 16, 2024
@Belco90 Belco90 moved this from Todo to In Progress in eslint-plugin-testing-library v7 Oct 30, 2024
@Belco90 Belco90 mentioned this issue Oct 31, 2024
1 task
@Belco90 Belco90 added the enhancement New feature or request label Dec 16, 2024
@sdavids
Copy link

sdavids commented Jan 15, 2025

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
Copy link

sdavids commented Jan 15, 2025

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.

@G-Rath
Copy link
Contributor

G-Rath commented Jan 15, 2025

@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

@sdavids
Copy link

sdavids commented Jan 16, 2025

#900 (comment) is obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Changes that affect the build system, CI config or other changes that don't modify src/test files enhancement New feature or request
Projects
Status: In Progress
Development

No branches or pull requests

3 participants