Environment
ESLint version: HEAD
@eslint/json version: HEAD
Node version: 20.19.3
npm version: 10.9.2
Operating System: Windows 11
What problem do you want to solve?
Hi,
I'm raising this issue based on eslint/markdown#453, eslint/markdown#367 (comment), and eslint/markdown#367 (comment).
cc. @JoshuaKGoldberg
Currently, the JSON, CSS, and Markdown plugins export their types defined in types.ts from the /types entry point.
For example:
As mentioned in eslint/markdown#453, eslint/markdown#367 (comment), and also from my own experience, exporting types from a /types entry point is a fairly uncommon pattern in TypeScript.
With this proposal, I'd like to suggest exporting types from the main entry point instead (i.e., @eslint/json, @eslint/css, and @eslint/markdown), rather than from @eslint/json/types, @eslint/css/types, and @eslint/markdown/types.
What do you think is the correct solution?
There are two possible approaches, depending on whether the build script uses bundling:
-
If bundling is used:
Adding export * from "types.ts" to the banner section in rollup.config.js worked well and was the simplest way to achieve this proposal in my tests.
https://github.com/eslint/json/blob/bc2b31768b0e7dcde61d456ab34bafa3afce65a8/rollup.config.js#L14
-
If bundling is not used:
The following approach was the cleanest solution I found.
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:
- 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.


Participation
Additional comments
This proposal applies to all packages that export their types from types.ts using the @eslint/package-name/types entry point.
So far, I've only reviewed the JSON, CSS, and Markdown plugins, but I plan to look into the other packages as I continue.
Environment
ESLint version: HEAD
@eslint/json version: HEAD
Node version: 20.19.3
npm version: 10.9.2
Operating System: Windows 11
What problem do you want to solve?
Hi,
I'm raising this issue based on eslint/markdown#453, eslint/markdown#367 (comment), and eslint/markdown#367 (comment).
cc. @JoshuaKGoldberg
Currently, the JSON, CSS, and Markdown plugins export their types defined in
types.tsfrom the/typesentry point.For example:
JSON:
@eslint/json/typestypes.tsreferencehttps://github.com/eslint/json/blob/bc2b31768b0e7dcde61d456ab34bafa3afce65a8/package.json#L20-L27
CSS:
@eslint/css/typestypes.tsreferenceMarkdown:
@eslint/markdown/typestypes.tsreferenceAs mentioned in eslint/markdown#453, eslint/markdown#367 (comment), and also from my own experience, exporting types from a
/typesentry point is a fairly uncommon pattern in TypeScript.With this proposal, I'd like to suggest exporting types from the main entry point instead (i.e.,
@eslint/json,@eslint/css, and@eslint/markdown), rather than from@eslint/json/types,@eslint/css/types, and@eslint/markdown/types.What do you think is the correct solution?
There are two possible approaches, depending on whether the build script uses bundling:
If bundling is used:
Adding
export * from "types.ts"to thebannersection inrollup.config.jsworked well and was the simplest way to achieve this proposal in my tests.https://github.com/eslint/json/blob/bc2b31768b0e7dcde61d456ab34bafa3afce65a8/rollup.config.js#L14
If bundling is not used:
The following approach was the cleanest solution I found.
Participation
Additional comments
This proposal applies to all packages that export their types from
types.tsusing the@eslint/package-name/typesentry point.So far, I've only reviewed the JSON, CSS, and Markdown plugins, but I plan to look into the other packages as I continue.