Skip to content

Commit 2368339

Browse files
zoomote[bot]roomoteedelauna
authored
[Chore] Close lint coverage and knip hygiene gaps (#2280)
* chore: close lint and knip hygiene gaps * fix: address review findings on lint and knip hygiene --------- Co-authored-by: Roomote <roomote@roomote.dev> Co-authored-by: Elliott de Launay <edelauna@gmail.com>
1 parent 33b5650 commit 2368339

13 files changed

Lines changed: 69 additions & 20 deletions

‎.github/workflows/code-qa.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ jobs:
6666
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6767
- name: Setup Node.js and pnpm
6868
uses: ./.github/actions/setup-node-pnpm
69+
with:
70+
install-args: "--frozen-lockfile"
6971
- name: Verify all translations are complete
7072
run: node scripts/find-missing-translations.js
7173

@@ -76,6 +78,8 @@ jobs:
7678
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
7779
- name: Setup Node.js and pnpm
7880
uses: ./.github/actions/setup-node-pnpm
81+
with:
82+
install-args: "--frozen-lockfile"
7983
- name: Verify Knip guardrails
8084
run: pnpm test:knip-policy
8185
- name: Run knip checks
@@ -90,6 +94,8 @@ jobs:
9094
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
9195
- name: Setup Node.js and pnpm
9296
uses: ./.github/actions/setup-node-pnpm
97+
with:
98+
install-args: "--frozen-lockfile"
9399
- name: Check formatting
94100
run: pnpm format:check
95101
- name: Lint
@@ -163,6 +169,8 @@ jobs:
163169
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
164170
- name: Setup Node.js and pnpm
165171
uses: ./.github/actions/setup-node-pnpm
172+
with:
173+
install-args: "--frozen-lockfile"
166174
- name: Restore Turbo cache
167175
id: turbo-cache
168176
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0

‎apps/cli/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"roo": "dist/index.js"
1010
},
1111
"scripts": {
12-
"format": "prettier --write 'src/**/*.ts'",
13-
"lint": "eslint src --ext .ts --max-warnings=0",
12+
"format": "prettier --write 'src/**/*.{ts,tsx}'",
13+
"lint": "eslint src --ext .ts,.tsx --max-warnings=0",
1414
"check-types": "tsc --noEmit",
1515
"test": "vitest run",
1616
"test:coverage": "vitest run --coverage",

‎knip.json‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
"ignore": [
44
"apps/vscode-e2e/**",
55
"scripts/**",
6-
"apps/cli/scripts/**",
7-
"**/__tests__/**!",
86
"packages/core/src/custom-tools/__tests__/fixtures/**",
97
"packages/core/src/custom-tools/__tests__/fixtures-override/**",
108
"src/integrations/misc/__tests__/performance/**",
119
"src/integrations/terminal/__tests__/setupTerminalTests.ts",
1210
"src/integrations/terminal/__tests__/streamUtils/index.ts",
13-
"src/services/tree-sitter/__tests__/fixtures/sample-python.ts",
1411
"src/services/tree-sitter/__tests__/helpers.ts"
1512
],
1613
"ignoreDependencies": ["lint-staged"],
@@ -43,7 +40,7 @@
4340
]
4441
},
4542
"webview-ui": {
46-
"entry": ["src/index.tsx!", "src/**/*.visual.tsx", "src/**/*.visual.{fixture,i18n}.{ts,tsx}"],
43+
"entry": ["src/**/*.visual.tsx", "src/**/*.visual.{fixture,i18n}.{ts,tsx}"],
4744
"project": [
4845
"src/**/*.{ts,tsx}!",
4946
"../src/shared/*.ts!",
@@ -66,7 +63,6 @@
6663
]
6764
},
6865
"apps/cli": {
69-
"ignore": ["eslint.config.mjs", "scripts/**"],
7066
"project": ["src/**/*.ts!", "src/**/*.tsx!"],
7167
"ignoreDependencies": ["@vscode/ripgrep"]
7268
},

