Skip to content

feat!: export types from main entry and remove /types export#198

Merged
nzakas merged 4 commits intomainfrom
feat/export-types-from-main-entry-and-remove-types-export
Jan 16, 2026
Merged

feat!: export types from main entry and remove /types export#198
nzakas merged 4 commits intomainfrom
feat/export-types-from-main-entry-and-remove-types-export

Conversation

@lumirlumir
Copy link
Member

@lumirlumir lumirlumir commented Jan 1, 2026

Prerequisites checklist

What is the purpose of this pull request?

In this PR, I've exported all types from src/types.ts through the main entry point and removed /types export.

This PR aligns with the approach used in the Markdown repository in eslint/markdown#520 and eslint/markdown#564.

Previously, to access the global types defined in src/types.ts, they had to be imported from @eslint/json/types. After this change, they can be imported directly from @eslint/json.

Also, I've removed the /types export, since the types are now re-exported by the main entry point.

What changes did you make? (Give an overview)

To enable importing types from the main entry point, I used a small trick.

The types.ts file is built into types.js and types.d.ts.

In the built types.js, it's possible to re-export the type declarations from the main entry point using export * from "types.js".

However, that wasn't possible in the source. To bridge the gap, I added a dummy src/types.js file so types can be imported from src/types.ts.

Related Issues

Is there anything you'd like reviewers to focus on?

N/A

@lumirlumir lumirlumir marked this pull request as ready for review January 16, 2026 14:32
Copilot AI review requested due to automatic review settings January 16, 2026 14:32
@lumirlumir lumirlumir moved this from Implementing to Needs Triage in Triage Jan 16, 2026
@lumirlumir lumirlumir requested a review from a team January 16, 2026 14:34
Copy link

Copilot AI left a 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 exports all types from src/types.ts through the main entry point @eslint/json and removes the /types export path, simplifying the module structure. This change aligns with patterns used in the markdown repository and allows users to import all types from a single location.

Changes:

  • Exported types from the main entry point by adding export * from "./types.js" in src/index.js
  • Removed the /types export path from package.json
  • Created a dummy src/types.js file to enable TypeScript to compile the type exports
  • Updated test imports to import types from @eslint/json instead of @eslint/json/types

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/index.js Added re-export of types from types.js to make them available from the main entry point
src/types.js New dummy file that exports an empty object to bridge the gap between TypeScript source and compiled output
package.json Removed the /types export entry since types are now available from the main entry point
tests/types/types.test.ts Updated imports to use @eslint/json instead of @eslint/json/types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@nzakas nzakas merged commit 368c47b into main Jan 16, 2026
29 checks passed
@nzakas nzakas deleted the feat/export-types-from-main-entry-and-remove-types-export branch January 16, 2026 23:02
@github-project-automation github-project-automation bot moved this from Needs Triage to Complete in Triage Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants