Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe Changesmax-statements-per-line autofix
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The guarded whitespace fixer preserves the tested statement and comment layout behavior; no actionable merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
Bundle ReportChanges will increase total bundle size by 643 bytes (0.11%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: @stylistic/eslint-plugin-esmAssets Changed:
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1281 +/- ##
=======================================
Coverage 98.80% 98.80%
=======================================
Files 102 102
Lines 8300 8310 +10
Branches 3075 3076 +1
=======================================
+ Hits 8201 8211 +10
Misses 95 95
Partials 4 4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the review, @antfu. One thing left over: In run 34819716264 the job printed the vitest banner and then nothing at all for 12 minutes: No test output, no failure — it just never got going. The three sibling Could someone re-run that job? I'd rather not push a no-op commit and dismiss your approval to retrigger it. |
|
Follow-up on the
Could someone with access re-run the job once more? If a re-trigger via push is preferred instead, I'm happy to rebase — just say the word and I won't worry about the approval. |
4f61285
Description
Adds
fixable: 'whitespace'tomax-statements-per-line. The fix puts a line break before the reported statement (the first one overmaxon the line). The new line gets the same leading whitespace as the line being split. ESLint's fix passes then take care of any further statements on that line.It's deliberately conservative. It only fixes when:
;or}, so the break always falls between two sibling statements. That leaves outelse foo();,case x: foo();and the first statement after{.if (a) { b(); c(); },() => { a(); b(); }orcase 1: foo(); break;are still reported but not fixed, so we don't end up with half-split braces (that's reallybrace-style's territory).In all other cases the rule reports the same way it does today. The fixer works from the statement the rule already reports, so
ignoredNodescounts the same way for both.Since
;or}already separates the two statements, adding a newline before the second one can't change how the code parses. That holds for semicolon-less code too.Tests: I added
outputto the existing invalid cases that now get fixed, plusoutput: nullon a few that must stay unfixed. I also added new cases for comments, semicolon-less code,do…while,export, labelled statements, multi-line vs single-linecase, arrow bodies andignoredNodes.rules.mdandmetadata.tsare regenerated withpnpm run update.Verified locally:
pnpm test(133 files / 18454 tests pass),pnpm run test:fixtures,pnpm run lintandpnpm run typecheckall pass. 16 of the rule's tests fail with the rule change reverted.Linked Issues
resolves #1250
Additional context
Because
allonly includes fixable rules, this also addsmax-statements-per-line(defaultmax: 1) to that config.Summary by CodeRabbit
New Features
max-statements-per-linelint rule can now automatically fix supported formatting violations by moving statements onto separate lines.Bug Fixes