-
-
Notifications
You must be signed in to change notification settings - Fork 18
fix!: remove rollup, extraneous types and migrate to ESM-only
#197
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
base: main
Are you sure you want to change the base?
fix!: remove rollup, extraneous types and migrate to ESM-only
#197
Conversation
| "npm run build:update-rules-docs" | ||
| ], | ||
| "{src/rules/*.js,tools/update-rules-docs.js}": [ | ||
| "{src/rules/*.js,tools/update-rules-docs.js,README.md}": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md pre-commit hook update can be consolidated into a single line, I went ahead. Just for a reference, the Markdown plugin also uses this approach:
Ref: https://github.com/eslint/markdown/blob/main/package.json#L56-L59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the @eslint/json package from a dual CommonJS/ESM format to ESM-only, removing the Rollup bundler and associated build complexity. The migration simplifies the build process by eliminating workarounds previously needed to support both module formats.
Key changes:
- Replaced Rollup-based bundling with TypeScript compilation that emits both JavaScript and declaration files
- Simplified package.json exports to use a single ESM entry point instead of dual CJS/ESM conditional exports
- Updated all internal type imports from
.tsto.jsextensions to comply with ESM module resolution
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Simplified TypeScript configuration for ESM-only output, removing dual-format compilation settings and consolidating output to single dist/ directory |
| tsconfig.esm.json | Removed secondary TypeScript configuration file that was used for ESM-specific type generation |
| tools/dedupe-types.js | Removed script that deduped type imports after rollup bundling, no longer needed without rollup |
| tools/build-cts.js | Removed script that generated CommonJS type definitions (.cts files), no longer needed for ESM-only package |
| rollup.config.js | Removed Rollup configuration and bundler from build process |
| package.json | Updated exports to ESM-only format, simplified build scripts, added @arethetypeswrong/cli for type validation, removed rollup dependencies, consolidated lint-staged configuration |
| src/rules/*.js | Updated type imports from ../types.ts to ../types.js to follow ESM conventions |
| src/languages/json-source-code.js | Updated type import from ../types.ts to ../types.js |
| jsr.json | Updated export paths and simplified publish configuration to reference consolidated dist/ directory |
| .github/workflows/ci.yml | Added new CI job to validate type definitions using @arethetypeswrong/cli |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Prerequisites checklist
What is the purpose of this pull request?
In this PR, I've resolved the issue mentioned in #196, removing
rollupand extraneous types and migrating the package to ESM-only.The main focus of this PR is removing much of the logic and the workarounds we previously used to support a dual CommonJS/ESM package.
Some notable parts are as follows:
tsconfig.json: I mostly followed the convention used in the Markdown plugin, which is now an ESM-only package. (Ref: https://github.com/eslint/markdown/blob/main/tsconfig.json)package.json: Likewise, I mostly followed the convention used in the Markdown plugin. (Ref: https://github.com/eslint/markdown/blob/main/package.json).github/workflows/ci.yml: Added@arethetypeswrong/clito verify that type exports work correctly.What changes did you make? (Give an overview)
In this PR, I've resolved the issue mentioned in #196, removing
rollupand extraneous types and migrating the package to ESM-only.Related Issues
rollup, extraneous types and migrate to ESM-only css#352arethetypeswrongin CI markdown#598rollupand migrate to ESM-only as part of the upcoming v1.0.0 (JSON/CSS) #196Is there anything you'd like reviewers to focus on?
I didn't intentionally remove
tests/types/cjs-import.test.ctssincerequire(ESM)is now enabled. However, if removing it is the right course of action, I'm happy to do so.