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
feat(linter): stabilize no-barrel-file #3069
Comments
I've tested it a few times and it is stable, The issue was with the |
Ok, I'll test again once I get the time. |
Reporting 0 modules in https://github.com/mermaid-js/mermaid |
Have you looked at the source code for this? I think it is a problem with Resolver, This package has a lot of funky stuff, both generated codes and js extensions for ts files[when importing them]. ####Edit: for example all of these js includes are actually ts files. |
I believe this one would also be positive with this eslint plugin - which I've based this rule on - It doesn't exclusively look at star exports it counts the number of exports and declarations if exports are higher than declarations and also greater equal a certain threshold then it would be marked as a barrel file. |
Oh this is counter intuitive, let me take a deeper look. |
Maybe we shouldn't report a number when we can't resolve all import/exports, Is there anything in the Resolver that can check if we have unresolved import/exports? |
Ohh ... so there's no formal definition for what a "barrel file" is ... Definition 1: https://gist.github.com/developit/a306951af9c0cfdf5925f126428887eb#file-no-barrel-js-L126 Using the facade value from es-module-lexer. https://www.npmjs.com/package/es-module-lexer#facade-detection
Definition 2: https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/lib/rules/avoid-barrel-files.js Number of exports is greater than number of definitions. Biome just ported the 3 rules from eslint-plugin-barrel-files I think for oxlint, Definition 1 is definitely better than needing to understand and apply the 3 different rules from eslint-plugin-barrel-files. And I've already done all of the work for esmodule lexer 😁 https://github.com/oxc-project/oxc/tree/main/crates/oxc_module_lexer, I would just use it 🤣 |
Cool, found the source: import-js/eslint-plugin-import#2922 (comment) |
Well feel free to discard it in favor of detecting facades, Right now I've mostly invested my time in the transformers and traversable AST otherwise I would've offered refactoring it myself. If it isn't too urgent I can do it when I find some free time(I should probably get done with it before #3071). |
There is no rush! Sorry I didn't invest enough time to understand the full context, twitter sometimes gets into me and I just rushed things :-( |
@Boshen The number of modules reported in the mermaid has nothing to do with this rule. So even if we go for the use of |
I think so, I want to have Shopify use more oxlint rules so it can eventually drop eslint for all custom rules ;-) After reading relevant issues in the eslint-import-plugin repo, I think facade should be the more appropriate method to use.
understood 😁 |
Found a better representation https://twitter.com/boshen_c/status/1790353605234655637 |
I saw it in Discord, It is so nice😍 |
Follow up on #3030
Need to test in real projects.
Currently seeing false positives, and also panics.
The text was updated successfully, but these errors were encountered: