Repository navigation
feat(lint): enforce and clean unused dependencies across stack - #1001
Merged
Merged
Conversation
- Enforce Go module dependency cleanliness with `go mod tidy -diff` check in pre-commit hooks and GitHub Actions CI. - Enforce Buildifier unused-variable lint checks (`-lint=warn -warnings=unused-variable`) in pre-commit and CI. - Clean unused variable in `import.bzl` repository extension (`_ctx`). - Clean unused parameters in Python release and PR review tools (`_build_gh_release_cmd`, `publish_via_gh_cli`, and `_call_api_with_gh`). TAG=agy CONV=22009166-566e-4d4f-ace4-c924d7d32241
There was a problem hiding this comment.
Code Review
This pull request adds unused-variable warnings to the Bazel buildifier pre-commit hook, introduces a Go module dependency check, resolves unused variable warnings in Starlark and Python files, and removes an unused 'force' parameter from the GitHub release client. A critical issue was identified in the pre-commit hook where 'go mod tidy -diff' is used, which is not supported by standard Go toolchains and will cause the check to fail; a workaround using 'git diff' with temporary backups of 'go.mod' and 'go.sum' was suggested.
- Add `eslint-plugin-unused-imports` to `cmd/ui/package.json` devDependencies. - Configure `unused-imports/no-unused-imports: 'error'` in `cmd/ui/eslint.config.js`. - Clean unused `_period` variable assignment in `ResourceDashboard` constructor effect. TAG=agy CONV=22009166-566e-4d4f-ace4-c924d7d32241
VLukiantsev
marked this pull request as ready for review
September 28, 2026 12:43
VLukiantsev
enabled auto-merge
September 28, 2026 12:43
AntonTyb
approved these changes
Sep 28, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Enforces package- and code-level unused dependency checks across the stack (Go module dependencies via
go mod tidy -diff, Bazel unused variables via Buildifier linter warnings, TypeScript unused imports viaeslint-plugin-unused-imports) and cleans up dead parameters/variables across Go, Bazel, TypeScript, and Python.Motivation & Context
Unused dependencies and dead parameters/variables degrade maintainability, clutter signatures, and can mask configuration rot. While
go.modwas already clean, neither pre-commit hooks nor CI verified thatgo mod tidyproduced no diffs. Similarly, Buildifier previously ran only in format-check mode (-mode=check), ignoring linter warnings like unused variables, and ESLint lacked automated unused import enforcement. This PR adds automated enforcement gates across all primary languages while cleaning existing dead variables and arguments.Key Changes
go mod tidy -diffcheck to.githooks/pre-commitand.github/workflows/lint.yml.-lint=warn -warnings=unused-variableto Buildifier in.githooks/pre-commitand.github/workflows/lint.yml; cleaned unusedctxparameter in import.bzl (_repo_import_impl).eslint-plugin-unused-importsincmd/ui/package.json; enabled'unused-imports/no-unused-imports': 'error'incmd/ui/eslint.config.js; cleaned dead_periodvariable assignment in cmd/ui/app/resource_dashboard/resource_dashboard.ts.forceparameter from_build_gh_release_cmdandpublish_via_gh_cliin tools/release/github_release_client.py and callers in tools/release/publish_release.py; prefixed unuseduser_agentin_call_api_with_ghin tools/pr_review/github_utils.py.cmd/ui/package.json(@angular/animationsand@angular/compiler); verified that both are required at build-time by@angular/materialand@angular/compiler-cli, preserving them intact.Assumptions
Verification & Testing
bazel test //tools/release/... //tools/pr_review/...(16 of 16 passed cleanly).bazel build //cmd/ui:ui_image_tarball(Docker container build completed successfully).npm run lintandnpm run format:checkincmd/ui(passed cleanly).go mod tidy -diff(clean, zero diffs).buildifier -lint=warn -warnings=unused-variable -mode=checkacross all repo Bazel/bzl files (passed cleanly).ruff checkandruff format --checkon touched Python files (passed cleanly)../.githooks/pre-commit(all checks passed cleanly)../tools/analyze_diff_size.py --base-ref origin/main(well below thresholds).Related Issues / Bugs
N/A
TAG=agy
CONV=22009166-566e-4d4f-ace4-c924d7d32241