Skip to content

Bundle plugin in ESM format #900

@Belco90

Description

@Belco90
Member

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:

Activity

converted this from a draft issue on Apr 16, 2024
self-assigned this
on Apr 16, 2024
added
choreChanges that affect the build system, CI config or other changes that don't modify src/test files
on Apr 16, 2024
changed the title [-]Support both CJS and ESM[/-] [+]Bundle plugin in ESM format[/+] on Apr 16, 2024
added
BREAKING CHANGEThis change will require a major version bump
and removed
BREAKING CHANGEThis change will require a major version bump
on Apr 16, 2024
moved this from Todo to In Progress in eslint-plugin-testing-library v7on Oct 30, 2024
sdavids

sdavids commented on Jan 15, 2025

@sdavids

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

sdavids commented on Jan 15, 2025

@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.
G-Rath

G-Rath commented on Jan 15, 2025

@G-Rath
Contributor

@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

sdavids commented on Jan 16, 2025

@sdavids

#900 (comment) is obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

choreChanges that affect the build system, CI config or other changes that don't modify src/test filesenhancementNew feature or request

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @sdavids@Belco90@G-Rath

      Issue actions

        Bundle plugin in ESM format · Issue #900 · testing-library/eslint-plugin-testing-library