-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint-staged.config.mjs
28 lines (26 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
22
23
24
25
26
27
28
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
/**
* This is the base lint-staged rules config and just includes prettier by default.
* A good practice is to override this base configuration in each package and/or application
* where we are able to add customization depending on the nature of the project (eslint...).
*/
import { getEslintFixCmd } from './lint-staged.common.mjs';
/**
* @type {Record<string, (filenames: string[]) => string | string[] | Promise<string | string[]>>}
*/
const rules = {
'**/*.{js,jsx,ts,tsx,mjs,cjs}': (filenames) => {
return getEslintFixCmd({
cwd: dirname(fileURLToPath(import.meta.url)),
fix: true,
cache: true,
// when autofixing staged-files a good tip is to disable react-hooks/exhaustive-deps, cause
// a change here can potentially break things without proper visibility.
rules: ['react-hooks/exhaustive-deps: off'],
maxWarnings: 25,
files: filenames,
});
},
};
export default rules;