-
Notifications
You must be signed in to change notification settings - Fork 16
/
lint-staged.config.mjs
21 lines (19 loc) · 1 KB
/
lint-staged.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import path from "path";
import url from "url";
const dirname = path.dirname(url.fileURLToPath(import.meta.url));
export default {
"*.{js,ts,jsx,tsx,cjs,mjs,json,html,xml,svg,css,scss,sass,md}": "cspell --no-progress --no-must-find-files",
"*.{js,ts,jsx,tsx,cjs,mjs}": "eslint --max-warnings 0 --fix",
"*": "prettier --write --ignore-unknown --log-level warn",
"src/**/*.{js,ts,jsx,tsx}": (paths) => {
const relativePaths = paths.map((filePath) =>
path.relative(dirname, filePath).split(path.sep).join(path.posix.sep)
);
// Running unit tests is the largest contributor to the speed of a commit.
// If you are running all of your validations in PR before merging then remove this and depend on PR checks.
// This is only useful if you are directly pushing code and not creating PRs.
return `jest --runInBand --bail --collectCoverageFrom '(${relativePaths.join(
"|"
)})' --coverage --findRelatedTests ${paths.join(" ")}`;
},
};