Skip to content

chore: linter eslint fix - #9088

Open
shivanee-p wants to merge 14 commits into
mainfrom
shivaneep-linter-eslint-fix
Open

chore: linter eslint fix#9088
shivanee-p wants to merge 14 commits into
mainfrom
shivaneep-linter-eslint-fix

Conversation

@shivanee-p

Copy link
Copy Markdown
Contributor

Restores the linter changed file detection and --strict mode (originally introduced in #8968 and reverted in #9081) while resolving the root causes of the linter failures in CI.

  • Updated bin/linter.mjs to use a namespace import to resolve ts.sys.fileExists errors under Node ESM
  • Consolidated package .eslintrc.json configs into the root .eslintrc.json and passed tsconfigRootDir to ESLint to eliminate lookup failures in subdirectories.
  • Restored getChangedFilesStrict() in bin/linter.mjs and configured node ./bin/linter.mjs --strict

Testing

  • Verified GIT_DIFF_ARG="HEAD^1" node ./bin/linter.mjs --strict runs cleanly locally.
  • Verified ESLint and tsc run against changed files in handwritten packages without resolution errors.

@shivanee-p
shivanee-p force-pushed the shivaneep-linter-eslint-fix branch 3 times, most recently from a9ffeca to b0da244 Compare August 4, 2026 23:37

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request updates the monorepo to require Node.js 22 across all packages, involving updates to CI configurations, release manifests, and package engine fields. It introduces a new 'spanner-driver' package, adds Firestore configuration files, and includes several improvements, such as adding strict mode support to the linter, fixing error handling in 'getChangedFilesStrict', and cleaning up ESLint configurations. The review feedback identified a bug in the linter's error handling, a duplicate entry in the ESLint configuration, and an inconsistent Node.js engine version in the new spanner-driver package.

I am having trouble creating individual review comments. Click here to see my feedback.

bin/linter.mjs (99-107)

high

In 'getChangedFilesStrict()', if 'err.status' is 1, the catch block does not throw an error and the function implicitly returns 'undefined'. This will cause a 'TypeError' when 'changedTsFiles.length' is accessed in 'run()'. Since the command being run is 'git diff --name-only' (not '--quiet'), any non-zero exit code indicates a failure and should be thrown. Additionally, the error message incorrectly references 'git diff --quiet' instead of the actual command run.

  } catch (err) {
    throw new Error(
      "Strict mode error: git diff " + gitDiffArg + " failed with exit code " + err.status + ".\n" +
      "Ensure that the git reference '" + gitDiffArg + "' exists locally and that you have fetched the required commits/branches.\n" +
      "Details: " + String(err.stderr || err.message || "").trim()
    );
  }

.eslintrc.json (67-68)

medium

There is a duplicate entry for 'handwritten/firestore/dev/test/gapic_firestore_admin_v1.ts' in the 'files' array. Removing the duplicate entry improves readability and maintainability.

        "handwritten/firestore/dev/test/gapic_firestore_admin_v1.ts"

handwritten/spanner-driver/package.json (59-61)

medium

The minimum Node.js version is specified as '>=18', but all other packages in this monorepo are being upgraded to '>=22' in this pull request. To maintain consistency across the repository, please update the engine requirement to '>=22'.

  "engines": {
    "node": ">=22"
  }

@shivanee-p
shivanee-p marked this pull request as ready for review August 4, 2026 23:39
@shivanee-p
shivanee-p requested review from a team as code owners August 4, 2026 23:39
@shivanee-p
shivanee-p force-pushed the shivaneep-linter-eslint-fix branch 4 times, most recently from 230737a to 74068d7 Compare August 4, 2026 23:56
@westarle

westarle commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

I like the change, let me know when it's ready to review!

Comment thread bin/linter.mjs

for (const ref of refsToTry) {
try {
const diffRef = ref.includes('..') ? ref : `${ref}...HEAD`;

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.

is this change needed for anything?

@shivanee-p
shivanee-p force-pushed the shivaneep-linter-eslint-fix branch from 70b24b7 to d4f51ed Compare August 7, 2026 02:40
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.

2 participants