Skip to content

Commit 7ede988

Browse files
author
HalseySpicy
committed
feat: 🚀 refactoring project configuration
1 parent e3b11eb commit 7ede988

File tree

270 files changed

+47858
-62149
lines changed

Some content is hidden

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

270 files changed

+47858
-62149
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ root = true
66
charset = utf-8 # 设置文件字符集为 utf-8
77
end_of_line = lf # 控制换行类型(lf | cr | crlf)
88
insert_final_newline = true # 始终在文件末尾插入一个新行
9-
indent_style = tab # 缩进风格(tab | space)
9+
indent_style = space # 缩进风格(tab | space)
1010
indent_size = 2 # 缩进大小
1111
max_line_length = 130 # 最大行长度
1212

.env

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
# title
2-
VITE_GLOB_APP_TITLE = 'Geeker-Admin'
2+
VITE_GLOB_APP_TITLE = Geeker-Admin
33

4-
# port
5-
VITE_PORT = 3301
4+
# 本地运行端口号
5+
VITE_PORT = 8848
66

7-
# open 运行 npm run dev 时自动打开浏览器
7+
# 启动时自动打开浏览器
88
VITE_OPEN = true
99

10-
# 是否生成包分析文件
11-
VITE_REPORT = false
12-
13-
# 是否开启gzip压缩
14-
VITE_BUILD_GZIP = false
15-
16-
# 是否删除生产环境 console
17-
VITE_DROP_CONSOLE = true
18-
10+
# 打包后是否生成包分析文件
11+
VITE_REPORT = true

.env.development

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# 本地环境
2-
NODE_ENV = 'development'
2+
VITE_USER_NODE_ENV = development
33

4-
# 本地环境接口地址(/api/index.ts文件中使用)
5-
VITE_API_URL = '/api'
4+
# 公共基础路径
5+
VITE_PUBLIC_PATH = /
6+
7+
# 打包时是否删除 console
8+
VITE_DROP_CONSOLE = true
9+
10+
# 开发环境接口地址
11+
VITE_API_URL = /api
12+
13+
# 开发环境跨域代理,可配置多个
14+
VITE_PROXY = [["/api","https://mock.mengxuegu.com/mock/629d727e6163854a32e8307e"]]
15+
# VITE_PROXY = [["/api-easymock","https://mock.mengxuegu.com"],["/api-fastmock","https://www.fastmock.site"]]

.env.production

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# 线上环境
2-
NODE_ENV = "production"
2+
VITE_USER_NODE_ENV = production
33

4-
# 线上环境接口地址(easymock)
4+
# 公共基础路径
5+
VITE_PUBLIC_PATH = /
6+
7+
# 是否启用 gzip 或 brotli 压缩打包,如果需要多个压缩规则,可以使用 “,” 分隔
8+
# Optional: gzip | brotli | none
9+
VITE_BUILD_COMPRESS = none
10+
11+
# 打包压缩后是否删除源文件
12+
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
13+
14+
# 打包时是否删除 console
15+
VITE_DROP_CONSOLE = true
16+
17+
# 线上环境接口地址
518
VITE_API_URL = "https://mock.mengxuegu.com/mock/629d727e6163854a32e8307e"

.env.test

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# 测试环境
2-
NODE_ENV = "test"
2+
VITE_USER_NODE_ENV = test
33

4-
# 测试环境接口地址(fastmock)
5-
VITE_API_URL = "https://www.fastmock.site/mock/f81e8333c1a9276214bcdbc170d9e0a0"
4+
# 公共基础路径
5+
VITE_PUBLIC_PATH = /
6+
7+
# 是否启用 gzip 或 brotli 压缩打包,如果需要多个压缩规则,可以使用 “,” 分隔
8+
# Optional: gzip | brotli | none
9+
VITE_BUILD_COMPRESS = none
10+
11+
# 打包压缩后是否删除源文件
12+
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
13+
14+
# 打包时是否删除 console
15+
VITE_DROP_CONSOLE = true
16+
17+
# 测试环境接口地址
18+
VITE_API_URL = "https://mock.mengxuegu.com/mock/629d727e6163854a32e8307e"

.eslintignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ node_modules
66
.vscode
77
.idea
88
dist
9-
html
109
/public
1110
/docs
1211
.husky
1312
.local
1413
/bin
15-
.eslintrc.js
16-
.prettierrc.js
1714
/src/mock/*
18-
15+
stats.html

.eslintrc.cjs

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// @see: http://eslint.cn
2+
3+
module.exports = {
4+
root: true,
5+
env: {
6+
browser: true,
7+
node: true,
8+
es6: true
9+
},
10+
// 指定如何解析语法
11+
parser: "vue-eslint-parser",
12+
// 优先级低于 parse 的语法解析配置
13+
parserOptions: {
14+
parser: "@typescript-eslint/parser",
15+
ecmaVersion: 2020,
16+
sourceType: "module",
17+
jsxPragma: "React",
18+
ecmaFeatures: {
19+
jsx: true
20+
}
21+
},
22+
// 继承某些已有的规则
23+
extends: ["plugin:vue/vue3-recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
24+
/**
25+
* "off" 或 0 ==> 关闭规则
26+
* "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行)
27+
* "error" 或 2 ==> 规则作为一个错误(代码不能执行,界面报错)
28+
*/
29+
rules: {
30+
// eslint (http://eslint.cn/docs/rules)
31+
"no-var": "error", // 要求使用 let 或 const 而不是 var
32+
"no-multiple-empty-lines": ["error", { max: 1 }], // 不允许多个空行
33+
"prefer-const": "off", // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const
34+
"no-use-before-define": "off", // 禁止在 函数/类/变量 定义之前使用它们
35+
"no-irregular-whitespace": "off", // 禁止不规则的空白
36+
37+
// typeScript (https://typescript-eslint.io/rules)
38+
"@typescript-eslint/no-unused-vars": "error", // 禁止定义未使用的变量
39+
"@typescript-eslint/prefer-ts-expect-error": "error", // 禁止使用 @ts-ignore
40+
"@typescript-eslint/no-inferrable-types": "off", // 可以轻松推断的显式类型可能会增加不必要的冗长
41+
"@typescript-eslint/no-namespace": "off", // 禁止使用自定义 TypeScript 模块和命名空间。
42+
"@typescript-eslint/no-explicit-any": "off", // 禁止使用 any 类型
43+
"@typescript-eslint/ban-types": "off", // 禁止使用特定类型
44+
"@typescript-eslint/explicit-function-return-type": "off", // 不允许对初始化为数字、字符串或布尔值的变量或参数进行显式类型声明
45+
"@typescript-eslint/no-var-requires": "off", // 不允许在 import 语句中使用 require 语句
46+
"@typescript-eslint/no-empty-function": "off", // 禁止空函数
47+
"@typescript-eslint/no-use-before-define": "off", // 禁止在变量定义之前使用它们
48+
"@typescript-eslint/ban-ts-comment": "off", // 禁止 @ts-<directive> 使用注释或要求在指令后进行描述
49+
"@typescript-eslint/no-non-null-assertion": "off", // 不允许使用后缀运算符的非空断言(!)
50+
"@typescript-eslint/explicit-module-boundary-types": "off", // 要求导出函数和类的公共类方法的显式返回和参数类型
51+
52+
// vue (https://eslint.vuejs.org/rules)
53+
"vue/script-setup-uses-vars": "error", // 防止<script setup>使用的变量<template>被标记为未使用,此规则仅在启用该no-unused-vars规则时有效。
54+
"vue/v-slot-style": "error", // 强制执行 v-slot 指令样式
55+
"vue/no-mutating-props": "off", // 不允许组件 prop的改变
56+
"vue/no-v-html": "off", // 禁止使用 v-html
57+
"vue/custom-event-name-casing": "off", // 为自定义事件名称强制使用特定大小写
58+
"vue/attributes-order": "off", // vue api使用顺序,强制执行属性顺序
59+
"vue/one-component-per-file": "off", // 强制每个组件都应该在自己的文件中
60+
"vue/html-closing-bracket-newline": "off", // 在标签的右括号之前要求或禁止换行
61+
"vue/max-attributes-per-line": "off", // 强制每行的最大属性数
62+
"vue/multiline-html-element-content-newline": "off", // 在多行元素的内容之前和之后需要换行符
63+
"vue/singleline-html-element-content-newline": "off", // 在单行元素的内容之前和之后需要换行符
64+
"vue/attribute-hyphenation": "off", // 对模板中的自定义组件强制执行属性命名样式
65+
"vue/require-default-prop": "off", // 此规则要求为每个 prop 为必填时,必须提供默认值
66+
"vue/multi-word-component-names": "off" // 要求组件名称始终为 “-” 链接的单词
67+
}
68+
};

.eslintrc.js

-68
This file was deleted.

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ lerna-debug.log*
99

1010
node_modules
1111
dist
12-
html
1312
dist-ssr
14-
*.local
1513
stats.html
16-
14+
*.local
1715

1816
# Editor directories and files
1917
.vscode/*

.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/dist/*
2-
/html/*
32
.local
43
/node_modules/**
54

65
**/*.svg
76
**/*.sh
87

98
/public/*
9+
stats.html

.prettierrc.cjs

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// @see: https://www.prettier.cn
2+
3+
module.exports = {
4+
// 指定最大换行长度
5+
printWidth: 130,
6+
// 缩进制表符宽度 | 空格数
7+
tabWidth: 2,
8+
// 使用制表符而不是空格缩进行 (true:制表符,false:空格)
9+
useTabs: false,
10+
// 结尾不用分号 (true:有,false:没有)
11+
semi: true,
12+
// 使用单引号 (true:单引号,false:双引号)
13+
singleQuote: false,
14+
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
15+
quoteProps: "as-needed",
16+
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
17+
jsxSingleQuote: false,
18+
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
19+
trailingComma: "none",
20+
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
21+
bracketSpacing: true,
22+
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
23+
bracketSameLine: false,
24+
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
25+
arrowParens: "avoid",
26+
// 指定要使用的解析器,不需要写文件开头的 @prettier
27+
requirePragma: false,
28+
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
29+
insertPragma: false,
30+
// 用于控制文本是否应该被换行以及如何进行换行
31+
proseWrap: "preserve",
32+
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
33+
htmlWhitespaceSensitivity: "css",
34+
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
35+
vueIndentScriptAndStyle: false,
36+
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
37+
endOfLine: "auto",
38+
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
39+
rangeStart: 0,
40+
rangeEnd: Infinity
41+
};

.prettierrc.js

-39
This file was deleted.

.stylelintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/dist/*
2-
/html/*
32
/public/*
43
public/*
4+
stats.html

0 commit comments

Comments
 (0)