-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add lint-staged and husky to package.json #741
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lint-staged | ||
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -40,7 +40,8 @@ | |||||||||||||||||||
"prepublishOnly": "npm run compile && np --yolo --no-publish", | ||||||||||||||||||||
"postpublish": "tnpm sync rc-menu", | ||||||||||||||||||||
"start": "dumi dev", | ||||||||||||||||||||
"test": "rc-test" | ||||||||||||||||||||
"test": "rc-test", | ||||||||||||||||||||
"prepare": "husky && dumi setup" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"dependencies": { | ||||||||||||||||||||
"@babel/runtime": "^7.10.1", | ||||||||||||||||||||
|
@@ -66,7 +67,9 @@ | |||||||||||||||||||
"eslint-plugin-unicorn": "^51.0.1", | ||||||||||||||||||||
"father": "^4.0.0", | ||||||||||||||||||||
"gh-pages": "^6.1.0", | ||||||||||||||||||||
"husky": "^9.1.6", | ||||||||||||||||||||
"less": "^4.1.3", | ||||||||||||||||||||
"lint-staged": "^15.2.10", | ||||||||||||||||||||
"np": "^10.0.5", | ||||||||||||||||||||
"rc-test": "^7.0.14", | ||||||||||||||||||||
"react": "^18.3.1", | ||||||||||||||||||||
|
@@ -77,5 +80,8 @@ | |||||||||||||||||||
"peerDependencies": { | ||||||||||||||||||||
"react": ">=16.9.0", | ||||||||||||||||||||
"react-dom": ">=16.9.0" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"lint-staged": { | ||||||||||||||||||||
"*": "prettier --write --ignore-unknown" | ||||||||||||||||||||
Comment on lines
+84
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion lint-staged 配置优化建议 当前配置对所有文件类型使用 Prettier 进行格式化,这可能不是最优的方案。 建议根据文件类型设置不同的 lint 规则: "lint-staged": {
- "*": "prettier --write --ignore-unknown"
+ "*.{js,jsx,ts,tsx}": [
+ "eslint --fix",
+ "prettier --write"
+ ],
+ "*.{json,md,yml}": "prettier --write"
} 这样可以:
📝 Committable suggestion
Suggested change
|
||||||||||||||||||||
} | ||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Based on the results, I can now provide a final response as we have confirmed:
需要完善 Git Hook 配置和权限设置
pre-commit 钩子脚本存在以下问题需要修正:
这些更改将确保:
🔗 Analysis chain
需要完善 shell 脚本的基本要求
这个 pre-commit 钩子脚本缺少必要的 shell 脚本组件,可能会导致执行失败。建议进行以下修改:
应用以下更改:
修改说明:
npx
来执行lint-staged
命令Let me verify the husky setup further to provide a comprehensive response.
Based on the results, I'll generate a final response in Chinese that addresses both the script content and file permissions issues.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 90
Script:
Length of output: 626