forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint-staged.config.js
26 lines (22 loc) · 987 Bytes
/
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
// @ts-check
const { prettierSupportedFileExtensionsByContext } = require('@fluentui/scripts-prettier');
const commands = {
format: 'prettier --write',
/**
* Run eslint in fix mode for applicable files followed by prettier.
* The eslint wrapper handles filtering which files should be linted, since we need to both:
* - respect ignore files (which eslint doesn't do by default when passed a specific file path)
* - match the set of files that are linted by the package's normal `lint` command
*/
lint: 'node ./scripts/lint-staged/src/eslint',
};
const nonJsExtensions = [
prettierSupportedFileExtensionsByContext.stylesheets,
prettierSupportedFileExtensionsByContext.markdown,
prettierSupportedFileExtensionsByContext.others,
].flat();
// https://www.npmjs.com/package/lint-staged
module.exports = {
[`**/*.{${nonJsExtensions}}`]: [commands.format],
[`**/*.{${prettierSupportedFileExtensionsByContext.js}}`]: [/* commands.format, */ commands.lint],
};