Skip to content

Create shared oxlint config #106151

Open
Open

Description

@roryabraham

Background

In eslint-config-expensify v4, I put a lot of work into cleaning up our lint rules and consolidating them into a single shared config. We recently switched to Oxlint in App in k2, and soon will do the same in react-native-onyx as well.

Each of these has huge configs that are separately defined and could easily drift, leading to disparate lint configs.

Problem

When multiple repos use Oxlint, if they each define their own (massive) config files, those configs can easily fall out of sync, which prevents us from having a consistent code style across the stack.

Solution

Create a shared Oxlint config in eslint-config-expensify, extending the same modular design introduced in eslint-config-expensify v4. Adopt it first in App, leaving us with a much smaller "custom" config surface visible in App.

Then adopt it in K2.

Lastly, work to adopt it in react-native-onyx (which is not yet on Oxlint).

Issue OwnerCurrent Issue Owner: @LukasMod

Activity

  1. LukasMod commented on Nov 6, 2026

    @LukasMod
    Contributor

    The idea: Ship a ready-made oxlint config from eslint-config-expensify

    In the current proposal, App (Expensify/App#106218) and Onyx (react-native-onyx#889) each turn the eslint-config-expensify rules into oxlint config themselves, every time lint runs, with their own copy of the same code (config/oxlint/derive.mjs).

    Instead, eslint-config-expensify would do that conversion once, when a new version is published:

    1. Rules are still written in eslint-config-expensify, in ESLint format, as they are now.

    2. On release, a build step converts them into a ready-made oxlint config (a JSON file) and ships it with the plugins needed to run it.

    3. App and Onyx install the new version and point their oxlint.config.mts at that config with extends, then add only their own rules on top:

      import expensifyOxlint from 'eslint-config-expensify/oxlint';
      
      export default defineConfig({
          extends: [expensifyOxlint],
          plugins: [],
          overrides: [
              // the repo's own rules and changes to the presets
          ],
      });
      
    4. To pick up rule changes, a repo bumps the package version. Nobody copies rules, and nothing is converted at lint time.

    Nobody edits the generated JSON by hand. The ESLint presets stay the source of truth, and the JSON is a build output, like a dist/ folder. To see what an upgrade changes, diff the JSON between two versions.

    What moves where

    eslint-config-expensify (shared by App and Onyx):

    • the conversion (@oxlint/migrate, mapping rules oxlint lacks to core/ and hosted/, dropped rules, stand-ins, load-time errors)
    • the generated config, one per preset so each repo picks the presets it uses
    • the core, hosted and rulesdir plugins for preset rules, a hostRule() helper, the eslint-disable helper and the rule-name map

    Each repo:

    • its own rules and changes to the presets
    • its seatbelt baseline and lint pipeline
    • App only: the React Compiler pieces (rc/ rules and the gate on two hosted rules), local rules and App-only hosted rules, added by swapping in its own plugins
    • Onyx only: its jest file scope, lint debt downgrades and option tweaks

    Proof of concept

    POC callstack-internal@e5e0fd4. A local folder stood in for the published package: a build script generated oxlint.json and the rule lists, and App's config used extends.

    Check Result
    Full SEATBELT_FROZEN=1 npm run lint (fails on any per-file, per-rule error count change) Passed, no errors
    Resolved rules for all 11,274 tracked files vs the current config 0 differences; env, globals, settings, plugins and ignores identical
    Raw oxlint on 260 files (editor and npx oxlint path) Identical findings, 75 = 75
    Config load time About 30 ms instead of 0.7 s
    hosted plugin load per shard About 490 ms instead of 670 ms (the rest is loading the ESLint plugin packages)
    Typecheck and lintPipeline.test.ts Passed

    oxlint's own extends order, checked on oxlint 1.90: the extending config's overrides win over the extended config's overrides, but its root rules lose to them. So repo rules must stay in overrides, as they already do.

  2. LukasMod commented on Nov 9, 2026

    @LukasMod
    Contributor

    @roryabraham
    I prepared draft for eslint-config-expensify.

    The idea is to move that conversion into the package itself, once:

    • eslint-config-expensify (#214) gets a buildOxlintConfig() function. A repo lists the presets it wants (browser, react, typescript, jest...) and gets a ready oxlint config back. Rules oxlint doesn't support yet still run, using ESLint's own code inside oxlint.
    • App (#106218) and Onyx (+Oxlint) (#889) call that function and keep only their own rules. Their copies of the conversion code are deleted.

    What this gives us:

    • Rules are added or changed in one place, eslint-config-expensify. App and Onyx pick them up by bumping the package version
    • I tested this end to end: I turned on two new rules in the package, and both repos reported the new issues with no changes to their own config
    • Nothing changes in what the linter finds today. In both repos, the full lint run gives exactly the same results as before the switch

    Order of merging: #214 goes first and gets released. Then App and Onyx switch from the test version they use now to that release, which is a one-line change in each

    Im doing some clean up in all 3 PRs, but should be ready tomorrow

  3. LukasMod commented on Nov 12, 2026

    @LukasMod
    Contributor

    I added a bunch of tests and guards and cleaned things up along the way. I pinned both E/App and Onyx to this plugin update and didn’t find any blockers. It also lets us remove a lot of configuration from E/App. Ready for review, @roryabraham Expensify/eslint-config-expensify#214

  4. roryabraham commented on Nov 12, 2026

    @roryabraham
    ContributorAuthor

    posted a comment in there

  5. LukasMod commented on Nov 13, 2026

    @LukasMod
    Contributor

    I answered, cut ~ 25%

  6. LukasMod commented on Nov 16, 2026

    @LukasMod
    Contributor

    PR for Eapp that reuses: Expensify/eslint-config-expensify#214 config ready for review: #106218

  7. LukasMod commented on Nov 17, 2026

    @LukasMod
    Contributor

    There's a new Oxlint 1.94.0, but I'm more interested in 1.95, as PR related to this issue was merged today: oxc-project/oxc#26277
    It could help us remove some workaround in EApp related to missing compiler issues 🤞

  8. roryabraham commented on Nov 17, 2026

    @roryabraham
    ContributorAuthor

    ok, waiting for 1.95 to be released for at least a week before proceeding here

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions