chore: linter eslint fix - #9088
Conversation
a9ffeca to
b0da244
Compare
There was a problem hiding this comment.
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)
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)
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)
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"
}
230737a to
74068d7
Compare
|
I like the change, let me know when it's ready to review! |
|
|
||
| for (const ref of refsToTry) { | ||
| try { | ||
| const diffRef = ref.includes('..') ? ref : `${ref}...HEAD`; |
There was a problem hiding this comment.
is this change needed for anything?
…files modified on base branch
70b24b7 to
d4f51ed
Compare
Restores the linter changed file detection and
--strictmode (originally introduced in #8968 and reverted in #9081) while resolving the root causes of the linter failures in CI.bin/linter.mjsto use a namespace import to resolvets.sys.fileExistserrors under Node ESM.eslintrc.jsonconfigs into the root.eslintrc.jsonand passedtsconfigRootDirto ESLint to eliminate lookup failures in subdirectories.getChangedFilesStrict()inbin/linter.mjsand configurednode ./bin/linter.mjs --strictTesting
GIT_DIFF_ARG="HEAD^1" node ./bin/linter.mjs --strictruns cleanly locally.tscrun against changed files in handwritten packages without resolution errors.