Skip to content

Commit 7b37a5c

Browse files
Feat/lint (#17897)
1 parent 0172bb4 commit 7b37a5c

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed

packages/taro-cli/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
templates/*
22
!templates/default
33
templates/default/.*
4+
!templates/default/.husky
45
!templates/global-config
56
!templates/plugin-compile
67
!src/__tests__/env/.*
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
3+
# 运行 commitlint 检查 commit message
4+
npx --no -- commitlint --edit ${1}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ["@commitlint/config-conventional"] };

packages/taro-cli/templates/default/package.json.tmpl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"framework": "{{ framework }}"
1111
},
1212
"scripts": {
13+
"prepare": "husky",
1314
"new": "taro new",
1415
"build:weapp": "taro build --type weapp",
1516
"build:swan": "taro build --type swan",
@@ -75,14 +76,19 @@
7576
"solid-js": "^1.8.16"{{/if}}
7677
},{{#if (includes "Webpack5" s=compiler)}}
7778
"devDependencies": {
79+
"@tarojs/plugin-generator": "{{ version }}",
80+
"@commitlint/cli": "^19.8.1",
81+
"@commitlint/config-conventional": "^19.8.1",
82+
"lint-staged": "^16.1.2",
83+
"husky": "^9.1.7",
84+
"stylelint-config-standard": "^38.0.0",
7885
"@babel/core": "^7.24.4",
7986
"@tarojs/cli": "{{ version }}",
8087
"@babel/plugin-transform-class-properties": "7.25.9",
8188
"@types/webpack-env": "^1.13.6",{{#if (includes "React" "Preact" s=framework)}}
8289
"@types/react": "^18.0.0",{{/if}}{{#if (eq compiler "Webpack5") }}
8390
"webpack": "5.91.0",
8491
"@tarojs/taro-loader": "{{ version }}",
85-
"@tarojs/plugin-generator": "{{ version }}",
8692
"@tarojs/webpack5-runner": "{{ version }}",{{/if}}{{#if (eq css "Sass") }}
8793
"sass": "^1.75.0",{{/if}}{{#if (eq css "Less") }}
8894
"less": "^4.2.0",{{/if}}{{#if (eq css "Stylus") }}
@@ -113,6 +119,11 @@
113119
}{{/if}}{{#if (eq compiler "Vite") }}
114120
"devDependencies": {
115121
"@tarojs/plugin-generator": "{{ version }}",
122+
"@commitlint/cli": "^19.8.1",
123+
"@commitlint/config-conventional": "^19.8.1",
124+
"lint-staged": "^16.1.2",
125+
"husky": "^9.1.7",
126+
"stylelint-config-standard": "^38.0.0",
116127
"@babel/core": "^7.24.4",
117128
"@babel/plugin-transform-class-properties": "7.25.9",
118129
"@tarojs/cli": "{{ version }}",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/** @type {import('stylelint').Config} */
2+
export default {
3+
extends: "stylelint-config-standard",
4+
};

0 commit comments

Comments
 (0)