-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint-staged.config.js
29 lines (26 loc) · 976 Bytes
/
lint-staged.config.js
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
const escape = require('shell-quote').quote;
const isWin = process.platform === 'win32';
module.exports = {
'**/*.{js,jsx,ts,tsx}': (filenames) => {
const escapedFileNames = filenames
.map((filename) => `"${isWin ? filename : [filename]}"`)
.join(' ');
return [
`prettier --write ${escapedFileNames}`,
`npx eslint ${escapedFileNames} --fix`,
`git add ${escapedFileNames}`,
];
},
'**/*.{css,scss}': (filenames) => {
const escapedFileNames = filenames
.map((filename) => `"${isWin ? filename : escape([filename])}"`)
.join(' ');
return [`prettier --write ${escapedFileNames}`, `git add ${escapedFileNames}`];
},
// '**/*.{json,md,mdx,html,yml,yaml}': (filenames) => {
// const escapedFileNames = filenames
// .map((filename) => `"${isWin ? filename : escape([filename])}"`)
// .join(' ');
// return [`prettier --write ${escapedFileNames}`, `git add ${escapedFileNames}`];
// },
};