Fix npm run eslintfix and enable ESLint caching Running eslintfix via Bazel (safe_bazelisk run //polygerrit-ui/app:lint_bin) failed with ESLint 9 because passing absolute target paths outside Bazel's runfiles directory was rejected as ignored, and Bazel runfiles are read-only. Update eslintfix and eslintfix:modified to execute eslint directly. Also add --cache to eslintfix and lint script definitions in package.json and add /.eslintcache to .gitignore. This reduces execution time for eslintfix and lint from ~25s down to ~0.8s (~30x speedup). Release-Notes: skip Change-Id: I39e9a8f391697e70b5deb1b029ed01ed0a16a371
diff --git a/.gitignore b/.gitignore index 2d146c8..cc71eb5 100644 --- a/.gitignore +++ b/.gitignore
@@ -13,6 +13,7 @@ /.aspect/ /.apt_generated /.apt_generated_tests +/.eslintcache /.bazel_path /.classpath /.factorypath
diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 7ea3e69..fe7c2be 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock
@@ -318,7 +318,7 @@ "recordedInputs": [ "REPO_MAPPING:aspect_rules_ts+,aspect_rules_ts aspect_rules_ts+", "REPO_MAPPING:aspect_rules_ts+,bazel_tools bazel_tools", - "FILE:@@//package.json f230bdb8c76c59a925ec0727a1decc727388d47d4b20d95b4e5bcf328edc0c79" + "FILE:@@//package.json 582559a124fbee5740e1c3a5b4167aa579a1deb338e413bd82f358940feae420" ], "generatedRepoSpecs": { "npm_typescript": {
diff --git a/package.json b/package.json index 97acc45..75a1a9f 100644 --- a/package.json +++ b/package.json
@@ -66,11 +66,11 @@ "test:single:coverage": "yarn --cwd=polygerrit-ui test:single:coverage", "safe_bazelisk": "if which bazelisk >/dev/null; then bazel_bin=bazelisk; else bazel_bin=bazel; fi && $bazel_bin", "eslint": "npm run safe_bazelisk test polygerrit-ui/app:lint_test", - "eslintfix": "npm run safe_bazelisk run polygerrit-ui/app:lint_bin -- -- --fix $(pwd)/polygerrit-ui/app", - "eslintfix:modified": "git diff --name-only --diff-filter=d | grep -E 'polygerrit-ui/app/.*\\.(js|ts)$' | sed 's|^polygerrit-ui/app/||' | xargs -r npm run safe_bazelisk run polygerrit-ui/app:lint_bin -- -- --fix", + "eslintfix": "eslint -c polygerrit-ui/app/eslint-bazel.config.js polygerrit-ui/app --fix --cache", + "eslintfix:modified": "git diff --name-only --diff-filter=d | grep -E 'polygerrit-ui/app/.*\\.(js|ts)$' | xargs -r eslint -c polygerrit-ui/app/eslint-bazel.config.js --fix", "litlint": "npm run safe_bazelisk run polygerrit-ui/app:lit_analysis", "litlintforCI": "lit-analyzer --strict --rules.no-unknown-property off --rules.no-unknown-tag-name off --rules.no-incompatible-type-binding off --rules.no-incompatible-property-type off --rules.no-invalid-tag-name off --rules.no-property-visibility-mismatch off --rules.no-unknown-attribute off **/elements/**/*.ts", - "lint": "eslint -c polygerrit-ui/app/eslint-bazel.config.js polygerrit-ui/app", + "lint": "eslint -c polygerrit-ui/app/eslint-bazel.config.js polygerrit-ui/app --cache", "gjf": "./tools/gjf.sh run" }, "repository": {