forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint-staged.config.js
24 lines (16 loc) · 993 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 { 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',
};