-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathlint-staged.config.js
More file actions
70 lines (64 loc) · 2.21 KB
/
lint-staged.config.js
File metadata and controls
70 lines (64 loc) · 2.21 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
module.exports = {
'**/*.{ts?(x),?(m)js}': (files) => {
const filteredFiles = files.filter((file) => {
// Exclude .vscode directory
if (file.includes('/.vscode/')) return false;
// Exclude quantic and create-atomic-template packages
if (file.includes('/packages/quantic/')) return false;
if (file.includes('/packages/create-atomic-template/')) return false;
if (file.includes('/packages/create-atomic-component/template/'))
return false;
if (file.includes('/packages/create-atomic-component-project/template/'))
return false;
// Exclude root deployment config
if (file.includes('/.deployment.config/')) return false;
// Exclude atomic package d.ts files
if (file.includes('/packages/atomic/') && file.endsWith('.d.ts'))
return false;
// Exclude documentation assets
if (
file.includes('/packages/documentation/') &&
file.includes('/assets/')
)
return false;
// Exclude headless coveo.analytics
if (
file.includes('/packages/headless/') &&
file.includes('/coveo.analytics/')
)
return false;
return true;
});
if (filteredFiles.length === 0) {
return 'echo "No files to lint"';
}
return [
`oxlint --fix ${filteredFiles.join(' ')}`,
`oxfmt ${filteredFiles.join(' ')}`,
];
},
'**/*.{json,css,html}': (files) => {
const filteredFiles = files.filter((file) => {
if (file.includes('/.vscode/')) return false;
if (file.includes('/packages/quantic/')) return false;
if (file.includes('/.deployment.config/')) return false;
if (file.endsWith('package-lock.json')) return false;
if (file.includes('/.storybook/') && file.endsWith('.html')) return false;
if (
file.includes('/packages/documentation/') &&
file.includes('/assets/')
)
return false;
return true;
});
if (filteredFiles.length === 0) {
return 'echo "No files to format"';
}
return `oxfmt ${filteredFiles.join(' ')}`;
},
'**/*.md': (files) => {
return `cspell --no-progress --show-suggestions --show-context --no-must-find-files ${files.join(
' '
)}`;
},
};