Skip to content

feat(lint/html): port noExcessiveLinesPerFile to html#9967

Merged
dyc3 merged 1 commit intonextfrom
dyc3/noExcessiveLinesPerFile-html
Apr 14, 2026
Merged

feat(lint/html): port noExcessiveLinesPerFile to html#9967
dyc3 merged 1 commit intonextfrom
dyc3/noExcessiveLinesPerFile-html

Conversation

@dyc3
Copy link
Copy Markdown
Contributor

@dyc3 dyc3 commented Apr 13, 2026

Summary

This ports the noExcessiveLinesPerFile rule to HTML.

Also tried to reduce some string allocations in the other implementations.

Test Plan

snapshots

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: 8ce06e1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@biomejs/biome Minor
@biomejs/cli-win32-x64 Minor
@biomejs/cli-win32-arm64 Minor
@biomejs/cli-darwin-x64 Minor
@biomejs/cli-darwin-arm64 Minor
@biomejs/cli-linux-x64 Minor
@biomejs/cli-linux-arm64 Minor
@biomejs/cli-linux-x64-musl Minor
@biomejs/cli-linux-arm64-musl Minor
@biomejs/wasm-web Minor
@biomejs/wasm-bundler Minor
@biomejs/wasm-nodejs Minor
@biomejs/backend-jsonrpc Patch
@biomejs/js-api Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-CLI Area: CLI A-Linter Area: linter L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS and super languages L-HTML Language: HTML and super languages labels Apr 13, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b4c21d7f-7b19-42d1-978f-c2951a4e036a

📥 Commits

Reviewing files that changed from the base of the PR and between dda268e and 8ce06e1.

⛔ Files ignored due to path filters (3)
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalid.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalidSkipBlankLines.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/valid.html.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (13)
  • .changeset/gentle-stars-do.md
  • crates/biome_console/src/fmt.rs
  • crates/biome_css_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_graphql_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_html_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalid.html
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalid.options.json
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalidSkipBlankLines.html
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalidSkipBlankLines.options.json
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/valid.html
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/valid.options.json
  • crates/biome_js_analyze/src/lint/complexity/no_excessive_lines_per_function.rs
  • crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
✅ Files skipped from review due to trivial changes (8)
  • crates/biome_graphql_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_css_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_js_analyze/src/lint/complexity/no_excessive_lines_per_function.rs
  • .changeset/gentle-stars-do.md
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalidSkipBlankLines.options.json
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/valid.options.json
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalid.options.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/biome_console/src/fmt.rs
  • crates/biome_html_analyze/src/lint/nursery/no_excessive_lines_per_file.rs

Walkthrough

Adds an HTML nursery lint rule noExcessiveLinesPerFile that counts lines (optionally skipping blank lines) and emits diagnostics when a file exceeds the configured maxLines. Introduces rule registration, implementation, diagnostics, and multiple HTML test fixtures with accompanying options JSON files (valid/invalid/skip-blank-lines). Standardises diagnostic message interpolation by removing redundant .to_string() calls in several lint diagnostics across crates. Extends console formatting by adding Display implementations for all std::num::NonZero* integer types. Updates package changeset metadata to note the HTML application of the rule.

