mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
feat: improve lint staged performance
This commit is contained in:
@ -1,7 +1,15 @@
|
||||
const path = require('path');
|
||||
|
||||
const buildEslintCommand = (filenames) =>
|
||||
`eslint --fix ${filenames.map((f) => path.relative(process.cwd(), f)).join(' ')} `;
|
||||
|
||||
const buildPrettierCommand = (filenames) =>
|
||||
`prettier --write ${filenames.map((f) => path.relative(process.cwd(), f)).join(' ')} `;
|
||||
|
||||
/** @type {import('lint-staged').Config} */
|
||||
module.exports = {
|
||||
'**/*.{ts,tsx,cts,mts}': (files) => files.map((file) => `eslint --fix ${file}`),
|
||||
'**/*.{js,jsx,cjs,mjs}': (files) => files.map((file) => `prettier --write ${file}`),
|
||||
'**/*.{yml,mdx}': (files) => files.map((file) => `prettier --write ${file}`),
|
||||
'**/*.{ts,tsx,cts,mts}': [buildEslintCommand],
|
||||
'**/*.{js,jsx,cjs,mjs}': [buildPrettierCommand],
|
||||
'**/*.{yml,mdx}': [buildPrettierCommand],
|
||||
'**/*/package.json': 'npm run precommit',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user