Repository navigation
build: add oxfmt for JS/TS formatting and import sorting - #50692
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
4d1f171 to
b84ffdd
Compare
clavin
left a comment
There was a problem hiding this comment.
Clean 👍
Checked the setup commit & skimmed through the reformat commit. Overall looks good and happy merging as-is. Left some ideas for polish.
P.S. this is a good candidate for .git-blame-ignore-revs
Adds oxfmt as a devDependency alongside oxlint and wires it into the
lint pipeline. The .oxfmtrc.json config matches Electron's current JS
style (single quotes, semicolons, 2-space indent, trailing commas off,
printWidth 100) and configures sortImports with custom groups that
mirror the import/order pathGroups previously enforced by ESLint:
@electron/internal, @electron/*, and {electron,electron/**} each get
their own ordered group ahead of external modules.
- `yarn lint:fmt` runs `oxfmt --check` over JS/TS sources and is
chained into `yarn lint` so CI enforces it automatically.
- `yarn format` runs `oxfmt --write` for local fix-up.
- lint-staged invokes `oxfmt --write` on staged .js/.ts/.mjs/.cjs
files before oxlint, so formatting is applied at commit time.
The next commit applies the formatter to the existing codebase so the
check actually passes.
|
Good call on |
Runs `yarn format` across lib/, spec/, script/, build/, default_app/, and npm/ to bring the codebase in line with the .oxfmtrc.json settings added in the previous commit. This is a pure formatting pass: import statements are sorted into the groups defined by the config, method chains longer than printWidth are broken, single-quoted strings containing apostrophes are switched to double quotes, and a handful of single-statement `if` bodies are re-wrapped and get braces added by `oxlint --fix` to satisfy the `curly: multi-line` rule. No behavior changes.
b84ffdd to
81de810
Compare
|
No Release Notes |
|
I was unable to backport this PR to "42-x-y" cleanly; |
|
I was unable to backport this PR to "40-x-y" cleanly; |
|
I was unable to backport this PR to "39-x-y" cleanly; |
|
I was unable to backport this PR to "41-x-y" cleanly; |
* build: replace eslint with oxlint and add oxfmt Replace ESLint and its plugin ecosystem with oxlint (oxc.rs). Add oxfmt alongside oxlint for JS/TS formatting and import sorting. - Consolidate root .eslintrc.json plus 13 nested configs into .oxlintrc.json - script/lint.js spawns oxlint binary directly instead of ESLint Node API - Per-process no-restricted-imports rules preserved as oxlintrc overrides - mocha/no-exclusive-tests replaced by in-repo plugin (no-only-tests.mjs) - docs ESLint pass replaced by inline node: protocol check in lint.js - .oxfmtrc.json matching repo style (single quotes, semicolons, 2-space) - yarn lint:fmt (oxfmt --check) chained into yarn lint - yarn format (oxfmt --write) for local fixup - lint-staged runs oxfmt --write on staged JS/TS files This commit contains only rule/tooling infrastructure changes and is intended to be cherry-picked to other maintenance branches, where formatting and lint fixes can be applied separately. Manual backport of e1af67c698 (#50691) and 3c7fd34f47 (#50692). * chore: apply oxfmt formatting and oxlint fixes One-time application of the new linting and formatting rules to the 41-x-y codebase: - yarn format (oxfmt --write) over all JS/TS sources - oxlint --fix to restore curly braces where oxfmt removed them - Prefix unused parameters with _ (no-unused-vars) - Add eslint-disable-next-line comments for intentional patterns: - prefer-promise-reject-errors in desktop-capturer.ts - no-throw-literal in preload.ts - no-only-tests/no-only-tests in spec-helpers.ts - Restore bare require() in preload-sandbox.js test assertions (oxfmt incorrectly converted bare specifiers to node: protocol, defeating the equivalence test) Pure formatting and lint suppression; no behavioral changes.
* build: replace eslint with oxlint and add oxfmt Replace ESLint and its plugin ecosystem with oxlint (oxc.rs). Add oxfmt alongside oxlint for JS/TS formatting and import sorting. - Consolidate root .eslintrc.json plus 13 nested configs into .oxlintrc.json - script/lint.js spawns oxlint binary directly instead of ESLint Node API - Per-process no-restricted-imports rules preserved as oxlintrc overrides - mocha/no-exclusive-tests replaced by in-repo plugin (no-only-tests.mjs) - docs ESLint pass replaced by inline node: protocol check in lint.js - .oxfmtrc.json matching repo style (single quotes, semicolons, 2-space) - yarn lint:fmt (oxfmt --check) chained into yarn lint - yarn format (oxfmt --write) for local fixup - lint-staged runs oxfmt --write on staged JS/TS files This commit contains only rule/tooling infrastructure changes and is intended to be cherry-picked to other maintenance branches, where formatting and lint fixes can be applied separately. Manual backport of e1af67c698 (#50691) and 3c7fd34f47 (#50692). * chore: apply oxfmt formatting and oxlint fixes One-time application of the new linting and formatting rules to the 42-x-y codebase: - yarn format (oxfmt --write) over all JS/TS sources - oxlint --fix to restore curly braces where oxfmt removed them - Prefix unused parameters with _ (no-unused-vars) - Add eslint-disable-next-line comments for intentional patterns: - prefer-promise-reject-errors in desktop-capturer.ts - no-throw-literal in preload.ts Pure formatting and lint suppression; no behavioral changes.
* build: replace eslint with oxlint and add oxfmt Replace ESLint and its plugin ecosystem with oxlint (oxc.rs). Add oxfmt alongside oxlint for JS/TS formatting and import sorting. - Consolidate root .eslintrc.json plus 13 nested configs into .oxlintrc.json - script/lint.js spawns oxlint binary directly instead of ESLint Node API - Per-process no-restricted-imports rules preserved as oxlintrc overrides - mocha/no-exclusive-tests replaced by in-repo plugin (no-only-tests.mjs) - docs ESLint pass replaced by inline node: protocol check in lint.js - .oxfmtrc.json matching repo style (single quotes, semicolons, 2-space) - yarn lint:fmt (oxfmt --check) chained into yarn lint - yarn format (oxfmt --write) for local fixup - lint-staged runs oxfmt --write on staged JS/TS files This commit contains only rule/tooling infrastructure changes and is intended to be cherry-picked to other maintenance branches, where formatting and lint fixes can be applied separately. Manual backport of e1af67c698 (#50691) and 3c7fd34f47 (#50692). * chore: apply oxfmt and oxlint formatting changes Run oxfmt --write and oxlint --fix across all JS/TS sources to apply the new formatting and lint rules from the previous commit. * chore: remove accidentally-included CLAUDE.md
Adds oxfmt alongside oxlint and applies it to the JS/TS sources. Follows #50691.
Commit 1 wires it in:
.oxfmtrc.jsonmatching existing repo style (single quotes, semicolons, 2-space) withsortImports.customGroupsmirroring the oldimport/orderpathGroups for@electron/internal,@electron/*, andelectronyarn lint:fmt(oxfmt --check) chained intoyarn lintso CI enforces ityarn format(oxfmt --write) for local fixupoxfmt --writeon staged.{js,ts,mjs,cjs}ahead of oxlintCommit 2 is the one-time
yarn formatover 297 files. Pure formatting; review with whitespace hidden.yarn lint:fmtover 571 files: ~555ms.Notes: none