Skip to content

Commit 38a88b3

Browse files
authored
chore: fix eslint config lookup in formatting hooks (#15516)
Add `--flag v10_config_lookup_from_file` to eslint ([docs here](https://eslint.org/docs/latest/flags/#active-flags)) in lint-staged and Claude Code post-write hook. This makes eslint find the nearest `eslint.config.js` from the file being linted instead of cwd, so test files correctly use `test/eslint.config.js` with perfectionist disabled. Previously, when it attempted to format a file in the test directory, it ignored the `test/eslint.config.js` and used the root `eslint.config.js` instead. This also upgrades the eslint version, as that flag was added recently.
1 parent 6216f56 commit 38a88b3

8 files changed

Lines changed: 333 additions & 159 deletions

File tree

.claude/hooks/post-write-format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ case "$FILE" in
3333
fi
3434
;;
3535
*.js|*.jsx|*.ts|*.tsx)
36-
pnpm eslint --cache --fix "$FILE" >/dev/null 2>&1
36+
pnpm eslint --flag v10_config_lookup_from_file --cache --fix "$FILE" >/dev/null 2>&1
3737
pnpm prettier --write "$FILE" >/dev/null 2>&1
3838
;;
3939
esac

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"**/package.json": "sort-package-json",
148148
"*.{md,mdx,yml,json}": "prettier --write",
149149
"*.{js,jsx,ts,tsx}": [
150-
"eslint --cache --fix",
150+
"eslint --flag v10_config_lookup_from_file --cache --fix",
151151
"prettier --write"
152152
],
153153
"templates/**/pnpm-lock.yaml": "pnpm runts scripts/remove-template-lock-files.ts",
@@ -184,7 +184,7 @@
184184
"drizzle-kit": "0.31.7",
185185
"drizzle-orm": "0.44.7",
186186
"escape-html": "^1.0.3",
187-
"eslint": "9.22.0",
187+
"eslint": "9.39.2",
188188
"execa": "5.1.1",
189189
"form-data": "3.0.4",
190190
"fs-extra": "10.1.0",

packages/eslint-config/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
},
2626
"dependencies": {
2727
"@eslint-react/eslint-plugin": "1.31.0",
28-
"@eslint/js": "9.22.0",
28+
"@eslint/js": "9.39.2",
2929
"@payloadcms/eslint-plugin": "workspace:*",
3030
"@types/eslint": "9.6.1",
3131
"@typescript-eslint/parser": "8.26.1",
3232
"@vitest/eslint-plugin": "1.5.4",
33-
"eslint": "9.22.0",
33+
"eslint": "9.39.2",
3434
"eslint-config-prettier": "10.1.1",
3535
"eslint-plugin-import-x": "4.6.1",
3636
"eslint-plugin-jsx-a11y": "6.10.2",

packages/eslint-plugin/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
},
2626
"dependencies": {
2727
"@eslint-react/eslint-plugin": "1.31.0",
28-
"@eslint/js": "9.22.0",
28+
"@eslint/js": "9.39.2",
2929
"@types/eslint": "9.6.1",
3030
"@typescript-eslint/parser": "8.26.1",
3131
"@vitest/eslint-plugin": "1.5.4",
32-
"eslint": "9.22.0",
32+
"eslint": "9.39.2",
3333
"eslint-config-prettier": "10.1.1",
3434
"eslint-plugin-import-x": "4.6.1",
3535
"eslint-plugin-jsx-a11y": "6.10.2",

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"**/package.json": "sort-package-json",
104104
"*.{md,mdx,yml,json}": "prettier --write",
105105
"*.{js,jsx,ts,tsx}": [
106-
"eslint --cache --fix",
106+
"eslint --flag v10_config_lookup_from_file --cache --fix",
107107
"prettier --write"
108108
]
109109
},

packages/richtext-lexical/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@
362362
"**/package.json": "sort-package-json",
363363
"*.{md,mdx,yml,json}": "prettier --write",
364364
"*.{js,jsx,ts,tsx}": [
365-
"eslint --cache --fix",
365+
"eslint --flag v10_config_lookup_from_file --cache --fix",
366366
"prettier --write"
367367
]
368368
},

pnpm-lock.yaml

Lines changed: 323 additions & 149 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"**/package.json": "sort-package-json",
1616
"*.{md,mdx,yml,json}": "prettier --write",
1717
"*.{js,jsx,ts,tsx}": [
18-
"eslint --cache --fix",
18+
"eslint --flag v10_config_lookup_from_file --cache --fix",
1919
"prettier --write"
2020
],
2121
"templates/website/**/*": "sh -c \"cd templates/website; pnpm install --ignore-workspace --frozen-lockfile; pnpm run lint --fix\"",

0 commit comments

Comments
 (0)