bbovenzi opened a new pull request, #77264:
URL: https://github.com/apache/airflow/pull/77264
Switches the last unicorn rules that ran through `eslint-plugin-unicorn` as
an oxlint JS plugin to oxlint's built-in versions, and drops `jsx-max-depth`.
Until #77218 and #77221 merge, this diff also shows their commits. Only the
last commit belongs here: a0cdeee.
### Stack
This PR is part of a stack moving the UI from Prettier and ESLint to oxfmt
and oxlint. Each open PR targets `main` and includes the commits of the open
PRs before it, so review the PRs in order. Once a PR merges, the next one is
rebased onto `main`.
| Order | PR | Purpose |
|---|---|---|
| 1 | #76472 (merged) | Replace Prettier with oxfmt |
| 2 | #76477 (merged) | Tidy the ESLint config before the oxlint move |
| 3 | #76491 (merged) | Move most lint rules from ESLint to oxlint |
| 4 | #76931 (merged) | Move the type-aware rules from typescript-eslint to
oxlint (tsgolint) |
| 5 | #77218 | Drop ESLint: the last rules run in oxlint as JS plugins or
built-ins |
| 6 | #77221 | Upgrade the UI to TypeScript 7, keeping TypeScript 6 for
tools that need its API |
| 7 | #PR8 | Use oxlint's built-in rules for the last unicorn plugin rules |
The pnpm sync (#77219) used to sit in this stack; it now targets `main` on
its own.
### Why
#77218 kept three rules from #76491's follow-up list on the original plugins
(`jsx-max-depth`, `consistent-function-scoping`, `no-useless-switch-case`), so
the move reported nothing new. It dropped `unicorn/prefer-dom-node-dataset`,
which is a stub in eslint-plugin-unicorn 79. oxlint has native versions of all
four. They run without the JS plugin bridge and catch places the originals
missed.
### What changes
- **`unicorn/prefer-dom-node-dataset`** (14 places, all autofixed):
`getAttribute("data-x")` becomes `dataset.x`. Where the element came from
`closest` or `querySelector(All)`, the call now asks for an `HTMLElement` so
`dataset` type-checks.
- **`unicorn/consistent-function-scoping`** (6 places): helpers that capture
nothing move to module scope (`matchesRoute` in `links.ts`, `setsEqual`,
`parseCompositeId` and three test helpers). In `FailingWatchersChip.test.tsx`,
the promise's resolver starts as `undefined` instead of a no-op function.
- **`unicorn/no-useless-switch-case`** (2 places): `case null:` directly
before `default:` is what `switch-exhaustiveness-check` asks for, so the two
rules disagreed there.
- `loopUtils.ts`: the switch only picked a translation key, so it's now ``
`loop.reason.${summary.reason ?? summary.status}` ``, giving the same keys as
before.
- `AnsiRenderer.tsx`: `case null` joins `case "reverse"`, which also does
nothing; `default` stays for `default-case`.
- **`jsx-max-depth`** is dropped. oxlint's version counts depth differently
and flags 35 components at the same limit of 7. Splitting components to satisfy
a depth count doesn't make them easier to read.
`unicorn-js` still loads `eslint-plugin-unicorn` for
`consistent-destructuring` and `no-unnecessary-polyfills`, which oxlint has no
built-in for.
### Checks run
- **Lint:** `pnpm lint` (oxlint, then `tsc`) passes.
- **Format:** `pnpm format:check` passes.
- **Tests:** `vitest run --changed` against the previous commit, under load
average 125: 741 of 752 pass. The 11 failures pass when their files run on
their own, except 3 in `Trigger.test.tsx`, which fail the same way on `main`.
- **prek:** the pre-commit hooks pass on the commit.
---
##### 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)
--
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]