mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
20 lines
548 B
JavaScript
20 lines
548 B
JavaScript
const escape = require("shell-quote").quote;
|
|
|
|
module.exports = {
|
|
"*.{json,css,md}": escapeFileNames(["prettier --write", "git add"]),
|
|
"*.js": escapeFileNames(["eslint", "prettier --write", "git add"])
|
|
};
|
|
|
|
function escapeFileNames(commands) {
|
|
return filenames => {
|
|
const allFiles = filenames.join(" ");
|
|
const allFilesEscaped = filenames
|
|
.map(filename => `"${escape([filename])}"`)
|
|
.join(" ");
|
|
return commands.map(
|
|
command =>
|
|
`${command} ${command === "eslint" ? allFiles : allFilesEscaped}`
|
|
);
|
|
};
|
|
}
|