Skip to content

Commit 1875e86

Browse files
authored
chore: fix lint-staged failed when js/ts file staged (#9246)
* chore: fix lint-staged failed when js/ts file staged * feat: explicitly run without no more args * refactor: use lint staged js config file * chore: 🔥 * refactor: add mjs js format
1 parent d7173cb commit 1875e86

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

lint-staged.config.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
"*.rs": "rustfmt --edition 2021",
3+
"*.{ts,tsx,js,mjs}": "pnpm run format:js",
4+
"*.toml": "npx @taplo/cli format",
5+
"*.{ts,tsx,js,cts,cjs,mts,mjs}": [
6+
"pnpm run lint:js",
7+
// ignore staged file list; execute x without extra args
8+
() => "pnpm run x ae ci"
9+
],
10+
"package.json": "pnpm run check-dependency-version"
11+
};

package.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"build:viewer": "pnpm --filter \"@rspack/*\" build:viewer",
2222
"test:js": "pnpm -r run test",
2323
"format:rs": "cargo fmt --all",
24-
"format:js": "pnpm run format-ci:js --write",
24+
"format:js": "node ./node_modules/prettier/bin/prettier.cjs --write",
2525
"format-ci:js": "node ./node_modules/prettier/bin/prettier.cjs \"packages/**/src/**/*.{ts,tsx,js}\" \"crates/rspack_plugin_runtime/**/*.{ts,js}\" \"scripts/**/*.{cjs,mjs,js}\" \"x.mjs\" \"x\" --check",
2626
"format-ci:toml": "npx @taplo/cli format --check '.cargo/*.toml' './crates/**/Cargo.toml' './Cargo.toml'",
2727
"format:toml": "npx @taplo/cli format '.cargo/*.toml' './crates/**/Cargo.toml' './Cargo.toml'",
@@ -88,15 +88,5 @@
8888
8989
"rollup-plugin-dts": "patches/rollup-plugin-dts.patch"
9090
}
91-
},
92-
"lint-staged": {
93-
"*.rs": "rustfmt --edition 2021",
94-
"*.{ts,tsx,js}": "pnpm run format:js",
95-
"*.toml": "npx @taplo/cli format",
96-
"*.{ts,tsx,js,cts,cjs,mts,mjs}": [
97-
"pnpm run lint:js",
98-
"node ./x ae ci"
99-
],
100-
"package.json": "pnpm run check-dependency-version"
10191
}
102-
}
92+
}

0 commit comments

Comments
 (0)