bluwy / publint

Lint packaging errors
https://publint.dev
MIT License
932 stars 19 forks source link

File existence checks does not work on exports of non-js files #96

Closed freshgum-bubbles closed 2 months ago

freshgum-bubbles commented 2 months ago

As of current, publint doesn't seem to support Bun's export field entry.

For example, the following raises no error:

{
  "exports": {
    ".": {
      "bun": "./lufhwuh.js"
    }
  }
}

I'd be more than happy to send in a PR if you'd like.

(It's also worth noting that Bun supports TypeScript out-of-the-box, so "bun": "./src/index.ts" is possible.)

P.S. I'm loving publint so far. It's found two pretty painful issues from the start -- thank you so much!

bluwy commented 2 months ago

Thanks! I wonder what error do you expect from that currently? It seems the missing published files check, and the file extension check seems to be working fine.

About TypeScript support, publint doesn't have much checks for it right now, but it still does check if the file is missing for example.

freshgum-bubbles commented 2 months ago

It seems the missing published files check, and the file extension check seems to be working fine.

Hmm, they don't seem to work on my machine -- whatever I enter into the bun condition goes unnoticed.

About TypeScript support, publint doesn't have much checks for it right now, but it still does check if the file is missing for example.

Roger that :-)

bluwy commented 2 months ago

Would be great if you can share an example here, otherwise I'm not sure what to fix for this issue.

freshgum-bubbles commented 2 months ago

Sorry for the delay -- I haven't got as much time as I usually have this week, but I could get you a repro. next week. In my testing, publint wasn't checking what was in the bun condition, so "bun": "efuhefefouhefu.ts" would pass just fine.

If it helps, the repository in question is https://github.com/freshgum/typedi -- that's where I was able to reproduce the issue :)

bluwy commented 2 months ago

Ah ok I found the issue. On this line:

https://github.com/bluwy/publint/blob/7ba9aa3ebd664a75044125f0ff62a28292c63308/pkg/src/index.js#L622-L623

If the path is not lintable (which simply means if it's not .js, .cjs, .mjs), it should continue to check if the file exist like:

https://github.com/bluwy/publint/blob/7ba9aa3ebd664a75044125f0ff62a28292c63308/pkg/src/index.js#L580-L588

But it wasn't.