Suggested reviewers

  • ematipico
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: porting the noExcessiveLinesPerFile lint rule to HTML.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation to port the rule to HTML and mentioning related optimisations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dyc3/noExcessiveLinesPerFile-html

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/biome_console/src/fmt.rs`:
- Around line 222-233: The new impl_std_display! expansions for NonZeroI8,
NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize, NonZeroU8,
NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, and NonZeroUsize need unit
tests: add a compact test in the same crate (e.g., in
crates/biome_console/src/fmt.rs tests module or a new tests file) that
constructs representative NonZero signed and unsigned values (positive and
negative where applicable) and asserts their Display output matches the expected
string via format!("{}", value) or value.to_string(); include edge cases like
minimum non-zero (e.g., -1 for signed) and a large value for big types to ensure
all macro-generated impls behave correctly.

In `@crates/biome_html_analyze/src/lint/nursery/no_excessive_lines_per_file.rs`:
- Around line 43-54: Update the option docs for the no_excessive_lines_per_file
rule by adding a short example snippet under each option section: for the ###
`maxLines` section add an example showing a small file that exceeds the default
(e.g., default 300) and the configuration snippet demonstrating how to set
"maxLines" with the resulting diagnostic, and for the ### `skipBlankLines`
section add an example showing a file with many blank lines where setting
"skipBlankLines": true prevents a diagnostic (plus the config snippet). Ensure
each option section keeps its header, description, Default line, and now an
Examples subsection consistent with other rule-doc conventions and referencing
the `maxLines` and `skipBlankLines` option names.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c6f0dc9-f7cc-42e6-ac21-1f1477e9f8ff

📥 Commits

Reviewing files that changed from the base of the PR and between 322675e and 12ce978.

⛔ Files ignored due to path filters (3)
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalid.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalidSkipBlankLines.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/valid.html.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (13)
  • .changeset/gentle-stars-do.md
  • crates/biome_console/src/fmt.rs
  • crates/biome_css_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_graphql_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_html_analyze/src/lint/nursery/no_excessive_lines_per_file.rs
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalid.html
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalid.options.json
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalidSkipBlankLines.html
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/invalidSkipBlankLines.options.json
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/valid.html
  • crates/biome_html_analyze/tests/specs/nursery/noExcessiveLinesPerFile/valid.options.json
  • crates/biome_js_analyze/src/lint/complexity/no_excessive_lines_per_function.rs
  • crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs

Comment thread crates/biome_console/src/fmt.rs
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 13, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 168 skipped benchmarks1


Comparing dyc3/noExcessiveLinesPerFile-html (8ce06e1) with next (963a0c5)

Open in CodSpeed

Footnotes

  1. 168 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.

Copy link
Copy Markdown
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please accept the regression before merging (it's expected)

Copy link
Copy Markdown
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot. This is a minor, it must be merged into next

@dyc3 dyc3 force-pushed the dyc3/noExcessiveLinesPerFile-html branch from 12ce978 to 963a0c5 Compare April 13, 2026 19:42
@github-actions github-actions Bot added A-Core Area: core A-Project Area: project A-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools A-LSP Area: language server protocol L-JSON Language: JSON and super languages A-Diagnostic Area: diagnostocis L-Grit Language: GritQL A-Type-Inference Area: type inference A-Resolver Area: resolver L-Tailwind Language: Tailwind CSS L-Markdown Language: Markdown L-Yaml Language: Yaml labels Apr 13, 2026
@dyc3 dyc3 changed the base branch from main to next April 13, 2026 19:44
@github-actions github-actions Bot removed A-Core Area: core A-Project Area: project A-Parser Area: parser labels Apr 13, 2026
@github-actions github-actions Bot removed A-Formatter Area: formatter A-Tooling Area: internal tools A-LSP Area: language server protocol A-Diagnostic Area: diagnostocis L-Grit Language: GritQL A-Type-Inference Area: type inference A-Resolver Area: resolver L-Tailwind Language: Tailwind CSS L-Markdown Language: Markdown L-Yaml Language: Yaml labels Apr 13, 2026
@dyc3 dyc3 force-pushed the dyc3/noExcessiveLinesPerFile-html branch from 920d665 to dda268e Compare April 13, 2026 19:48
@dyc3 dyc3 force-pushed the dyc3/noExcessiveLinesPerFile-html branch from dda268e to 8ce06e1 Compare April 13, 2026 20:06
@dyc3 dyc3 requested a review from ematipico April 13, 2026 20:10
@dyc3 dyc3 merged commit e9b6c17 into next Apr 14, 2026
26 checks passed
@dyc3 dyc3 deleted the dyc3/noExcessiveLinesPerFile-html branch April 14, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Linter Area: linter L-CSS Language: CSS and super languages L-HTML Language: HTML and super languages L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants