-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathnano-staged.js
More file actions
26 lines (22 loc) · 983 Bytes
/
nano-staged.js
File metadata and controls
26 lines (22 loc) · 983 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
// @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://github.com/usmanyunusov/nano-staged
module.exports = {
[`**/*.{${nonJsExtensions}}`]: [commands.format],
[`**/*.{${prettierSupportedFileExtensionsByContext.js}}`]: [commands.format, commands.lint],
};