fix(ci): stop the changed-code gate type-checking mobile under the root config

The type-aware scan pins config/oxlint-code-quality-type-aware.json, and mobile's
types resolve only from mobile/node_modules. Every mobile import of a type that
lives there becomes an 'error' type under the root config, and
no-redundant-type-constituents then reports it as a real finding - eight of them
on this PR, none reproducible with the package script, which scopes that scan to
'src config tests' precisely because of this.

The untyped scan already documents the same hazard and avoids it by not pinning a
config at all. The type-aware scan cannot do that, so it skips mobile instead.
This commit is contained in:
Brennan Benson
2026-08-19 13:10:46 -07:00
parent 728c8d7fcb
commit 41e6078bb4
2 changed files with 29 additions and 3 deletions
+14 -3
View File
@@ -15,7 +15,13 @@ export const OXLINT_SCANS = [
},
{
label: 'type-aware code quality',
args: ['--type-aware', '--config', 'config/oxlint-code-quality-type-aware.json']
args: ['--type-aware', '--config', 'config/oxlint-code-quality-type-aware.json'],
// Why: type-aware rules need the types to RESOLVE, and mobile's live only in
// mobile/node_modules. Linting them under the root config turns every such import into an
// `error` type, which `no-redundant-type-constituents` then reports as a real finding. The
// package script scopes this scan to `src config tests` for the same reason; the changed-file
// gate has to agree with it or it invents findings the repo cannot reproduce.
excludes: (file) => file === 'mobile' || file.startsWith('mobile/')
},
{
label: 'React Doctor',
@@ -195,7 +201,12 @@ export function main(
let failures = 0
for (const scan of OXLINT_SCANS) {
const diagnostics = runOxlintScan(root, scan, files).filter((diagnostic) =>
const scanned = scan.excludes ? files.filter((file) => !scan.excludes(file)) : files
if (scanned.length === 0) {
console.log(`${scan.label}: 0 new finding(s) across 0 changed file(s).`)
continue
}
const diagnostics = runOxlintScan(root, scan, scanned).filter((diagnostic) =>
diagnosticTouchesAddedLines(diagnostic, rangesByFile, root)
)
for (const diagnostic of diagnostics) {
@@ -203,7 +214,7 @@ export function main(
}
failures += diagnostics.length
console.log(
`${scan.label}: ${diagnostics.length} new finding(s) across ${files.length} changed file(s).`
`${scan.label}: ${diagnostics.length} new finding(s) across ${scanned.length} changed file(s).`
)
}
@@ -51,4 +51,19 @@ describe('changed-code quality line matching', () => {
expect(scan.args).not.toContain('--config')
expect(scan.args).not.toContain('--disable-nested-config')
})
// Why: the type-aware scan DOES pin the root config, and mobile's types resolve only from
// mobile/node_modules. Linting mobile under the root config makes every such import an `error`
// type, which no-redundant-type-constituents reports as a real finding — findings the package
// script cannot reproduce, because it scopes this scan to `src config tests`.
it('keeps the type-aware scan off mobile, whose types the root config cannot resolve', () => {
const scan = OXLINT_SCANS.find((candidate) => candidate.label === 'type-aware code quality')
expect(scan.args).toContain('--type-aware')
expect(scan.excludes('mobile/src/session/use-mobile-structured-attachments.test.ts')).toBe(true)
expect(scan.excludes('mobile')).toBe(true)
expect(scan.excludes('src/main/runtime/orca-runtime.ts')).toBe(false)
// A path that merely starts with the same letters is not inside the package.
expect(scan.excludes('mobile-shim/src/a.ts')).toBe(false)
})
})