feat(linter/unicorn): implement prefer-export-from rule#22686
feat(linter/unicorn): implement prefer-export-from rule#22686AliceLanniste wants to merge 11 commits into
prefer-export-from rule#22686Conversation
Merging this PR will degrade performance by 81.09%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | linter[cal.com.tsx] |
580.2 ms | 3,068.7 ms | -81.09% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing AliceLanniste:prefer_export_from (ec7bdf7) with main (27268a0)
Footnotes
-
52 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
a5b9bb5 to
42d9d17
Compare
b152f2c to
924e9d0
Compare
prefer-export-from rule
d538ce5 to
6ce7970
Compare
camc314
left a comment
There was a problem hiding this comment.
Hi! Thanks for working on this and putting up this PR.
I've pushed some changes refactoring to get the code a little more idomatic.
But there is a large performance regression. This is likely due to looping over all nodes.
Please take a look.
Thanks!
| ctx.semantic() | ||
| .nodes() |
There was a problem hiding this comment.
looping over all nodes is slow, as there are thousands per ast.
| ctx: &LintContext<'a>, | ||
| import_decl: &'a ImportDeclaration<'a>, | ||
| ) -> Option<&'a ExportNamedDeclaration<'a>> { | ||
| ctx.semantic().nodes().iter().find_map(|n| { |
There was a problem hiding this comment.
looping over all nodes is slow as there are thousands in a single AST
48cf2bd to
ec7bdf7
Compare
|
Closing for now - please feel free to open once CI is passing, and the performance concerns have been fixed. Thanks! |
## Summary - Adds Unicorn `prefer-export-from` to report import-then-re-export patterns and suggest direct `export ... from` declarations. - Ports upstream coverage for default, named, namespace, TypeScript, import-attributes, and `checkUsedVariables` cases. - Exposes the rule option in the oxlint JSON schema and generated TypeScript config types. Related #22686 AI-assisted: this PR was prepared with AI assistance; the contributor remains responsible for reviewing and validating the changes. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Cameron Clark <cameron.clark@hey.com>
## Summary - Adds Unicorn `prefer-export-from` to report import-then-re-export patterns and suggest direct `export ... from` declarations. - Ports upstream coverage for default, named, namespace, TypeScript, import-attributes, and `checkUsedVariables` cases. - Exposes the rule option in the oxlint JSON schema and generated TypeScript config types. Related #22686 AI-assisted: this PR was prepared with AI assistance; the contributor remains responsible for reviewing and validating the changes. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Cameron Clark <cameron.clark@hey.com>
prefer_export_frompart of #684