forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint-staged.config.js
24 lines (21 loc) · 945 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
// @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/eslint',
};
// https://www.npmjs.com/package/lint-staged
module.exports = {
[`**/*.{${[].concat(
prettierSupportedFileExtensionsByContext.stylesheets,
prettierSupportedFileExtensionsByContext.markdown,
prettierSupportedFileExtensionsByContext.others,
)}}`]: [commands.format],
[`**/*.{${prettierSupportedFileExtensionsByContext.js}}`]: [commands.format, commands.lint],
};