Emit the ESLint plugin package as a CommonJS module

Description

We are currently in an uncomfortable situation where we can’t emit our ESLint plugin package as both a CommonJS module and an ESM one.

For NodeJS module resolution to recognize a package as an ESM module, at least one of these two conditions must be satisfied:

  • The entry point of the package is a file with the extension .mjs

  • The package manifest package.json declares the package as a module ("type": "module")

Our build toolchain is not ready for the first condition: it would require us to be able to output our artifacts as .mjs files, which we are not yet able to do.

Satisfying the second condition would render the CommonJS flavor exposed by our package unusable.

We need to emit our plugin as a CommonJS module to make it consumable by both CommonJS and ESM modules.

Luckily, we don’t depend on ESM-only packages yet. Would we depend on one in the future? It would prevent us from supporting CommonJS at all and require us to publish a new major version.

Activity

Show:
Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Priority

Sentry

Created October 14, 2024 at 10:24 AM
Updated October 18, 2024 at 12:07 PM
Resolved October 18, 2024 at 12:07 PM