Skip to content

ci: make lint and format checks pass so they can be enforced - #850

Merged
zereight merged 1 commit into
mainfrom
ci/lint-and-format-checks
Oct 14, 2026
Merged

zereight merged 1 commit into
mainfrom
ci/lint-and-format-checks

Conversation

@zereight

Copy link
Copy Markdown
Owner

Summary

Both CI quality steps currently pass no matter what:

run: npm run lint || echo "No lint script found"
npx prettier --check "**/*.{js,ts,json,md}" || echo "Some files need formatting"

npm run lint exits 2 on every run. ESLint 9 no longer reads .eslintrc.json, so it stops with "couldn't find an eslint.config.(js|mjs|cjs) file". prettier --check fails on 190 files. This PR makes both commands pass on main, so the || echo fallbacks can be removed.

No logic changes. Every source hunk is one of:

  • a removal of an unused import, constant or catch binding;
  • let → const;
  • one unused parameter renamed to _options (utils/safe-redirect-fetch.ts);
  • one disable comment (utils/url.ts).

Changes:

  • eslint.config.js (flat config) replaces .eslintrc.json.
    • Same rules as before. The jest env is dropped, because the tests use node:test and no-undef is off for TypeScript.
    • @typescript-eslint/no-unused-vars gets ignoreRestSiblings, so const { _confirmed, ...rest }-style omits pass.
    • no-empty-object-type gets allowInterfaces: "with-single-extends", which keeps SealedVerifyOptions as is.
  • package.json:
    • lint / lint:fix become eslint . / eslint . --fix, because --ext is not supported by flat config on older ESLint 9 releases.
    • @eslint/js is now a declared devDependency. It is the same version already in the lockfile through eslint; the lockfile change is one line.
  • Fixed the 76 existing errors:
    • 53 no-unused-vars and 21 prefer-const, as described above;
    • isLoopbackBindHost() removed from index.ts: it lost its only caller in 3eab537;
    • the control-character regex in utils/url.ts is intentional and gets // eslint-disable-next-line no-control-regex.
  • .prettierignore lists the 190 files Prettier would reformat today, so prettier --check passes without a mass reformat that would conflict with open PRs.
    • Root files are anchored (/README.md), so nested files with the same name are still checked.
    • New files are always checked. Entries can be removed as files get formatted.

The || echo removal in .github/workflows/pr-test.yml is not in this PR. The diff is below and can be applied by someone with workflow permissions:

diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml
index 22379c0..921f8cd 100644
--- a/.github/workflows/pr-test.yml
+++ b/.github/workflows/pr-test.yml
@@ -42,7 +42,7 @@ jobs:
       run: npx tsc --noEmit
 
     - name: Lint check
-      run: npm run lint || echo "No lint script found"
+      run: npm run lint
 
     - name: Check package size
       run: |
@@ -88,7 +88,7 @@ jobs:
 
     - name: Check code formatting
       run: |
-        npx prettier --check "**/*.{js,ts,json,md}" || echo "Some files need formatting"
+        npx prettier --check "**/*.{js,ts,json,md}"
 
     - name: Check for console.log statements
       run: |

Related issue

None.

Tests

All run on Node 22.21.1:

  • npm run lint: exit 0. 0 errors, 997 warnings; warnings were already allowed.

  • npm run format:check: exit 0. A newly added unformatted file is still reported.

  • npm run build, npx tsc --noEmit, npm run check:runtime-deps: pass.

  • npm run test:mock: 1492 passed, 0 failed (same count as main).

  • I ran the checks that cover this change.

Docs

  • README.md, README.ko.md, README.zh-CN.md, and README.pt-BR.md match when user-facing behavior, env vars, flags, or examples changed. (No user-facing change.)
  • docs/ matches the same behavior.

Breaking change

No. This changes dev tooling only; runtime behavior is unchanged.

`npm run lint` exited 2 on every run: ESLint 9 no longer reads
.eslintrc.json, so it failed with "couldn't find an eslint.config file".
`prettier --check` failed on 190 files. CI hid both behind `|| echo`.

