fix(lint): restore nested config discovery in changed-code gate (#11130)
This commit is contained in:
parent
77d4c64f7a
commit
89f32a121b
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue