Skip to content

Switch lint and format to oxlint + oxfmt (Ultracite), add anti-slop rules #749

Description

@carvalab

cc @itsbkm @khaira777, please check this before it merges.

Problem or motivation

ESLint is slow and our config barely checks anything (typescript recommended as warnings, 1,015 warnings, 3 second runs). Nobody runs a linter that slow on every change, and coding agents skip it entirely. We also never had a formatter, so style drifts file by file.

Desired outcome

Replace ESLint (plus typescript-eslint and eslint-config-next) with oxlint using the Ultracite presets: core for the backend, core + react + next for the frontend. Add oxfmt as the first formatter this repo has had. Add the anti-slop preset so agents and humans get the same strict rules with fast feedback.

Proposed technical approach

Configs: root oxlint.config.ts (core only, no JSX in the backend) and frontend/oxlint.config.ts (core + react + next), plus oxfmt.config.ts in both. One intentional carryover: nextjs/no-img-element stays off, the Electron static export cannot use next/image (that was already off in the old config). Two native rules Ultracite turns off (react/no-array-index-key, react/only-export-components) are re-enabled directly, and cognitive complexity comes from oxlint-plugin-complexity. The optional JS plugin bundle (github/sonarjs/react-doctor) was measured and left out: about a thousand extra findings per package for a 25 to 40x slowdown, which defeats the purpose.

Measured on this repo: backend lint 3.05s to about 1.2s with everything on (0.33s native rules alone). Findings go up because the standard is stricter: 8.2k backend and 5.5k frontend under core, plus 1.9k and 600 from anti-slop (SAFETY comments on every as, no typeof narrowing, no unknown in signatures). No fmt runs yet: 538 files would reformat and stay as they are until touched.

Enforcement for contributors: husky + lint-staged pre-commit hook formats staged files with oxfmt and lints them with the matching per-package config, blocking the commit on violations. Only touched files are checked. VS Code users get format-on-save through the committed .vscode settings and the recommended Oxc extension.

Setup note, verified with clean installs: npm install and npm ci work unchanged in both packages. The new prepare script (husky) runs after the existing postinstall (Electron setup), they do not conflict. Hooks install automatically on root install; a frontend-only install skips them. Bypass with git commit --no-verify.

Open point

npm run lint reports around 16.7k errors, so CI lint fails until that is triaged. The hook already stops new violations. Proposal: downgrade the noisiest pure-style rules (sorted keys, arrow-only functions) to warnings and tighten over time instead of fixing 16k findings by hand. Needs maintainer call.

Area

Other

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions