Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config/scripts/check-changed-code-quality.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ export const OXLINT_SCANS = [
label: 'casting code quality',
args: ['--config', 'config/oxlint-code-quality-casting.json']
},
{
// Why the allow: CI's `audit:code-quality:native` runs before the mobile install, so it can
// never see a cycle inside mobile/ — locally, where mobile/node_modules exists, it would.
label: 'focused plugins',
args: [
'--config',
'config/oxlint-code-quality-native-plugins.json',
'--allow',
'import/no-cycle'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The allow is global, so this also turns import/no-cycle off for root src/ files, where CI's repo-wide audit does enforce it — the gate can now pass locally while static analysis fails on a root-file cycle. That's not a regression (the gate had no import rules before), but if the intent is mobile-only parity, scoping the allow to mobile files would keep root coverage intact.

Technical details
# Scope the `import/no-cycle` allow to the mobile dependency state

## Affected sites
- `config/scripts/check-changed-code-quality.mjs:34-35` — `--allow import/no-cycle` applies to every file the scan is handed, root included.
- `config/scripts/check-changed-code-quality.mjs:395-411` (`runOxlintScan`) — one invocation over one `files` list, so a single CLI `--allow` cannot express the split.

## Required outcome
- Root-file cycles that `audit:code-quality:native` would fail stay caught locally; mobile files keep the allow because CI's audit runs before `mobile/node_modules` exists.

## Suggested approach (optional)
- Give a scan an optional file predicate (or split the focused scan into a root invocation with no allow and a mobile invocation with `--allow import/no-cycle`) so the allow is scoped to `mobile/**`.
- Alternatively, leave as-is and accept that CI is the only `no-cycle` gate for root files — that is a reasonable call, hence informational.

]
},
{
label: 'type-aware code quality',
args: ['--type-aware', '--config', 'config/oxlint-code-quality-type-aware.json']
Expand Down
10 changes: 10 additions & 0 deletions config/scripts/check-changed-code-quality.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ describe('changed-code quality line matching', () => {
expect(scan.args).not.toContain('--disable-nested-config')
})

// Why: import/no-duplicates was reachable only through the repo-wide CI audit, so it first
// surfaced after push. The cycle rule stays out because CI's audit runs before the mobile install.
it('runs the focused plugin config the repo-wide audit enforces, minus the cycle rule', () => {
const scan = OXLINT_SCANS.find((candidate) => candidate.label === 'focused plugins')

expect(scan.args).toContain('config/oxlint-code-quality-native-plugins.json')
expect(scan.args).toContain('import/no-cycle')
expect(scan.args[scan.args.indexOf('import/no-cycle') - 1]).toBe('--allow')
})

it('leaves Cloud source to the independent Cloud quality checks', () => {
expect(isRootCodeQualityPath('cloud/apps/relay/src/index.ts')).toBe(false)
expect(isRootCodeQualityPath('src/main/index.ts')).toBe(true)
Expand Down
Loading