oxc-project
oxc
BlogDocsChangelog

fix(linter): prevent underflow in count_comment_lines for JSX files

#15026Merged
Comparing
ityuany:fix/count-comment-lines-underflow
(
27134a3
) with
main
(
47a616f
)
CodSpeed Performance Gauge
0%
Untouched
4
Skipped
33

Benchmarks

Skipped (33)

Passed

linter[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
730.8 µs729.9 µs
linter[binder.ts]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
49.2 ms49.2 ms
linter[react.development.js]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
19.2 ms19.2 ms
linter[cal.com.tsx]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
477.3 ms477.4 ms

Commits

Click on a commit to change the comparison range
Base
main
47a616f
+0.09%
fix(linter): prevent integer underflow in count_comment_lines for JSX comments When processing JSX inline comments like `{/* comment */}` with the eslint/max-lines rule using skipComments: true, the count_comment_lines function would calculate start_line > end_line, causing integer underflow. This resulted in: - Debug mode: panic with "attempt to subtract with overflow" - Release mode: wrapping to usize::MAX, incorrect line count Fix by using saturating_sub which: - Prevents panic in all build modes - Returns 0 for inline comments (logically correct) - Maintains correct behavior for multi-line comments Added test case to prevent regression.
cccadd9
15 days ago
by ityuany
-0.07%
clippy fix, improve test coverage
27134a3
13 days ago
by camc314
© 2025 CodSpeed Technology
Home Terms Privacy Docs