-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify export =
vs export default
for CJS
#10
Comments
export =
vs export default =
for CJSexport =
vs export default
for CJS
Is there an example of this in a real package I can look at? |
https://arethetypeswrong.github.io/?p=postcss-image-set-function@5.0.2 |
Ah, I thought this would be an easy fix, but it looks like I should probably address this note:
before expanding the scope of this rule, which requires bringing the type checker into play, like #22 also requires. Turning the rule on for other resolution modes (I think it was an accident that I didn’t before) made postcss really blow up, because it can’t identify the pattern: module.exports = AtRule
AtRule.default = AtRule that they use throughout, which should not trigger the FalseDefaultExport problem. I started some work on type checking / whole program support a few days ago, but I’m still just working on this in my spare time. |
Another one is classnames@2.3.0. (It’s fixed in newer versions.) It’s reported as an issue for ESM, but really it’s an issue for CJS. When compiling a default import to CJS consuming that package, those types are fine. However, when manually writing CJS and using It’s different though, because unlike |
I think it would make sense to display a Or perhaps add a disclaimer that all ✅ are to be taken with a grain of salt since this tool doesn't yet support type checking. |
A common mistake people make is to write or emit
module.exports = thing
in the CJS output, butexport default thing
in the type definitions. It would be nice if this tool could handle that and provide suggestions how to fix it.This involves inspecting the actual source code instead of just file resolutions, so I understand if this is a big ask, or even out of scope of this project.
The text was updated successfully, but these errors were encountered: