Skip to content

Commit eec361e

Browse files
committed
fix: lint staged config
1 parent 4f680b1 commit eec361e

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
npx lint-staged
1+
npx lint-staged --config lint-staged.config.js

lint-staged.config.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
module.exports = {
2-
'src/**/*.(ts|tsx)': () => 'next lint',
3-
'src/**/*.(ts|tsx)': () => 'tsc --noEmit',
4-
'src/**/*.(html|css|scss|js|jsx|ts|tsx|mdx)': (filenames) => [
5-
`prettier --write ${filenames.join(' ')} --cache`
6-
]
1+
// @ts-nocheck
2+
/* eslint-disable import/no-anonymous-default-export */
3+
4+
import path from 'node:path';
5+
6+
const tsc = () => 'tsc --noEmit';
7+
8+
const eslint = (filenames) =>
9+
`next lint --fix --file ${filenames
10+
.map((f) => path.relative(process.cwd(), f))
11+
.join(' --file ')}`;
12+
13+
const prettier = (filenames) =>
14+
`prettier --write ${filenames.map((f) => path.relative(process.cwd(), f)).join(' ')} --cache`;
15+
16+
export default {
17+
'*.{ts,tsx}': [tsc],
18+
'*.{js,jsx,ts,tsx}': [eslint],
19+
'*.{html,css,scss,js,jsx,cjs,mjs,ts,tsx,mdx}': [prettier]
720
};

0 commit comments

Comments
 (0)