File tree Expand file tree Collapse file tree 5 files changed +18
-9
lines changed
Expand file tree Collapse file tree 5 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 11// 参考: https://www.npmjs.com/package/lint-staged#configuration
2+ // 对add的内容格式化后再commit
23module . exports = {
3- "*.*" : "./scripts/lint"
4+ "*.{js,ts,md}" :[
5+ "./scripts/lint --fix" ,
6+ "git add"
7+ ]
48}
Original file line number Diff line number Diff line change 1-
2- ## 接入Artalk评论系统
1+ # 接入Artalk评论系统
32
43``` bash
54
Original file line number Diff line number Diff line change 44 "version" : " 0.0.2-alpha.8" ,
55 "authorInfo" : {
66 "name" : " 微信公众号:储凡" ,
7- "email" : " fairy_408 @2925.com" ,
7+ "email" : " fairy_vip @2925.com" ,
88 "url" : " https://github.com/142vip" ,
99 "homePage" : " https://code.142vip.cn"
1010 },
1515 },
1616 "scripts" : {
1717 "preinstall" : " chmod +x ./scripts/*" ,
18- "prepare" : " rm -f .husky/pre-commit && husky install && npx husky add .husky/pre-commit \" npx lint-staged && git add . \" && chmod +x .husky/pre-commit" ,
18+ "prepare" : " rm -f .husky/pre-commit && husky install && npx husky add .husky/pre-commit \" npx lint-staged\" && chmod +x .husky/pre-commit" ,
1919 "dev" : " vuepress dev docs" ,
2020 "build" : " vuepress build docs" ,
2121 "build:proxy" : " ./scripts/bundle build_proxy" ,
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ async function getGitInfo(){
4141 // 输出最近一次提交的信息
4242 return {
4343 gitHash : commitHash ,
44- gitMessage : commitMessage . join ( '' )
44+ gitMessage : commitMessage . join ( ' ' )
4545 }
4646}
4747
Original file line number Diff line number Diff line change 55# # - 代码
66# # - markdown文档
77# # 使用:
8- # - ./scripts/lint
8+ # - ./scripts/lint 校验
9+ # - ./scripts/lint --fix 格式化
910# # 参考链接:
1011# # - https://eslint.org/docs/latest/use/getting-started
1112# # - https://github.com/igorshubovych/markdownlint-cli
1415# 设置 PATH 环境变量,避免command not found问题
1516export PATH=" $( pnpm bin) :$PATH "
1617
18+ # 是否fix
19+ fixed=${1}
20+
1721# ESLint格式化代码
18- eslint --fix --ext .js,.ts,.vue --ignore-path .gitignore .
22+ echo " step1: eslint $fixed --ext .js,.ts,.vue --ignore-path .gitignore ."
23+ eslint $fixed --ext .js,.ts,.vue --ignore-path .gitignore .
1924
2025# markdown-cli格式化markdown 文档
21- markdownlint ' **/*.md' -c .markdownlint.js -p .markdownlintignore --fix
26+ echo " step2: markdownlint '**/*.md' -c .markdownlint.js -p .markdownlintignore $fixed "
27+ markdownlint ' **/*.md' -c .markdownlint.js -p .markdownlintignore $fixed
2228
You can’t perform that action at this time.
0 commit comments