bbovenzi opened a new pull request, #76931:
URL: https://github.com/apache/airflow/pull/76931

   Moves the UI's type-aware lint rules from typescript-eslint to oxlint's 
type-aware mode 
([tsgolint](https://oxc.rs/docs/guide/usage/linter/type-aware.html)). ESLint 
then stops building a TypeScript program on every run. For the prek hook on a 
typical commit, that was most of its time.
   
   *Stack 4*, on #76491. Until that merges, this diff also shows its commit; 
only the last commit belongs here.
   
   ### What moves
   - **46 type-aware rules** move with their options unchanged, from 
`await-thenable` to `use-unknown-in-catch-callback-variable`. 
`options.typeAware` is on in `.oxlintrc.json`.
   - `@typescript-eslint/prefer-destructuring` becomes oxlint's 
`prefer-destructuring`. It was the only rule left in ESLint that needed type 
information. On a probe, both report the same lines and both skip 
type-annotated declarations.
   - Two of them, `no-unnecessary-condition` and `prefer-optional-chain`, are 
still nursery in oxlint 1.90. On a probe file they report the same lines as 
ESLint on `main`.
   - ESLint keeps 16 rules that don't need types: `naming-convention`, 
`no-invalid-this`, a few react and unicorn rules oxlint hasn't implemented, and 
the four follow-ups from #76491.
   
   ### ESLint without a tsconfig
   With no type-aware rules left, ESLint no longer gets 
`parserOptions.project`. Its scope analysis then falls back to the default 
`lib` and stops knowing about DOM globals. 
`unicorn/consistent-function-scoping` then flagged a test helper that only uses 
`globalThis`. `parserOptions.lib` now copies `tsconfig.app.json`'s `lib`, so 
nothing new is reported.
   
   ### TypeScript 7
   The plan for this PR included upgrading `typescript` to 7. That has to wait 
for ESLint to go:
   - typescript-eslint 8.72.2 (latest) requires `typescript <6.1.0`.
   - TypeScript 7.0.2's npm package doesn't ship the compiler API that 
`@typescript-eslint/parser` uses.
   
   tsgolint bundles its own TypeScript 7 (typescript-go), so type-aware linting 
already runs on 7 without the upgrade. The only TypeScript 7 change here is 
removing the deprecated `baseUrl` and `ignoreDeprecations` from 
`tsconfig.node.json`. The `paths` entries there are already relative.
   
   ### Versions
   `oxlint-tsgolint` 7.0.2006, the newest release older than the package's 
`minimumReleaseAge`. Dependabot's `oxc` group already covers `oxlint*`.
   
   ### Coverage
   - **Whole package:** oxlint with the moved rules and ESLint with the rest 
report 0 problems, the same as before.
   - **Probe file:** violations of 9 rules, 6 of them type-aware, give the same 
rule IDs and lines under this PR's oxlint as under ESLint on `main`.
   - **Every tsconfig project:** a floating promise is reported in `src/` 
(`tsconfig.app.json`), `tests/` and `rules/` (`tsconfig.dev.json`), and 
`vite.config.ts` (`tsconfig.node.json`).
   
   ### Benchmarks
   `hyperfine -N --warmup 1`, before = `main` (ESLint runs everything), after = 
this PR. M1 Max, Node 22.21.1, oxlint 1.90.0, ESLint 10.11.0. Load average was 
9–31 during the runs, so the absolute times are inflated. The spread between 
runs was small.
   
   | Run | Before | After |
   |---|---|---|
   | prek hook path, 5 changed files, `--fix` (6 runs) | 9.6 s ± 0.7 | 2.9 s ± 
0.3 (oxlint 1.2 s, ESLint 1.5 s) |
   | Full package, `--quiet`, tsc left out (5 runs) | 58.4 s ± 1.2 | 16.3 s ± 
1.2 |
   
   ### Checks run
   - **Lint:** `pnpm lint` passes (oxlint, then ESLint, then tsc).
   - **Types:** `tsc -p tsconfig.node.json` passes without `baseUrl`. 
`tsconfig.dev.json` has 3 errors that `main` already has; `pnpm lint` doesn't 
check that project.
   - **Format:** `pnpm format:check` passes.
   - **Tests:** `pnpm test` has the same timing-sensitive failures as `main` in 
a full run here (6 files on each, e.g. `BackfillsDateFilter`, `DagsFilters`, 
`RequiredActionsRoute`). They pass when run alone. The simple auth manager UI 
tests and `scripts/tests` (1991) pass.
   - **Build:** `pnpm build` succeeds.
   - **prek:** `prek run --stage pre-commit` passes on the changed files.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to