- Move the ESLint config to eslint.config.js (flat config) with the same
  rules. Drop the jest env; tests use node:test and no-undef is off for
  TypeScript. Add ignoreRestSiblings for `const { x, ...rest }` omits and
  allow single-extends interfaces.
- Declare @eslint/js (already in the lockfile through eslint).
- Fix the 76 existing lint errors. No logic changes: unused imports,
  constants and catch bindings removed, let -> const, one unused
  parameter renamed to _options, an unused helper removed from index.ts,
  and a disable comment on the intentional control-character regex.
- List the files that Prettier would currently reformat in
  .prettierignore, so `prettier --check` passes without a mass reformat.
  New files are checked. Remove entries as files get formatted.

`npm run lint` now exits 0 (warnings only) and `npm run format:check`
exits 0.
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 92d6ccd6-74bc-4acb-ae7f-8566ca0c64c1
📥 Commits

Reviewing files that changed from the base of the PR and between fdd9ced and 6f1d512.

⛔ Files ignored due to path filters: 1
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing: 40
  • .eslintrc.json
  • .prettierignore
  • eslint.config.js
  • index.ts
  • mcp-server/src/prd-tools.ts
  • package.json
  • test/callback-proxy-tests.ts
  • test/client-pool-test.ts
  • test/clients/custom-header-client.ts
  • test/clients/sse-client.ts
  • test/clients/stdio-client.ts
  • test/clients/streamable-http-client.ts
  • test/dynamic-api-url-test.ts
  • test/mcp-oauth-tests.ts
  • test/no-proxy-integration-test.ts
  • test/remote-auth-simple-test.ts
  • test/remote-auth-tests.ts
  • test/schema-tests.ts
  • test/stateless/session-id-integration.test.ts
  • test/test-geteffectiveprojectid.ts
  • test/test-health-check.ts
  • test/test-issue-description-patch.ts
  • test/test-list-group-members.ts
  • test/test-list-merge-requests.ts
  • test/test-list-project-members.ts
  • test/test-mr-diffs-filter.ts
  • test/test-mr-file-diffs.ts
  • test/test-oauth-proxy-rate-limit.ts
  • test/test-permission-mode.ts
  • test/test-search-code.ts
  • test/test-token-optimizations.ts
  • test/test-toolset-filtering.ts
  • test/test-update-issue-slim.ts
  • test/utils/mock-gitlab-server.ts
  • test/utils/safe-redirect-fetch.test.ts
  • test/utils/server-launcher.ts
  • utils/graphql-query.ts
  • utils/helpers.ts
  • utils/safe-redirect-fetch.ts
  • utils/url.ts
💤 Files with no reviewable changes: 12
  • test/remote-auth-tests.ts
  • test/utils/mock-gitlab-server.ts
  • .eslintrc.json
  • test/test-token-optimizations.ts
  • test/test-toolset-filtering.ts
  • test/test-issue-description-patch.ts
  • test/utils/server-launcher.ts
  • test/test-update-issue-slim.ts
  • test/test-search-code.ts
  • test/test-permission-mode.ts
  • test/schema-tests.ts
  • test/utils/safe-redirect-fetch.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 9
  • GitHub Check: integration-test
  • GitHub Check: code-quality
  • GitHub Check: docs-build
  • GitHub Check: test
  • GitHub Check: schema-tests
  • GitHub Check: Analyze (ruby)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
🧰 Additional context used
🪛 OpenGrep (1.30.1)
utils/graphql-query.ts

[ERROR] 135-135: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)

🔇 Additional comments: 28
package.json: 1

65-69: LGTM!

Also applies to: 93-93

.prettierignore: 1

14-152: LGTM!

utils/url.ts: 1

47-47: LGTM!

index.ts: 1

714-714: LGTM!

Also applies to: 9761-9761, 9955-9955

mcp-server/src/prd-tools.ts: 1

4-4: LGTM!

utils/graphql-query.ts: 1

