-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
.lintstagedrc.js
31 lines (29 loc) · 970 Bytes
/
.lintstagedrc.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
30
31
const escape = require('shell-quote').quote;
const fs = require('fs');
const isWin = process.platform === 'win32';
const escapeFileNames = filenames =>
filenames
.filter(filename => fs.existsSync(filename))
.map(filename => `"${isWin ? filename : escape([filename])}"`)
.join(' ');
module.exports = {
'**/*{.css,.json,.md}': filenames => {
const escapedFileNames = escapeFileNames(filenames);
return [`prettier --write ${escapedFileNames}`];
},
'**/*{.ts,.tsx,.js,.jsx}': filenames => {
const escapedFileNames = escapeFileNames(filenames);
return [
`prettier --write ${escapedFileNames}`,
`eslint --fix ${escapedFileNames}`,
];
},
'jupyterlab_hdf/**/*.py': filenames => {
const escapedFileNames = escapeFileNames(filenames);
return [`black ${escapedFileNames}`];
},
'setup.py': filenames => {
const escapedFileNames = escapeFileNames(filenames);
return [`black ${escapedFileNames}`];
},
};