Closed JoseLion closed 3 weeks ago
Hey, thank you for your feedback! Unfortunately, I think both solutions are not tree-shakable, and that is one of the main selling points of this library. Why not disable this rule?
@fabian-hiller, thanks for looking into it. If neither option is tree-shakable, I agree that adding them is not an option 🙂
The main reason for using the import/no-namespace rule is to enforce consistency across imports, so I'd prefer not to disable a rule that's making my code cleaner, easier to maintain, etc. However, we still have two options:
v.*
is better 😬)."import/no-namespace": ["error", { ignore: ["valibot"] }]
Both options are reasonably valid to me, but I thought this could be solved from Valibot's side instead. Thanks again for taking the time to look into this.
Cheers!
I did a first test and it broke tree shakability when the named v
export is imported and used to create a simple string
schema. So adding Valibot to the rule exceptions is probably the best solution.
Hi,
Would adding a default export on the package entry point be possible?
While I prefer using named exports, some modules can benefit from importing a single object, for example, to avoid name collisions. But on Valibot, this must be done with namespace (wildcard) imports, which can be problematic when enforcing a convention. Specifically, it collides with ESLint rules like import/no-namespace. So instead of importing like:
I'd prefer to import as:
Or even a named
v
export would be great, but I'm not sure what the impact on tree shaking could be 🤔I can help with a PR if any of those options make sense 🙂
Cheers!