Skip to content

Commit b52207e

Browse files
jipengfei01SeanHai
authored andcommitted
feat: init project
0 parents  commit b52207e

File tree

141 files changed

+33013
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+33013
-0
lines changed

.commitlintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
}
4+
// { value: 'feat', name: 'feat: 新增功能' },
5+
// { value: 'fix', name: 'fix: 修复缺陷' },
6+
// { value: 'docs', name: 'docs: 文档变更' },
7+
// { value: 'style', name: 'style: 代码格式' },
8+
// { value: 'refactor', name: 'refactor: 代码重构' },
9+
// { value: 'perf', name: 'perf: 性能优化' },
10+
// { value: 'test', name: 'test: 添加疏漏测试或已有测试改动' },
11+
// { value: 'build', name: 'build: 构建流程、外部依赖变更 (如升级 npm 包、修改打包配置等)' },
12+
// { value: 'ci', name: 'ci: 修改 CI 配置、脚本' },
13+
// { value: 'revert', name: 'revert: 回滚 commit' },
14+
// { value: 'chore', name: 'chore: 对构建过程或辅助工具和库的更改 (不影响源文件、测试用例)' },

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 一些通用的环境配置,通过import.meta.env使用 https://cn.vitejs.dev/guide/env-and-mode.html
2+
VITE_API_URL = "" # 接口地址 eg: https://127.0.0.1:443
3+
VITE_HOST = "0.0.0.0"
4+
VITE_PORT = 8010

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/*
2+
public
3+
dist

.eslintrc.cjs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/* eslint-env node */
2+
require('@rushstack/eslint-patch/modern-module-resolution') // 这个库是用来解决monoRep可能出现的问题的,后期可以考虑把项目转成monoRep
3+
4+
// https://cn.eslint.org/docs/rules/
5+
/*
6+
* "off"或者0,不启用这个规则
7+
* "warn"或者1,出现问题会有警告
8+
* "error"或者2,出现问题会报错
9+
* ---------------------------
10+
* extends 直接应用别人的规范,包括其parser,overrides,rules等等
11+
* plugin 引入别人新增的规则,具体是否开启要在rules中自己配置。
12+
*/
13+
14+
module.exports = {
15+
root: true,
16+
env: {
17+
browser: true,
18+
node: true,
19+
es6: true,
20+
},
21+
extends: [
22+
'eslint:recommended',
23+
'plugin:vue/vue3-essential',
24+
'plugin:vue/recommended',
25+
'plugin:@typescript-eslint/eslint-recommended', // 使用推荐的规则,来自@typescript-eslint/eslint-plugin
26+
'plugin:prettier/recommended', // prettier配置 关闭 ESLint 中与 Prettier 中会发生冲突的规则
27+
],
28+
globals: {
29+
// script setup
30+
defineProps: 'readonly',
31+
defineEmits: 'readonly',
32+
defineExpose: 'readonly',
33+
defineOptions: 'readonly',
34+
withDefaults: 'readonly',
35+
NodeJS: 'readonly',
36+
},
37+
plugins: [
38+
'@typescript-eslint',
39+
'simple-import-sort', // import和export排序
40+
'prettier', // 将 Prettier 的规则设置到 ESLint 的规则中
41+
],
42+
parserOptions: {
43+
parser: {
44+
js: 'espree',
45+
jsx: 'espree',
46+
ts: '@typescript-eslint/parser',
47+
tsx: '@typescript-eslint/parser',
48+
// Leave the template parser unspecified, so that it could be determined by `<script lang="...">`
49+
},
50+
extraFileExtensions: ['.vue'], // .vue文件将被这个parser解析
51+
ecmaVersion: 'latest', // es使用最新版本语法解析
52+
sourceType: 'module', // esm,允许import和export
53+
ecmaFeatures: {
54+
jsx: true,
55+
tsx: true,
56+
},
57+
},
58+
parser: 'vue-eslint-parser',
59+
overrides: [
60+
{
61+
files: ['*.ts', '*.tsx', '*.vue'],
62+
rules: {
63+
// The core 'no-unused-vars' rules (in the eslint:recommeded ruleset)
64+
// does not work with type definitions
65+
'no-unused-vars': 'off',
66+
'@typescript-eslint/no-unused-vars': 'warn',
67+
},
68+
},
69+
],
70+
71+
rules: {
72+
'simple-import-sort/imports': 'error', // import sort排序
73+
'simple-import-sort/exports': 'error', // export sort排序
74+
'vue/multi-word-component-names': 0, // 组件名多单词
75+
'vue/no-multiple-template-root': 'off', // v3支持多个根组件了,这个规则主要是针对v2的
76+
'vue/no-v-model-argument': 'off', // 禁止使用v-model的参数 eg: v-model:argName = 'argValue'
77+
'vue/no-dupe-keys': 'off',
78+
'@typescript-eslint/consistent-type-imports': 'off',
79+
// 'import-type': 'error',
80+
// 'vue/custom-event-name-casing': 'off',
81+
// 'vue/require-default-prop': 'off',
82+
// 'vue/require-prop-types': 'off',
83+
// 'vue/define-component': 'off',
84+
},
85+
}

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint -e

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run lint:lint-staged

.lintstagedrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
3+
"!(package)*.json": ["prettier --write--parser json"],
4+
"package.json": ["prettier --write"],
5+
"*.vue": ["eslint --fix", "stylelint --fix", "prettier --write"],
6+
"*.{vue,css,scss,postcss,less}": ["stylelint --fix", "prettier --write"],
7+
"*.md": ["prettier --write"]
8+
}

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dist
2+
node_modules
3+
public
4+
5+
**/*.svg
6+
**/*.sh
7+

.prettierrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
arrowParens: 'avoid', // 箭头函数参数括号
3+
printWidth: 80, //单行长度
4+
tabWidth: 2, //缩进长度
5+
useTabs: false, //使用空格代替tab缩进
6+
semi: false, //句末使用分号
7+
singleQuote: true, //使用单引号
8+
quoteProps: 'as-needed', //仅在必需时为对象的key添加引号
9+
jsxSingleQuote: true, // jsx中使用单引号
10+
trailingComma: 'all', //多行时尽可能打印尾随逗号
11+
bracketSpacing: true, //在对象前后添加空格-eg: { foo: bar }
12+
jsxBracketSameLine: true, //多属性html标签的‘>’折行放置
13+
proseWrap: 'preserve', // 使用默认的折行标准,主要是针对markdown
14+
htmlWhitespaceSensitivity: 'css', //对HTML全局空白不敏感
15+
endOfLine: 'lf', //结束行形式
16+
}

0 commit comments

Comments
 (0)