forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint-staged.config.js
30 lines (21 loc) · 1.34 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
// @ts-check
const { configHelpers } = require('./packages/eslint-plugin/src/index');
const { prettierExtensions } = require('./scripts/prettier/prettier-helpers');
// remove leading . for consistency with prettierExtensions
const eslintExtensions = configHelpers.extensions.map(ext => ext.slice(1));
const nonEslintPrettierExtensions = prettierExtensions.filter(ext => !eslintExtensions.includes(ext));
// https://www.npmjs.com/package/lint-staged
module.exports = {
// Run eslint in fix mode followed by prettier
[`*.{${eslintExtensions.join(',')}}`]: ['node ./scripts/lint-staged/eslint', 'prettier --write'],
// Run prettier on non-eslintable files (ignores handled by .prettierignore)
[`*.{${nonEslintPrettierExtensions.join(',')}}`]: 'prettier --write',
'common/changes/*.json': 'node ./scripts/lint-staged/auto-convert-change-files',
'**/tslint.json': 'node ./scripts/lint-staged/no-tslint-json',
'**/package.json': 'node ./scripts/lint-staged/no-tslint-deps',
'packages/!(react-examples)/!(fluentui)/**/(docs|examples)/*.{ts,tsx,scss,md}':
'node ./scripts/lint-staged/no-old-example-paths',
'packages/!(react-examples)/!(fluentui)/**/*.doc.ts*': 'node ./scripts/lint-staged/no-old-example-paths',
'packages/{react,react-cards,react-focus}/src/components/__snapshots__/*':
'node ./scripts/lint-staged/no-old-snapshot-paths',
};