-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlint-staged.config.js
More file actions
35 lines (31 loc) · 987 Bytes
/
Copy pathlint-staged.config.js
File metadata and controls
35 lines (31 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// lint-staged.config.js
import path from "node:path";
/**
* Filters out files that are inside the 'api-client' directory.
* @param {string[]} filenames - The array of absolute file paths from lint-staged.
* @returns {string} A space-separated string of filenames to lint.
*/
const filterIgnoredFiles = (filenames) => {
const apiClientDir = path.resolve(
process.cwd(),
"apps",
"web",
"src",
"api-client",
);
const filesToLint = filenames.filter(
(file) => !file.startsWith(apiClientDir + path.sep),
);
// If no files are left after filtering, return an empty array to skip the command
if (filesToLint.length === 0) {
return [];
}
// Return the biome command with the filtered list of files
// Using quotes to handle filenames with spaces
return `biome check --write "${filesToLint.join('" "')}"`;
};
export default {
"**/*.{js,jsx,ts,tsx}": filterIgnoredFiles,
// Add other patterns if needed, for example:
// '**/*.{json,md}': filterIgnoredFiles,
};