forked from ianstormtaylor/slate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.lintstagedrc.js
29 lines (27 loc) · 936 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
const escape = require('shell-quote').quote
/**
* Need this to fix a bug where we can't commit this:
*
* `pages/examples/[example].tsx`.
*
* because of the square brackets `[` and `]`.
*
* <https://github.com/okonet/lint-staged/issues/676#issuecomment-574764713>
*
* NOTE:
*
* We can remove this entire file if/when we upgrade to Prettier 2+ where this
* is no longer necessary according to the `lint-staged` issue shown above.
*
* Currently, the same configuration without the escaping of the filename
* still exists in `package.json` but this takes precedence over that.
*
* Once this file is removed, `package.json` configuration will be used.
*/
module.exports = {
'*.{ts,tsx,js,jsx,json,css,md}': filenames => [
...filenames.map(filename => `prettier --write "${escape([filename])}"`),
...filenames.map(filename => `git add "${filename}"`),
],
'*.{ts,tsx,js,jsx,json,css,md}': ['eslint --fix'],
}