Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

lint-staged.config.js

31 lines1.2 KB

1// ESLint ran out of memory on a commit of more than about 100 files, so
2// staged files are linted in chunks, one ESLint process each. lint-staged
3// splits each command without a shell or escape sequences, so plain double
4// quotes keep Windows backslashes intact.
5const chunkSize = 40
6​
7export default {
8 // The oracle rules, without inline directives. The script lints the oracle
9 // files that each staged test or support module affects, so every module
10 // that an oracle can import is passed. It selects the oracle files itself.
11 '*.{ts,tsx,js,mjs}': (files) => {
12 const commands = []
13 for (let start = 0; start < files.length; start += chunkSize) {
14 const chunk = files.slice(start, start + chunkSize)
15 commands.push(
16 `node scripts/agent-lint-feedback.mjs ${chunk.map((file) => `"${file}"`).join(` `)}`,
17 )
18 }
19 return commands
20 },
21 '*.{ts,tsx}': (files) => {
22 const commands = []
23 for (let start = 0; start < files.length; start += chunkSize) {
24 const chunk = files.slice(start, start + chunkSize)
25 commands.push(
26 `eslint --fix ${chunk.map((file) => `"${file}"`).join(` `)}`,
27 )
28 }
29 return commands
30 },