-
Notifications
You must be signed in to change notification settings - Fork 9.1k
chore(types): reduce any usage with safety tooling + 7-batch phase 1 #2208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Gravirei
wants to merge
15
commits into
Gitlawb:main
Choose a base branch
from
Gravirei:fix/reduce-any-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d621a78
chore(types): add any-usage baseline + lint budget gate (Phase 0)
Gravirei 2be7ad3
chore(types): narrow any in 6 small src files (Phase 1, batch 1)
Gravirei edbe4b7
chore(types): narrow any in WebSearchTool + adapters (Phase 1, batch 2)
Gravirei 999b4c6
chore(types): narrow any in 6 mid-size src files (Phase 1, batch 3)
Gravirei 0f66f18
fix(types): correct BetaContentBlock cast in messages.ts (Phase 1 fix)
Gravirei 75f3e25
chore(types): narrow any in 5 dense src + 1 script (Phase 1, batch 4)
Gravirei 5d30a76
chore(types): remove 3 eslint-disable no-explicit-any suppressions
Gravirei 5181904
chore(types): refresh any-usage baseline
Gravirei 0738ee9
fix(types): address PR review feedback on any-reduction tooling
Gravirei 42f79d1
chore(types): narrow any in src/grpc/server.ts (5 warnings)
Gravirei 6bd765d
chore(types): narrow any in src/utils/knowledgeGraph.ts (18 warnings)
Gravirei 706d988
chore(types): narrow SDK tool() generic and handler signature (12 war…
Gravirei 2880043
fix(types): address PR feedback on SDK + grpc type hardening
Gravirei f5fa12f
fix(types): address 6 reviewer findings on PR #2208
Gravirei cd308fa
chore(types): refresh any-usage baseline after upstream rebase
Gravirei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| // Minimal flat config — only the rule we need to track `any` usage. | ||
| // Part of the phased `any`-reduction work landing on fix/reduce-any-types. | ||
| // | ||
| // Note: the repo has many existing `// eslint-disable custom-rules/<name>` | ||
| // comments referencing rules from a previous (now-removed) custom plugin. | ||
| // We register a stub `custom-rules` plugin whose rules are all "off"; this | ||
| // makes the comments valid so eslint doesn't error on unknown rule names. | ||
| import tseslint from "@typescript-eslint/eslint-plugin"; | ||
| import tsparser from "@typescript-eslint/parser"; | ||
|
|
||
| const DEPRECATED_CUSTOM_RULE_NAMES = [ | ||
| "bootstrap-isolation", | ||
| "no-cross-platform-process-issues", | ||
| "no-direct-json-operations", | ||
| "no-direct-ps-commands", | ||
| "no-lookbehind-regex", | ||
| "no-process-cwd", | ||
| "no-process-env-top-level", | ||
| "no-process-exit", | ||
| "no-sync-fs", | ||
| "no-top-level-dynamic-import", | ||
| "no-top-level-side-effects", | ||
| "prefer-use-keybindings", | ||
| "prefer-use-terminal-size", | ||
| "prompt-spacing", | ||
| "require-bun-typeof-guard", | ||
| "require-tool-match-name", | ||
| "safe-env-boolean-check", | ||
| ]; | ||
|
|
||
| // Stub plugin: each rule is a no-op listener so eslint resolves the name | ||
| // but does nothing. | ||
| const stubRules = Object.fromEntries( | ||
| DEPRECATED_CUSTOM_RULE_NAMES.map((name) => [ | ||
| name, | ||
| { | ||
| meta: { schema: [], deprecated: true }, | ||
| create() { | ||
| return {}; | ||
| }, | ||
| }, | ||
| ]), | ||
| ); | ||
|
|
||
| /** @type {import("eslint").ESLint.Plugin} */ | ||
| const customRulesPlugin = { | ||
| rules: stubRules, | ||
| }; | ||
|
|
||
| // Stub plugin for legacy `eslint-plugin-n/*` references in source comments. | ||
| const eslintPluginNPlugin = { | ||
| rules: { | ||
| "no-unsupported-features/node-builtins": { | ||
| meta: { schema: [], deprecated: true }, | ||
| create() { | ||
| return {}; | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| // Stub plugin for legacy `react-hooks/*` references in source comments. | ||
| const reactHooksPlugin = { | ||
| rules: { | ||
| "exhaustive-deps": { | ||
| meta: { schema: [], deprecated: true }, | ||
| create() { | ||
| return {}; | ||
| }, | ||
| }, | ||
| "rules-of-hooks": { | ||
| meta: { schema: [], deprecated: true }, | ||
| create() { | ||
| return {}; | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default [ | ||
| { | ||
| ignores: [ | ||
| "dist/**", | ||
| "node_modules/**", | ||
| "vendor/**", | ||
| "web/**", | ||
| "vscode-extension/**", | ||
| "coverage/**", | ||
| "reports/**", | ||
| ], | ||
| }, | ||
| { | ||
| files: ["src/**/*.{ts,tsx}", "tests/**/*.{ts,tsx}", "scripts/**/*.ts"], | ||
| languageOptions: { | ||
| parser: tsparser, | ||
| parserOptions: { | ||
| ecmaVersion: 2023, | ||
| sourceType: "module", | ||
| ecmaFeatures: { jsx: true }, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| "@typescript-eslint": tseslint, | ||
| "custom-rules": customRulesPlugin, | ||
| "eslint-plugin-n": eslintPluginNPlugin, | ||
| "react-hooks": reactHooksPlugin, | ||
| }, | ||
| linterOptions: { | ||
| // Source has many `// eslint-disable` comments that may now refer to | ||
| // rules not enabled here; don't fail on unused directives. | ||
| reportUnusedDisableDirectives: "off", | ||
| }, | ||
| rules: { | ||
| // Flags both `: any` annotations and `as any` casts. | ||
| // warn (not error) so existing code keeps building while we | ||
| // surface counts and reduce incrementally. | ||
| "@typescript-eslint/no-explicit-any": "warn", | ||
| }, | ||
| }, | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "total": 779, | ||
| "generatedAt": "2026-09-06T02:24:17.929Z" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.