chore: tidying

This commit is contained in:
Lucas Smith
2024-03-18 02:44:39 +00:00
parent b972056c8f
commit de9c9f4aab
2 changed files with 8 additions and 6 deletions

View File

@ -1,15 +1,15 @@
const path = require('path');
const buildEslintCommand = (filenames) =>
const eslint = (filenames) =>
`eslint --fix ${filenames.map((f) => `"${path.relative(process.cwd(), f)}"`).join(' ')}`;
const buildPrettierCommand = (filenames) =>
const prettier = (filenames) =>
`prettier --write ${filenames.map((f) => `"${path.relative(process.cwd(), f)}"`).join(' ')}`;
/** @type {import('lint-staged').Config} */
module.exports = {
'**/*.{ts,tsx,cts,mts}': [buildEslintCommand, buildPrettierCommand],
'**/*.{js,jsx,cjs,mjs}': [buildPrettierCommand],
'**/*.{yml,mdx}': [buildPrettierCommand],
'**/*.{ts,tsx,cts,mts}': [eslint, prettier],
'**/*.{js,jsx,cjs,mjs}': [prettier],
'**/*.{yml,mdx}': [prettier],
'**/*/package.json': 'npm run precommit',
};