2021-07-01 17:10:35 -07:00
|
|
|
const escape = require('shell-quote').quote
|
|
|
|
|
|
|
|
/**
|
2021-07-01 17:13:56 -07:00
|
|
|
* Need this to fix a bug where we can't commit `pages/examples/[example].tsx`.
|
2021-07-01 17:10:35 -07:00
|
|
|
*
|
|
|
|
* <https://github.com/okonet/lint-staged/issues/676#issuecomment-574764713>
|
2021-07-01 17:13:56 -07:00
|
|
|
*
|
|
|
|
* 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.
|
2021-07-01 17:10:35 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
module.exports = {
|
2021-07-08 22:59:12 -07:00
|
|
|
'*.{ts,tsx,js,jsx,json,css,md}': filenames => [
|
|
|
|
...filenames.map(filename => `prettier --write "${escape([filename])}"`),
|
2021-07-01 17:10:35 -07:00
|
|
|
...filenames.map(filename => `git add "${filename}"`),
|
|
|
|
],
|
2021-07-08 22:59:12 -07:00
|
|
|
'*.{ts,tsx,js,jsx,json,css,md}': ['eslint --fix'],
|
2021-07-01 17:10:35 -07:00
|
|
|
}
|