-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(scripts): 修改lint脚本,优化markdown文档格式化配置
- Loading branch information
142vip.cn
committed
Oct 30, 2023
1 parent
dcdd48e
commit 717d7f7
Showing
8 changed files
with
53 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
node_modules | ||
node_modules | ||
.idea | ||
.github | ||
.husky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ jobs: | |
- name: Code LintFix | ||
run: | | ||
./scripts/lint --fix | ||
./scripts/lint | ||
- name: Build Site | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,39 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.vscode | ||
.vscode/* | ||
*/.DS_Store | ||
.DS_Store | ||
*/.vscode | ||
.idea | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# docs | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
*.lcov | ||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.git | ||
.vscode | ||
.env | ||
.DS_Store | ||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
# Next.js build output | ||
.next | ||
.nuxt | ||
dist | ||
lib | ||
es | ||
_site | ||
yarn.lock | ||
package-lock.json | ||
/coverage | ||
|
||
# useless files | ||
templete | ||
/docs/.vuepress/.temp/ | ||
/docs/.vuepress/.cache/ | ||
# Gatsby files | ||
.cache/ | ||
# vuepress build output | ||
# .vuepress/dist | ||
docs/.vuepress/.cache/ | ||
docs/.vuepress/.temp/ | ||
docs/.vuepress/dist/ | ||
# TernJS port file | ||
.tern-port | ||
/.husky/ | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
**/node_modules/** | ||
CHANGELOG.md | ||
LICENSE | ||
.idea | ||
.husky | ||
.github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,3 @@ fi | |
|
||
# 安装项目依赖 | ||
pnpm i --frozen-lockfile --registry https://registry.npmmirror.com | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
#!/usr/bin/env node | ||
#!/bin/bash | ||
|
||
/** | ||
* | ||
* 格式化代码 | ||
* 例如: | ||
* - ./scripts/lint | ||
* - ./scripts/lint --fix | ||
*/ | ||
## | ||
## 自动格式化 | ||
## - 代码 | ||
## - markdown文档 | ||
## 使用: | ||
# - ./scripts/lint | ||
## 参考链接: | ||
## - https://eslint.org/docs/latest/use/getting-started | ||
## - https://github.com/igorshubovych/markdownlint-cli | ||
## | ||
|
||
const {execShell} = require('./.exec') | ||
const scriptName = process.argv[2] | ||
const fixed = scriptName != null ? '--fix' : ''; | ||
# 设置 PATH 环境变量,避免command not found问题 | ||
export PATH="$(pnpm bin):$PATH" | ||
|
||
// 格式化代码 | ||
const lintCode = `eslint ${fixed} --ext .js,.ts,.vue --ignore-path .gitignore .`; | ||
# ESLint格式化代码 | ||
eslint --fix --ext .js,.ts,.vue --ignore-path .gitignore . | ||
|
||
// 遍历格式化docs目录下的markdown 文档 | ||
const lintMd = 'find docs -type f -name \"*.md\" -print0 | xargs -0 -I {} markdownlint -c .markdownlint.js --fix {}'; | ||
# markdown-cli格式化markdown 文档 | ||
markdownlint '**/*.md' -c .markdownlint.js -p .markdownlintignore --fix | ||
|
||
// 可以在--fix后指定目录 | ||
(async () => await execShell([ | ||
lintCode, | ||
lintMd | ||
]))() |