chore: tidying
This commit is contained in:
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -1,7 +1,9 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit"
|
||||
"source.fixAll": "explicit"
|
||||
},
|
||||
"eslint.validate": ["typescript", "typescriptreact", "javascript", "javascriptreact"],
|
||||
"javascript.preferences.importModuleSpecifier": "non-relative",
|
||||
|
@ -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',
|
||||
};
|
||||
|
Reference in New Issue
Block a user