‎package.json‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"install": "node scripts/bootstrap.mjs",
1111
"install:all": "node scripts/bootstrap.mjs",
1212
"lint": "turbo lint --log-order grouped --output-logs new-only",
13-
"check-types": "turbo check-types --log-order grouped --output-logs new-only",
13+
"check-types": "tsc -p tsconfig.json --noEmit && turbo check-types --log-order grouped --output-logs new-only",
1414
"test": "turbo test --log-order grouped --output-logs new-only",
1515
"test:code-qa-ci": "node --test scripts/code-qa-workflow.test.mjs",
1616
"solheim:smoke": "node --import tsx scripts/solheim-smoke/driver.mts",
@@ -27,7 +27,7 @@
2727
"parser-scope:model-check": "node scripts/run-native-tool-call-parser-scoping.mjs",
2828
"mcp:integration-check": "tsx scripts/check-mcp-oauth-integration.ts",
2929
"test:coverage": "turbo test:coverage --log-order grouped --output-logs new-only",
30-
"format": "turbo format --log-order grouped --output-logs new-only",
30+
"format": "prettier --write .",
3131
"format:check": "prettier --check .",
3232
"build": "turbo build --log-order grouped --output-logs new-only",
3333
"bundle": "turbo bundle --log-order grouped --output-logs new-only",
@@ -36,9 +36,9 @@
3636
"install:vsix": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix && node scripts/install-vsix.js",
3737
"code-server:install": "node scripts/code-server.js",
3838
"changeset:version": "cp CHANGELOG.md src/CHANGELOG.md && changeset version && cp -vf src/CHANGELOG.md .",
39-
"knip": "knip",
39+
"knip": "knip --treat-config-hints-as-errors",
4040
"npm:publish:types": "pnpm --filter @roo-code/types npm:publish",
41-
"knip:production": "knip --production",
41+
"knip:production": "knip --production --treat-config-hints-as-errors",
4242
"test:knip-policy": "node --test scripts/knip-policy.test.mjs"
4343
},
4444
"devDependencies": {
@@ -71,7 +71,7 @@
7171
"webview-ui/src/**/*.{ts,tsx}": [
7272
"pnpm --dir webview-ui exec eslint --max-warnings=0 --no-warn-ignored"
7373
],
74-
"apps/cli/src/**/*.ts": [
74+
"apps/cli/src/**/*.{ts,tsx}": [
7575
"pnpm --dir apps/cli exec eslint --max-warnings=0 --no-warn-ignored"
7676
],
7777
"apps/vscode-e2e/src/**/*.ts": [
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { config } from "./base.js"
2+
3+
export default config

‎packages/config-eslint/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"./api-provider-hygiene": "./api-provider-hygiene.js"
1111
},
1212
"scripts": {
13+
"lint": "eslint . --max-warnings=0",
1314
"test": "node --test provider-identifiers.test.js api-provider-hygiene.test.js"
1415
},
1516
"devDependencies": {

‎scripts/check-mcp-oauth-integration.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ assert.deepEqual(MCP_OAUTH_GRANT_TYPES, ["authorization_code", "refresh_token"])
2525
for (let mask = 0; mask < 1 << advertisedGrantTypes.length; mask++) {
2626
const advertised = advertisedGrantTypes.filter((_, index) => mask & (1 << index))
2727
const selected = selectMcpOAuthGrantTypes(advertised)
28-
const expected = MCP_OAUTH_GRANT_TYPES.filter((grantType) => advertised.includes(grantType))
28+
const expected: string[] = MCP_OAUTH_GRANT_TYPES.filter((grantType) => advertised.includes(grantType))
2929

3030
// Normative MUST: RFC 7591 section 2 says grant_types describes grants the
3131
// client can use, and each token-endpoint grant_type must match its registered

‎scripts/check-provider-handoff-scheduler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,5 +495,5 @@ function formatViolation(policy: Policy, violations: string[], trace: TraceStep[
495495
}
496496

497497
function task(id: string, status: HistoryItem["status"], parentTaskId?: string): HistoryItem {
498-
return { id, status, parentTaskId, task: id, ts: 1, tokensIn: 0, tokensOut: 0, totalCost: 0 }
498+
return { id, status, parentTaskId, task: id, number: 1, ts: 1, tokensIn: 0, tokensOut: 0, totalCost: 0 }
499499
}

‎scripts/code-qa-workflow.test.mjs‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ describe("platform unit-test workflow", () => {
120120
describe("Knip quality gate", () => {
121121
it("runs analyzer challenge tests and both dependency graphs without allowing failure", () => {
122122
const manifest = JSON.parse(fs.readFileSync(path.join(repositoryRoot, "package.json"), "utf8"))
123-
assert.equal(manifest.scripts.knip, "knip")
124-
assert.equal(manifest.scripts["knip:production"], "knip --production")
123+
assert.equal(manifest.scripts.knip, "knip --treat-config-hints-as-errors")
124+
assert.equal(manifest.scripts["knip:production"], "knip --production --treat-config-hints-as-errors")
125125
assert.equal(manifest.scripts["test:knip-policy"], "node --test scripts/knip-policy.test.mjs")
126126
for (const [stepName, command] of [
127127
["Verify Knip guardrails", "pnpm test:knip-policy"],
@@ -136,3 +136,15 @@ describe("Knip quality gate", () => {
136136
assert.doesNotMatch(job, /continue-on-error|if:/)
137137
})
138138
})
139+
140+
describe("Code QA dependency install", () => {
141+
it("installs every job with a frozen lockfile", () => {
142+
const setups = workflow.match(/uses: \.\/\.github\/actions\/setup-node-pnpm\n/g) ?? []
143+
const frozen =
144+
workflow.match(
145+
/uses: \.\/\.github\/actions\/setup-node-pnpm\n\s+with:\n\s+install-args: "--frozen-lockfile"\n/g,
146+
) ?? []
147+
assert.ok(setups.length > 0, "missing setup-node-pnpm steps")
148+
assert.equal(frozen.length, setups.length)
149+
})
150+
})

‎scripts/knip-policy.test.mjs‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,23 @@ function fixture(files, run, includeWebview = false) {
4141
}),
4242
)
4343
if (includeWebview) {
44-
write("webview-ui/package.json", JSON.stringify({ name: "fixture-webview", private: true }))
44+
write(
45+
"webview-ui/package.json",
46+
JSON.stringify({
47+
name: "fixture-webview",
48+
private: true,
49+
scripts: { dev: "vite" },
50+
devDependencies: { vite: "8.0.0" },
51+
}),
52+
)
53+
write("webview-ui/vite.config.ts", "export default {}\n")
54+
write("webview-ui/index.html", '<script type="module" src="/src/index.tsx"></script>\n')
4555
write("webview-ui/src/index.tsx", 'console.log("application entry")\n')
56+
symlinkSync(
57+
path.join(root, "webview-ui/node_modules"),
58+
path.join(directory, "webview-ui/node_modules"),
59+
"junction",
60+
)
4661
}
4762
write("src/extension.ts", 'import { live } from "./helper"\nconsole.log(live)\n')
4863
write("src/helper.ts", "export const live = 1\n")

0 commit comments

Comments
 (0)