Skip to content

Replace ESLint with oxlint - #3249

Open
mgurgel wants to merge 6 commits into
mainfrom
mgurgel/oxlint
Open

mgurgel wants to merge 6 commits into
mainfrom
mgurgel/oxlint

Conversation

@mgurgel

@mgurgel mgurgel commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Asana Task/Github Issue:

Description

This PR replaces ESLint with oxlint. A plugin file migrates eslint rules not covered by oxlint. Remaining differences are listed below.

Differences from ESLint

Rule Difference
no-redeclare Does not report declarations that reuse the name of a built-in global, such as const Set.
prefer-await-to-then Also reports .then() and .catch() at the top level of a file, which is why the rule is off for the special page entry files and the messaging examples.
no-unused-private-class-members Does not count #field in object as a use.
no-unused-vars Does not count <> as a use of Fragment.
no-implicit-globals in lint-no-output-globals oxlint cannot ignore eslint-disable comments, so a comment in contentScope.js could hide a global. The file has no such comment.
Removed rules camelcase, spaced-comment, no-tabs, no-undef-init, n/no-callback-literal, n/no-deprecated-api and n/process-exit-as-throw have no oxlint equivalent.

Testing Steps

  • Run npm run lint. It passes.
  • Add one of these lines to a file in injected/src and run npx oxlint: a promise call without await, // @ts-ignore, const self = this or process.cwd(). oxlint reports each one.

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

oxlint's prefer-await-to-then also flags top-level calls and constructors, and its unused-member rules miss `#brand in value`.
The config keeps the ESLint rule set, scopes and globals. A local plugin replaces the no-restricted-syntax ban on private methods. Linting takes about 4 s instead of 35 s.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Build Branch

Branch pr-releases/mgurgel/oxlint
Commit 9dce590800
Updated November 25, 2026 at 5:59:50 PM UTC

Static preview entry points

QR codes (mobile preview)
Entry point QR code
Docs QR for docs preview
Static pages QR for static pages preview
Integration pages QR for integration pages preview

Integration commands

npm (Android / Extension):

npm i github:duckduckgo/content-scope-scripts#pr-releases/mgurgel/oxlint

Swift Package Manager (Apple):

.package(url: "https://github.com/duckduckgo/content-scope-scripts.git", branch: "pr-releases/mgurgel/oxlint")

git submodule (Windows):

git -C submodules/content-scope-scripts fetch origin pr-releases/mgurgel/oxlint
git -C submodules/content-scope-scripts checkout origin/pr-releases/mgurgel/oxlint
Pin to exact commit

npm (Android / Extension):

npm i github:duckduckgo/content-scope-scripts#9dce590800555ff59e9e5456971f7a209f96b791

Swift Package Manager (Apple):

.package(url: "https://github.com/duckduckgo/content-scope-scripts.git", revision: "9dce590800555ff59e9e5456971f7a209f96b791")

git submodule (Windows):

git -C submodules/content-scope-scripts fetch origin pr-releases/mgurgel/oxlint
git -C submodules/content-scope-scripts checkout 9dce590800555ff59e9e5456971f7a209f96b791

# Conflicts:
#	package-lock.json
#	package.json
@github-actions github-actions Bot added the semver-patch Bug fix / internal — no release needed label Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

[Beta] Generated file diff

Time updated: Wed, 25 Nov 2026 18:01:10 GMT

Android
    - android/adsjsContentScope.js
  • android/contentScope.js

File has changed

Apple
    - apple/contentScopeIsolated.js
  • apple/pages/history/dist/index.js
  • apple/pages/new-tab/dist/index.js

File has changed

Chrome-mv3
    - chrome-mv3/inject.js

File has changed

Firefox
    - firefox/inject.js

File has changed

Integration
    - integration/contentScope.js
  • integration/pages/history/dist/index.js
  • integration/pages/new-tab/dist/index.js

File has changed

Windows
    - windows/contentScope.js
  • windows/pages/history/dist/index.js
  • windows/pages/new-tab/dist/index.js

File has changed

Scripts, examples and history listeners now await instead of chaining. Special-page entry files are IIFE bundles without top-level await, so the rule is off for them in config.
oxlint only runs ban-ts-comment on TypeScript files, so the local plugin now checks all files. Re-enables no-unreachable-loop, returns the messaging examples to .then, and removes disable comments that no longer suppress anything.
@mgurgel
mgurgel requested review from a team and noisysocks as code owners November 25, 2026 17:21
no-undef runs on all JS files again, with Node globals set in config because oxlint ignores /* global */ comments. The local plugin adds no-this-alias for JS and catches return promise.then(), which oxlint's rule skips.
@mgurgel mgurgel self-assigned this Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-patch Bug fix / internal — no release needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant