fix(lint): restore nested config discovery in changed-code gate (#11130)

This commit is contained in:
Neil 2026-07-28 01:30:52 -07:00 committed by GitHub
parent 77d4c64f7a
commit 89f32a121b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -6,10 +6,12 @@ import { pathToFileURL } from 'node:url'
import { resolvePullRequestDiffBase } from './git-pull-request-diff-base.mjs'
const SOURCE_FILE_PATTERN = /\.(?:[cm]?[jt]sx?)$/
const OXLINT_SCANS = [
export const OXLINT_SCANS = [
{
// Why: no --config, so Oxlint keeps discovering nested configs. Pinning the root
// config would apply root rules to mobile/, whose .oxlintrc.json turns them off.
label: 'code quality',
args: ['--config', '.oxlintrc.json', '--report-unused-disable-directives-severity', 'warn']
args: ['--report-unused-disable-directives-severity', 'warn']
},
{
label: 'type-aware code quality',

View File

@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest'
import {
OXLINT_SCANS,
diagnosticTouchesAddedLines,
overlapsAddedLines,
parseAddedLineRanges
@ -41,4 +42,13 @@ describe('changed-code quality line matching', () => {
diagnosticTouchesAddedLines(diagnostic, new Map([[file, [{ start: 24, end: 24 }]]]), root)
).toBe(true)
})
// Why: pinning --config disables nested-config discovery, so root rules that
// mobile/.oxlintrc.json turns off would fail the gate on mobile files.
it('lets the untyped scan discover nested configs instead of pinning the root config', () => {
const scan = OXLINT_SCANS.find((candidate) => candidate.label === 'code quality')
expect(scan.args).not.toContain('--config')
expect(scan.args).not.toContain('--disable-nested-config')
})
})