chore: migrate from ESLint to Oxlint#2302
Conversation
|
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
There was a problem hiding this comment.
1 issue found across 11 files
Confidence score: 4/5
- In
.oxlintrc.json, the customno-restricted-syntaxpattern appears to coverCallExpressionbut missesnew window.Function(...)/new globalThis.Function(...), so dynamic code construction could slip past lint checks and weaken your intended security guardrail if merged as-is — extend the rule to also matchNewExpressionvariants before merging.
Architecture diagram
sequenceDiagram
participant Dev as Developer
participant Turbo as Turbo Task Runner
participant Oxlint as Oxlint CLI
participant Config as .oxlintrc.json
participant PkgConfig as packages/cli/.oxlintrc.json
participant Plugins as Oxlint Plugins
participant Files as Source Files
participant Output as Terminal Output
Note over Dev,Output: NEW: Linting flow after migrating from ESLint to Oxlint
Dev->>Turbo: pnpm lint (or pnpm oxlint)
Turbo->>Oxlint: Run oxlint . (per package)
Oxlint->>Config: Load root configuration
Config-->>Oxlint: Provide rules, plugins, env, ignores
alt Package has own config (e.g., packages/cli)
Oxlint->>PkgConfig: Load package-specific .oxlintrc.json
PkgConfig-->>Oxlint: Extend root + overrides
end
Oxlint->>Plugins: Activate plugins (typescript, security, eslint-js)
Plugins-->>Oxlint: Register rules
Oxlint->>Files: Lint matching source files
Files-->>Oxlint: File contents
Oxlint->>Oxlint: Apply rules (e.g., no-eval, typescript/no-unused-vars)
Oxlint-->>Output: Print lint results (errors, warnings)
Output-->>Dev: See lint output in terminal
Note over Dev,Output: ~7x faster than previous ESLint flow (0.5s vs 3.9s warm)
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…on construction via window.Function and globalThis.Function for both CallExpression and NewExpression
why
Oxlint is a newer ESLint alternative with faster linting.
what changed
Configs and scripts updated to use Oxlint instead of ESLint. Root lint was 3.9s warm, now 0.5s so ~7× faster.
test plan
pnpm oxlint
pnpm lint
Summary by cubic
Migrate the repo from
eslinttooxlintto speed up linting. Lint at the root drops from ~3.9s warm to ~0.5s (~7× faster).Refactors
eslint.config.mjswith.oxlintrc.json(root) andpackages/cli/.oxlintrc.json.eslinttooxlintand addoxlint:fixacross packages.eslint-plugin-security,oxlint-plugin-eslint, and thetypescriptplugin; add explicit bans on theFunctionconstructor (direct,window.Function, andglobalThis.Function) for both call and new expressions.eslint,@eslint/js, andtypescript-eslint; addoxlintandoxlint-plugin-eslint.turbo.jsonto watch.oxlintrc.jsonfiles.Migration
pnpm oxlintandpnpm oxlint:fix(orpnpm lintwhich now runsoxlint).eslint, switch to theoxlintintegration.Written for commit 08936c9. Summary will update on new commits.