Skip to content

Conversation

JoshuaKGoldberg
Copy link
Contributor

Throwing up as a reference for one strategy to solve the types re-export issue.

@lumirlumir
Copy link
Member

lumirlumir commented Jul 9, 2025

Hi @JoshuaKGoldberg 😄

I've taken another shot at this and wanted to share a different approach.

Here's what I did:

  • First, I created an empty types.js file at src/types.js:
export default {};
  • Then, I added export * from "./types.js"; to the end of index.js:
// ...

export default plugin;
export { MarkdownSourceCode };
+ export * from "./types.js";

This approach seems to work well, since it allows all types from src/types.ts to be imported directly from the @eslint/markdown package, rather than from @eslint/markdown/types.

image

image


What do you think of this approach? I'd love to hear your thoughts.

@JoshuaKGoldberg
Copy link
Contributor Author

Ha nice that's smart! I like it. I'd separately thought of proposing converting just index.js to index.ts so we can use the export syntax (not yet available in .js files: microsoft/TypeScript#60831).

@lumirlumir
Copy link
Member

That proposal looks good to me as well 👍 If the proposal is accepted, it might be cleaner to export the types.

Would now be a good time to ask TSC members about migrating type imports from @eslint/markdown/types to @eslint/markdown?

@JoshuaKGoldberg
Copy link
Contributor Author

That is a great question, and I don't know how or where to push it 😄. Mentioned in: eslint/eslint#19920

@lumirlumir
Copy link
Member

Ah, thank you! If it's alright, let's wait a bit for the team's decision. 😄

After that, I think we can open a separate issue for it.

Copy link
Contributor

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Aug 13, 2025
@lumirlumir
Copy link
Member

Hi, @JoshuaKGoldberg

I've created an issue in eslint/json#130, and it's been decided to postpone this change until ESLint v10. After v10, we can drop CJS module support, since Node.js will natively support require(ESM). This should make it much easier to adopt the change across all repositories. 👍

@lumirlumir
Copy link
Member

I think we can move this change forward now, since the Markdown plugin is ESM-only and I've confirmed it here: eslint/json#130 (comment).

If you're available, it would be great if you could take it forward. (If not, I am happy to take it on.)

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

Successfully merging this pull request may close these issues.

2 participants