-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path.lintstagedrc.mjs
More file actions
31 lines (29 loc) · 897 Bytes
/
.lintstagedrc.mjs
File metadata and controls
31 lines (29 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import fs from 'fs';
import path from 'path';
const perPackage = (resolver) => (files) => {
return Array.from(
files.reduce((packages, file) => {
let directory = path.dirname(file);
while (directory && directory !== process.cwd()) {
if (
fs.existsSync(path.join(directory, 'package.json')) &&
!directory.endsWith('apps/wallet/electron')
) {
packages.add(resolver(directory, file));
break;
}
const parent = path.dirname(directory);
if (parent === directory) break;
directory = parent;
}
return packages;
}, new Set()),
);
};
export default {
'*': 'prettier --ignore-unknown --write',
'**/*.{js,jsx,ts,tsx}': 'eslint --fix',
'**/*.{ts,tsx}': perPackage((directory) => {
return `npm run type-check --workspace ${path.relative(process.cwd(), directory)}`;
}),
};