Skip to content

Linter, Formatter: Sort globbed files and cap the default --jobs at 8 - #2856

Merged
marcoroth merged 2 commits into
marcoroth:mainfrom
excid3:linter-sorted-files-jobs-cap
Nov 2, 2026
Merged

marcoroth merged 2 commits into
marcoroth:mainfrom
excid3:linter-sorted-files-jobs-cap

Conversation

@excid3

@excid3 excid3 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Three small fixes that came up while building standalone executables for the linter and formatter (follow-up PR coming), but that stand on their own:

  • Sort globbed files. glob returns files in an order that depends on the filesystem and runtime, so the linter's and formatter's output could be ordered differently between machines. Files are now sorted in Config#findFilesForTool (which covers the linter without patterns, the formatter's directory path and the language server) and in the linter's and formatter's own glob paths.
  • Cap the default --jobs at 8. Each worker loads its own WASM parser and config, so with one worker per core the startup cost outweighs the extra parallelism on machines with many cores. With 28 cores, linting 600 files was slower with the default than with --jobs 8. --jobs auto and explicit values are unchanged, and the help text now says [default: auto, CPU cores up to 8].
  • Declare the linter's build dependency on @herb-tools/client. The linter imports @herb-tools/client/directives, so a targeted nx build of the linter failed with TS2307 when the client hadn't been built yet.

Testing

  • config: 191 tests pass
  • linter: 5520 tests pass; the test file count is the same as on main
  • formatter: 1541 tests pass
  • Linter typecheck passes

https://claude.ai/code/session_017jYmXZLoC2KgCkEWLEQqyy

Glob results come back in filesystem and runtime dependent order, so the
linter's and formatter's output order could differ between machines. Sort
them in `Config#findFilesForTool` and in the linter's and formatter's own
glob paths.

Cap the linter's default number of workers at 8. Each worker loads its own
WASM parser and config, so on machines with many cores the startup cost of
one worker per core outweighs the extra parallelism.

Also declare the linter's missing build dependency on @herb-tools/client,
which it imports from `@herb-tools/client/directives`.

Claude-Session: https://claude.ai/code/session_017jYmXZLoC2KgCkEWLEQqyy
@github-actions github-actions Bot added linter @herb-tools/linter for HTML+ERB templates formatter @herb-tools/formatter for HTML+ERB templates typescript TypeScript source across the javascript/ packages config Herb configuration file handling and config options labels Oct 28, 2026
Comment thread javascript/packages/linter/src/cli.ts Resolved
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
Signed-off-by: Marco Roth <marco.roth@intergga.ch>

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you @excid3! 🙏🏼

@marcoroth
marcoroth merged commit c72a6eb into marcoroth:main Nov 2, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Herb configuration file handling and config options formatter @herb-tools/formatter for HTML+ERB templates linter @herb-tools/linter for HTML+ERB templates typescript TypeScript source across the javascript/ packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants