2020-01-22 15:13:00 +01:00
|
|
|
const { CLIEngine } = require("eslint");
|
|
|
|
|
|
|
|
// see https://github.com/okonet/lint-staged#how-can-i-ignore-files-from-eslintignore-
|
2020-11-05 18:06:18 +01:00
|
|
|
// for explanation
|
2020-01-22 15:13:00 +01:00
|
|
|
const cli = new CLIEngine({});
|
|
|
|
|
|
|
|
module.exports = {
|
2020-01-29 11:26:40 +01:00
|
|
|
"*.{js,ts,tsx}": files => {
|
2020-01-22 15:13:00 +01:00
|
|
|
return (
|
2020-02-05 17:41:14 +01:00
|
|
|
"eslint --max-warnings=0 --fix " + files.filter(file => !cli.isPathIgnored(file)).join(" ")
|
2020-01-22 15:13:00 +01:00
|
|
|
);
|
|
|
|
},
|
2020-02-02 19:04:35 +01:00
|
|
|
"*.{css,scss,json,md,html,yml}": ["prettier --write"],
|
2020-01-22 15:13:00 +01:00
|
|
|
};
|