1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-11-29 23:45:43 +08:00

feat(lint): 新增工程化规范约束

This commit is contained in:
142vip.cn
2023-11-07 15:41:20 +08:00
parent b596a86713
commit 02c58eb672
14 changed files with 451 additions and 216 deletions

View File

@@ -32,11 +32,12 @@ exports.execShell = async commands => {
for (let index = 0; index < runCommands.length; index++) {
const command = runCommands[index]
const count = index + 1
console.log(`>>>command(${count}):\n${command} \n<<<command(${count})--start === \n`)
console.log(`step${count}:\n${command} \nstep${count}(start): === `)
// await syncExec(command)
const execResult = await exec(command)
console.log(`\n<<<command(${count})--ending === `)
// 打印输出结果
// console.log(execResult.stdout);
console.log(`step${count}(ending): === \n`)
// 指令异常,不执行后续指令,非0退出
if (execResult.code !== 0) {
exit(1)

View File

@@ -37,7 +37,4 @@ else
fi
# 安装项目依赖
pnpm i --frozen-lockfile --registry https://registry.npmmirror.com
pnpm i --frozen-lockfile --registry https://registry.npmmirror.com

View File

@@ -5,7 +5,8 @@
## - 代码
## - markdown文档
## 使用:
# - ./scripts/lint
# - ./scripts/lint 校验
# - ./scripts/lint --fix 格式化
## 参考链接:
## - https://eslint.org/docs/latest/use/getting-started
## - https://github.com/igorshubovych/markdownlint-cli
@@ -14,9 +15,15 @@
# 设置 PATH 环境变量,避免command not found问题
export PATH="$(pnpm bin):$PATH"
# 是否fix
fixed=${1}
# ESLint格式化代码
eslint --fix --ext .js,.ts,.vue --ignore-path .gitignore .
echo "step1: eslint $fixed --ext .js,.ts,.vue --ignore-path .gitignore ."
eslint $fixed --ext .js,.ts,.vue --ignore-path .gitignore .
# markdown-cli格式化markdown 文档
markdownlint '**/*.md' -c .markdownlint.js -p .markdownlintignore --fix
echo "step2: markdownlint '**/*.md' -c .markdownlint.js -p .markdownlintignore $fixed"
markdownlint '**/*.md' -c .markdownlint.js -p .markdownlintignore $fixed