ryanahamilton commented on code in PR #76931:
URL: https://github.com/apache/airflow/pull/76931#discussion_r4602422397
##########
airflow-core/src/airflow/ui/rules/typescript.js:
##########
@@ -55,13 +55,11 @@ export const typescriptRules = /** @type {const} @satisfies
{FlatConfig.Config}
ecmaVersion: "latest",
/**
- * Get `tsconfig.json` from the root directory.
+ * oxlint runs the type-aware rules, so ESLint no longer loads a
tsconfig. Without one, scope
Review Comment:
The 46 moved type-aware rules are still set to `ERROR` further down in this
file. Only `oxlint.buildFromConfigFile` in `eslint.config.js` turns them off at
runtime. Before this change, a rule it missed would just run twice. Now that
`project` is gone, ESLint throws instead ("You have used a rule which requires
type information…"), and both `pnpm lint` and the prek hook fail.
Two ways to get there:
- Someone disables a rule by deleting it from `.oxlintrc.json`, which looks
like the right move now that oxlint owns it.
- `eslint-plugin-oxlint` (pinned at 1.90.0, while `oxlint` is 1.93.0)
doesn't yet map a rule that oxlint adds or renames.
Could we delete these entries from `rules/typescript.js`, or set them `OFF`?
`.oxlintrc.json` would then be the only place their options live. Right now the
options here look authoritative but aren't enforced.
---
Drafted-by: Claude Code (Opus 5.5); reviewed by @ryanahamilton before posting
##########
airflow-core/src/airflow/ui/.oxlintrc.json:
##########
@@ -567,11 +597,26 @@
}
],
"typescript/no-this-alias": "error",
+ "typescript/no-unnecessary-boolean-literal-compare": "error",
+ "typescript/no-unnecessary-condition": "error",
Review Comment:
`no-unnecessary-condition` (and `prefer-optional-chain` at L646) are still
nursery in oxlint, but they're set to `error`. Their fixes also run
automatically: `scripts/ci/prek/ts_compile_lint_ui.py` runs `pnpm oxlint --fix`
on every commit.
A nursery false positive here deletes a `?.`/`??` guard that's actually
needed, and nobody reviews the change. `tsc` won't catch it if TS 7 (tsgolint)
and TS 6 disagree about the type. They match `main` on one probe file today,
but behavior can shift with any oxlint bump from Dependabot. Could they stay at
`warn` until they leave nursery, or come with a note to re-check them on each
bump?
---
Drafted-by: Claude Code (Opus 5.5); reviewed by @ryanahamilton before posting
##########
airflow-core/src/airflow/ui/rules/typescript.js:
##########
@@ -55,13 +55,11 @@ export const typescriptRules = /** @type {const} @satisfies
{FlatConfig.Config}
ecmaVersion: "latest",
/**
- * Get `tsconfig.json` from the root directory.
+ * oxlint runs the type-aware rules, so ESLint no longer loads a
tsconfig. Without one, scope
+ * analysis needs the app's `lib` to know globals such as `globalThis`;
otherwise
+ * `unicorn/consistent-function-scoping` flags functions that only use
them.
*/
- project: [
- `${import.meta.dirname}/../tsconfig.app.json`,
- `${import.meta.dirname}/../tsconfig.dev.json`,
- `${import.meta.dirname}/../tsconfig.node.json`,
- ],
+ lib: ["es2022", "dom", "dom.iterable"],
Review Comment:
This hand-copies `tsconfig.app.json`'s `lib`, and nothing fails when the two
diverge. If the app's `lib` moves to ES2024, ESLint's scope analysis won't see
the new globals. It also applies `dom` to Node-only files (`vite.config.ts`,
`rules/*.js`), whose tsconfigs use a different `lib`.
Could this read `compilerOptions.lib` from `tsconfig.app.json`, lowercased,
or at least have a note in `tsconfig.app.json` pointing back here?
---
Drafted-by: Claude Code (Opus 5.5); reviewed by @ryanahamilton before posting
##########
airflow-core/src/airflow/ui/package.json:
##########
@@ -109,6 +109,7 @@
"openapi-merge-cli": "^2.0.3",
"oxfmt": "0.78.0",
"oxlint": "1.93.0",
+ "oxlint-tsgolint": "7.0.2006",
Review Comment:
tsgolint type-checks with its bundled TypeScript 7, but `tsc` in `pnpm
lint`, the prek hook and editors still use `typescript ^6.0.3`. So the
type-aware rules and the compiler that gates the build now look at different
type systems.
In the prek hook, `oxlint --fix` runs before `tsc`. If TS 7 narrows
something differently, a `no-unnecessary-type-assertion` or
`no-unnecessary-condition` fix can remove an assertion or guard that TS 6 still
needs. `tsc` then fails on a file the linter just changed. The reverse can
happen too: an `unsafe-*` issue under TS 6 goes unreported. It would help to
call out this skew in the description, or say how it'll be handled until the
`typescript` 7 upgrade lands.
---
Drafted-by: Claude Code (Opus 5.5); reviewed by @ryanahamilton before posting
##########
airflow-core/src/airflow/ui/.oxlintrc.json:
##########
@@ -496,13 +499,15 @@
"no-unused-expressions": "error",
"no-use-before-define": "error",
"no-useless-constructor": "error",
+ "prefer-destructuring": "error",
Review Comment:
`@typescript-eslint/prefer-destructuring` used types: it only asks for array
destructuring when the indexed value is iterable. oxlint's
`prefer-destructuring` is the core-rule version and doesn't use types.
Example: `const first = byIndex[0]` with `byIndex: Record<number, Foo>`. The
core rule reports "Use array destructuring", but `const [first] = byIndex`
doesn't compile because `Record<number, Foo>` isn't iterable. With
`enforceForRenamedProperties: false` there's no object-destructuring rewrite
either, so the only way out is a disable comment. The probe in the description
covered type-annotated declarations but not this case. Worth checking before
treating the two rules as equivalent.
---
Drafted-by: Claude Code (Opus 5.5); reviewed by @ryanahamilton before posting
##########
airflow-core/src/airflow/ui/pnpm-lock.yaml:
##########
@@ -835,56 +838,48 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
Review Comment:
Besides the new `oxlint-tsgolint` entries, this diff drops `libc:
[glibc]`/`libc: [musl]` from about 20 unrelated native packages: here and in
the hunks at L982, L1103 and L3362. That looks like the lockfile was
regenerated with a different pnpm than `packageManager: [email protected]`.
Without `libc`, pnpm on Linux installs both the `-gnu` and `-musl` variants.
The next `pnpm install` with the pinned version will also add the fields back,
which causes churn and conflicts in an unrelated PR. Could the lockfile be
regenerated with pnpm 10.28.1, so only the tsgolint entries change?
---
Drafted-by: Claude Code (Opus 5.5); reviewed by @ryanahamilton before posting
--
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]