135-135: LGTM! The static analysis hint is a false positive. mutationRegex.exec is RegExp.exec, not child_process.exec. The loop still reads lastIndex correctly.

utils/helpers.ts: 1

304-304: LGTM!

utils/safe-redirect-fetch.ts: 1

276-276: LGTM!

eslint.config.js: 1

8-8: 📐 Maintainability & Code Quality

JavaScript exclusion is intentional.

CONTRIBUTING.md defines ESLint as “TypeScript lint” and separately defines Prettier as covering JavaScript files. The prior ESLint configuration also ignored JavaScript files. No issue remains in this change.

test/callback-proxy-tests.ts: 1

131-131: LGTM!

test/client-pool-test.ts: 1

32-32: LGTM!

test/clients/custom-header-client.ts: 1

75-75: LGTM!

test/clients/sse-client.ts: 1

102-102: LGTM!

test/clients/stdio-client.ts: 1

125-125: LGTM!

test/clients/streamable-http-client.ts: 1

102-102: LGTM!

test/dynamic-api-url-test.ts: 1

35-35: LGTM!

Also applies to: 247-247

test/mcp-oauth-tests.ts: 1

107-107: LGTM!

Also applies to: 268-268, 785-785

test/no-proxy-integration-test.ts: 1

31-31: LGTM!

test/remote-auth-simple-test.ts: 1

77-77: LGTM!

Also applies to: 236-236

test/stateless/session-id-integration.test.ts: 1

41-41: LGTM!

test/test-geteffectiveprojectid.ts: 1

39-39: LGTM!

Also applies to: 344-344, 451-451, 545-545, 647-647, 788-788, 855-855

test/test-health-check.ts: 1

1-1: LGTM!

test/test-list-group-members.ts: 1

67-67: LGTM!

test/test-list-merge-requests.ts: 1

43-43: LGTM!

test/test-list-project-members.ts: 1

67-67: LGTM!

test/test-mr-diffs-filter.ts: 1

44-44: LGTM!

test/test-mr-file-diffs.ts: 1

44-44: LGTM!

Also applies to: 97-97

test/test-oauth-proxy-rate-limit.ts: 1

50-50: LGTM!

📝 Summary

Summary by CodeRabbit

  • Chores
    • Updated linting configuration and scripts.
    • Excluded additional unformatted files from automated formatting.
    • Cleaned up unused imports, variables, and test constants.
  • Tests
    • Updated test code to satisfy the revised linting rules; test behavior remains unchanged.

This pull request replaces the legacy ESLint configuration with a flat configuration, updates lint scripts and Prettier exclusions, and removes unused imports, variables, and bindings across application code and tests. Several test arrays now use const while remaining mutable.

Changes: Lint Configuration and Cleanup

Layer / File(s) Summary
ESLint and formatting configuration
.eslintrc.json, eslint.config.js, package.json, .prettierignore, utils/url.ts
The legacy ESLint configuration is removed and a flat configuration is added. The lint scripts and development dependencies are updated. .prettierignore gains exclusions, and utils/url.ts adds an ESLint suppression for its control-character pattern.
Application source cleanup
index.ts, mcp-server/src/prd-tools.ts, utils/graphql-query.ts, utils/helpers.ts, utils/safe-redirect-fetch.ts
Unused imports and a helper are removed. Unused bindings are adjusted, and two local bindings change from let to const.
Test and test-helper cleanup
test/*, test/clients/*, test/stateless/*, test/utils/*
Tests remove unused imports and constants, adjust catch clauses, and change server-array bindings to const. Schema imports are updated. Test helper code removes unused values.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 6f1d5

No actionable merge-blocking risk remains after verifying the lint configuration and cleanup changes.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 25 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the ESLint migration, Prettier ignore changes, lint fixes, validation results, and the intended CI enforcement outcome. It is directly related to the changeset.
Title check Passed The title clearly and concisely summarizes the main change: making lint and format checks pass so CI enforcement can be enabled.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 25 files. (3 skipped: 2 unsupported, 1 too large.)

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zereight
zereight merged commit c6cb5b3 into main Oct 14, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant