-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from Jam3/fix-lint-staged-with-dynamic-page
fix: lint-staged issue when having dynamic pages
- Loading branch information
Showing
3 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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 : escape([filename])}"`).join(' '); | ||
return [ | ||
`prettier --with-node-modules --ignore-path .prettierignore_staged --write ${escapedFileNames}`, | ||
`eslint --no-ignore --max-warnings=0 --fix ${filenames.map(f => `"${f}"`).join(' ')}`, | ||
`git add ${escapedFileNames}` | ||
]; | ||
}, | ||
'**/*.{json,md,mdx,css,html,yml,yaml,scss}': filenames => { | ||
const escapedFileNames = filenames.map(filename => `"${isWin ? filename : escape([filename])}"`).join(' '); | ||
return [ | ||
`prettier --with-node-modules --ignore-path .prettierignore_staged --write ${escapedFileNames}`, | ||
`git add ${escapedFileNames}` | ||
]; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters