eslint / rewrite

Monorepo for the new version of ESLint
Apache License 2.0
65 stars 4 forks source link

fix: npm and JSR package contents #16

Closed nzakas closed 1 month ago

nzakas commented 1 month ago

When I tried publishing to JSR, I got several errors. Specifically:

  1. JSR requires the types.ts file to be present because it is referenced from index.js. Because this is a TypeScript error, I also added types.ts to the npm package.
  2. JSR doesn't automatically look for .d.ts files and so couldn't find the type definitions for the packages, it needs a triple-slash directive. The triple-slash directive must be added after tsc is run, otherwise it looks for that file to verify the contents. So I had to add a new tool called prepend-type-ref.js that runs after tsc in each package.

I verified locally via npx jsr publish --dry-run that the JSR publish will succeed with these changes.

nzakas commented 1 month ago

Updated the package.json files per @fasttime's feedback.

nzakas commented 1 month ago

@kecrily I'm leaving types.ts where it is. It doesn't do any harm to leave it there, and given that it caused an error when it was removed from the JSR package, it likely would cause other issues. It's a small file that doesn't really affect the overall size of the package.

@fasttime @mdjermanovic ready for re-review.

kecrily commented 1 month ago

I'm not worried about its current state, just that it might balloon in the future and the core still needs to be rewritten. Not sure how big core's types.ts is but it must be a lot bigger than that.