Skip to content

Commit 1185062

Browse files
committed
chore: 优化工程配置
1 parent 484fed1 commit 1185062

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

.eslintrc.cjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,28 @@ module.exports = defineConfig({
1010
},
1111

1212
overrides: [
13+
{
14+
files: ['*.cjs'],
15+
extends: [
16+
//
17+
'eslint:recommended',
18+
],
19+
rules: {
20+
'prettier/prettier': 'error',
21+
},
22+
},
1323
{
1424
files: ['*.mjs'],
1525
parserOptions: {
1626
sourceType: 'module',
1727
},
28+
extends: [
29+
//
30+
'eslint:recommended',
31+
],
32+
rules: {
33+
'prettier/prettier': 'error',
34+
},
1835
},
1936
{
2037
files: ['*.ts'],

.lintstagedrc.cjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2-
'*.ts': 'eslint --fix',
3-
'*': 'prettier --ignore-unknown --write',
2+
'(src|test)/*.{cjs,mjs,ts,tsx}': 'eslint --fix',
3+
'*.{cjs,mjs,ts,tsx,html,css,scss}': 'prettier --write',
4+
'(package|tsconfig*).json': 'prettier --write',
45
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "✈ 类型安全的扁平化的 try-catch,支持同步函数、回调函数和 PromiseLike",
55
"scripts": {
66
"prepare": "husky install",
7-
"lint": "eslint src/**/*.ts test/**/*.ts && tsc --project tsconfig.json --noEmit",
7+
"lint": "eslint --ext=.cjs,.mjs,.ts,.tsx src/ test/ && tsc --project tsconfig.json --noEmit",
88
"test": "vitest run",
99
"test:coverage": "vitest run --coverage",
1010
"build:types": "rm -rf dist-dts && tsc --project tsconfig.types.json",

0 commit comments

Comments
 (0)