-
-
Notifications
You must be signed in to change notification settings - Fork 753
/
Copy pathlint-staged.config.js
31 lines (30 loc) · 1.03 KB
/
lint-staged.config.js
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
const { ESLint } = require('eslint');
const removeIgnoredFiles = async (files) => {
const eslint = new ESLint();
const ignoredFiles = await Promise.all(
files.map((file) => eslint.isPathIgnored(file)),
);
const filteredFiles = files.filter((_, i) => !ignoredFiles[i]);
return filteredFiles.join(' ');
};
module.exports = {
'packages/!(volto)/**/*.{js,jsx,ts,tsx}': async (files) => {
const filesToLint = await removeIgnoredFiles(files);
return [
`eslint --max-warnings=0 ${filesToLint}`,
'pnpm prettier --single-quote --write',
];
},
'packages/volto/**/*.{js,jsx,ts,tsx}': [
'pnpm --filter @plone/volto lint:husky',
'pnpm --filter @plone/volto prettier:husky',
],
'packages/volto/src/**/*.{jsx, tsx}': ['pnpm --filter @plone/volto i18n'],
'packages/!(volto)/**/*.{css,less,scss}': ['pnpm stylelint --fix'],
'packages/volto/**/*.{css,less,scss}': [
'pnpm --filter @plone/volto stylelint --fix',
],
'packages/volto/**/*.overrides': [
'pnpm --filter @plone/volto stylelint --fix',
],
};