Migrate to oxlint and oxfmt v2#2130
Migrate to oxlint and oxfmt v2#2130kibertoad wants to merge 2 commits intohandlebars-lang:masterfrom
Conversation
|
@jaylinski I think I messed up my branch in the previous attempt a little bit, this should be the good clean one |
There was a problem hiding this comment.
Pull request overview
This PR migrates the repository’s linting/formatting workflow from ESLint + Prettier to oxlint + oxfmt, updating configuration and reformatting affected code/docs to match the new tooling while aiming to preserve existing style rules.
Changes:
- Replace ESLint/Prettier tooling with oxlint/oxfmt (new configs, updated scripts, updated lint-staged).
- Remove per-directory ESLint config files and consolidate behavior via
.oxlintrc.jsonoverrides. - Apply repo-wide formatting updates across TS typings, docs/markdown, HTML fixtures, and small JS modernizations.
Reviewed changes
Copilot reviewed 38 out of 41 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
types/test.ts |
Formatting-only updates to TS type tests/examples. |
types/index.d.ts |
Formatting-only updates to published typings. |
tests/integration/webpack-test/src/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
tests/integration/webpack-test/package.json |
JSON reordering to match formatter output. |
tests/integration/webpack-babel-test/src/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
tests/integration/webpack-babel-test/package.json |
JSON reordering to match formatter output. |
tests/integration/webpack-babel-test/.babelrc |
Formatting normalization. |
tests/integration/rollup-test/package.json |
JSON reordering to match formatter output. |
tests/integration/multi-nodejs-test/package.json |
JSON reordering to match formatter output. |
tests/integration/multi-nodejs-test/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
tests/browser/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
tests/bench/util/benchwarmer.js |
Replace new Array().join() with String#repeat() equivalents. |
tests/bench/throughput.js |
Minor modern syntax (catch {}) / formatting changes. |
tests/bench/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
tasks/util/git.js |
Minor modernization (startsWith) / formatting. |
tasks/tests/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
tasks/metrics.js |
Minor modernization (startsWith) / formatting. |
tasks/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
spec/umd.html |
HTML formatting updates (self-closing meta tags, indentation). |
spec/umd-runtime.html |
HTML formatting updates (self-closing meta tags, indentation). |
spec/source-map.js |
Minor modern syntax (catch {}) / formatting changes. |
spec/partials.js |
Small test simplification (undefined literal) / formatting. |
spec/index.html |
HTML formatting updates / line wrapping. |
spec/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
runtime.d.ts |
Formatting normalization. |
release-notes.md |
Markdown formatting cleanup (blank line removal). |
prettier.config.js |
Remove Prettier config (replaced by .oxfmtrc.json). |
package.json |
Switch scripts/devDependencies from ESLint+Prettier to oxlint+oxfmt; update lint-staged. |
lib/handlebars/compiler/code-gen.js |
Add oxlint suppression for unused catch binding; keep existing logic. |
lib/.eslintrc.js |
Remove legacy ESLint config (now handled via oxlint). |
docs/compiler-api.md |
Markdown formatting cleanup (blank line removal). |
README.md |
Markdown formatting normalization (headings, lists, wrapping). |
.prettierignore |
Update ignore patterns (and document that oxfmt reads it). |
.oxlintrc.json |
New consolidated oxlint configuration with overrides and ignores. |
.oxfmtrc.json |
New oxfmt configuration matching prior formatting preferences. |
.github/workflows/release.yml |
YAML formatting normalization (quoting). |
.github/dependabot.yml |
YAML formatting normalization (quoting). |
.git-blame-ignore-revs |
Add revision to ignore blame for the formatting migration. |
.eslintrc.js |
Remove root ESLint config (replaced by .oxlintrc.json). |
.eslintignore |
Remove ESLint ignore file (replaced by .oxlintrc.json ignores). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "ignorePatterns": [ | ||
| "tmp/", | ||
| "dist/", | ||
| "coverage/", | ||
| "tests/integration/*/dist/", |
There was a problem hiding this comment.
.prettierignore still lists local/generated artifacts like .nyc_output and /handlebars-release.tgz, but .oxlintrc.json's ignorePatterns doesn't. If those artifacts exist locally (e.g., after running tests/packaging), oxlint may start linting them and produce unexpected failures/noise. Consider adding .nyc_output/ and handlebars-release.tgz (and any other generated artifacts you intend to ignore) to ignorePatterns to match the formatter ignore list and the previous .eslintignore behavior.
jaylinski
left a comment
There was a problem hiding this comment.
Nice PR! Makes linting/formatting faster and reduces dev-dependencies.
| "spec/mustache", | ||
| "spec/vendor", | ||
| "node_modules", | ||
| "src/*.js", |
There was a problem hiding this comment.
There is no more src-folder in the master-branch, please remove.
| @@ -1,3 +1,4 @@ | |||
| # Ignore patterns for oxfmt (reads .prettierignore by default) | |||
There was a problem hiding this comment.
Why didn't you add this config to .oxfmtrc.json?
| "dustjs-linkedin": "^2.0.2", | ||
| "eslint": "^8.25.0", | ||
| "eslint-config-prettier": "^8.9.0", | ||
| "eslint-plugin-compat": "4.0", |
There was a problem hiding this comment.
Thinking if we still need this plugin. We originally added it to avoid using new browser APIs that were not supported widely yet. I think it reads the browserslist-config below.
Maybe we can also check compatibility via a new build-tool?
This preserves original formatting and style rules to a maximum extent possible, while introducing new ones and speeding up the check process dramatically.