Skip to content

Commit d406ef2

Browse files
author
HalseySpicy
committed
feat: 🚀 optimize irregular code
1 parent d62aae8 commit d406ef2

File tree

78 files changed

+278
-257
lines changed

Some content is hidden

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

78 files changed

+278
-257
lines changed

.eslintrc.cjs

+9-17
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,28 @@ module.exports = {
3232
"no-multiple-empty-lines": ["error", { max: 1 }], // 不允许多个空行
3333
"prefer-const": "off", // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const
3434
"no-use-before-define": "off", // 禁止在 函数/类/变量 定义之前使用它们
35-
"no-irregular-whitespace": "off", // 禁止不规则的空白
3635

3736
// typeScript (https://typescript-eslint.io/rules)
3837
"@typescript-eslint/no-unused-vars": "error", // 禁止定义未使用的变量
3938
"@typescript-eslint/prefer-ts-expect-error": "error", // 禁止使用 @ts-ignore
39+
"@typescript-eslint/ban-ts-comment": "error", // 禁止 @ts-<directive> 使用注释或要求在指令后进行描述
4040
"@typescript-eslint/no-inferrable-types": "off", // 可以轻松推断的显式类型可能会增加不必要的冗长
41-
"@typescript-eslint/no-namespace": "off", // 禁止使用自定义 TypeScript 模块和命名空间
41+
"@typescript-eslint/no-namespace": "off", // 禁止使用自定义 TypeScript 模块和命名空间
4242
"@typescript-eslint/no-explicit-any": "off", // 禁止使用 any 类型
4343
"@typescript-eslint/ban-types": "off", // 禁止使用特定类型
44-
"@typescript-eslint/explicit-function-return-type": "off", // 不允许对初始化为数字、字符串或布尔值的变量或参数进行显式类型声明
45-
"@typescript-eslint/no-var-requires": "off", // 不允许在 import 语句中使用 require 语句
44+
"@typescript-eslint/no-var-requires": "off", // 允许使用 require() 函数导入模块
4645
"@typescript-eslint/no-empty-function": "off", // 禁止空函数
47-
"@typescript-eslint/no-use-before-define": "off", // 禁止在变量定义之前使用它们
48-
"@typescript-eslint/ban-ts-comment": "off", // 禁止 @ts-<directive> 使用注释或要求在指令后进行描述
4946
"@typescript-eslint/no-non-null-assertion": "off", // 不允许使用后缀运算符的非空断言(!)
50-
"@typescript-eslint/explicit-module-boundary-types": "off", // 要求导出函数和类的公共类方法的显式返回和参数类型
5147

5248
// vue (https://eslint.vuejs.org/rules)
53-
"vue/script-setup-uses-vars": "error", // 防止<script setup>使用的变量<template>被标记为未使用,此规则仅在启用该no-unused-vars规则时有效
49+
"vue/script-setup-uses-vars": "error", // 防止<script setup>使用的变量<template>被标记为未使用,此规则仅在启用该no-unused-vars规则时有效
5450
"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", // 为自定义事件名称强制使用特定大小写
51+
"vue/no-mutating-props": "error", // 不允许改变组件 prop
52+
"vue/custom-event-name-casing": "error", // 为自定义事件名称强制使用特定大小写
53+
"vue/html-closing-bracket-newline": "error", // 在标签的右括号之前要求或禁止换行
54+
"vue/attribute-hyphenation": "error", // 对模板中的自定义组件强制执行属性命名样式:my-prop="prop"
5855
"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", // 对模板中的自定义组件强制执行属性命名样式
56+
"vue/no-v-html": "off", // 禁止使用 v-html
6557
"vue/require-default-prop": "off", // 此规则要求为每个 prop 为必填时,必须提供默认值
6658
"vue/multi-word-component-names": "off" // 要求组件名称始终为 “-” 链接的单词
6759
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Geeker-Admin
192192

193193
| 微信二维码 |
194194
| :-------------------------------------------------------------: |
195-
| <img src="https://i.imgtg.com/2023/05/24/Oa7LoB.png" width=170> |
195+
| <img src="https://i.imgtg.com/2023/05/30/OoV44t.png" width=170> |
196196

197197
### 捐赠 🍵
198198

build/plugins.ts

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const createCompression = (viteEnv: ViteEnv): PluginOption | PluginOption[] => {
5252
const { VITE_BUILD_COMPRESS = "none", VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv;
5353
const compressList = VITE_BUILD_COMPRESS.split(",");
5454
const plugins: PluginOption[] = [];
55-
5655
if (compressList.includes("gzip")) {
5756
plugins.push(
5857
viteCompression({

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"sortablejs": "^1.15.0",
5656
"vue": "^3.3.4",
5757
"vue-i18n": "^9.2.2",
58-
"vue-router": "^4.2.1",
58+
"vue-router": "^4.2.2",
5959
"vuedraggable": "^4.1.0"
6060
},
6161
"devDependencies": {
@@ -93,7 +93,7 @@
9393
"stylelint-config-standard-scss": "^9.0.0",
9494
"typescript": "^5.0.4",
9595
"unplugin-vue-setup-extend-plus": "^1.0.0",
96-
"vite": "^4.3.8",
96+
"vite": "^4.3.9",
9797
"vite-plugin-compression": "^0.5.1",
9898
"vite-plugin-eslint": "^1.8.1",
9999
"vite-plugin-html": "^3.2.0",

pnpm-lock.yaml

+33-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/config/servicePort.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// 后端微服务端口名
1+
// 后端微服务模块前缀
22
export const PORT1 = "/geeker";
33
export const PORT2 = "/hooks";

src/components/ErrorMessage/403.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="not-detail">
55
<h2>403</h2>
66
<h4>抱歉,您无权访问该页面~🙅‍♂️🙅‍♀️</h4>
7-
<el-button type="primary" @click="router.push(HOME_URL)">返回首页</el-button>
7+
<el-button type="primary" @click="router.push(HOME_URL)"> 返回首页 </el-button>
88
</div>
99
</div>
1010
</template>

src/components/ErrorMessage/404.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="not-detail">
55
<h2>404</h2>
66
<h4>抱歉,您访问的页面不存在~🤷‍♂️🤷‍♀️</h4>
7-
<el-button type="primary" @click="router.push(HOME_URL)">返回首页</el-button>
7+
<el-button type="primary" @click="router.push(HOME_URL)"> 返回首页 </el-button>
88
</div>
99
</div>
1010
</template>

src/components/ErrorMessage/500.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="not-detail">
55
<h2>500</h2>
66
<h4>抱歉,您的网络不见了~🤦‍♂️🤦‍♀️</h4>
7-
<el-button type="primary" @click="router.push(HOME_URL)">返回首页</el-button>
7+
<el-button type="primary" @click="router.push(HOME_URL)"> 返回首页 </el-button>
88
</div>
99
</div>
1010
</template>

src/components/Grid/components/GridItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :style="style" v-show="isShow">
2+
<div v-show="isShow" :style="style">
33
<slot></slot>
44
</div>
55
</template>

src/components/ImportExcel/index.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<el-dialog v-model="dialogVisible" :title="`批量添加${parameter.title}`" :destroy-on-close="true" width="580px" draggable>
33
<el-form class="drawer-multiColumn-form" label-width="100px">
44
<el-form-item label="模板下载 :">
5-
<el-button type="primary" :icon="Download" @click="downloadTemp">点击下载</el-button>
5+
<el-button type="primary" :icon="Download" @click="downloadTemp"> 点击下载 </el-button>
66
</el-form-item>
77
<el-form-item label="文件上传 :">
88
<el-upload
@@ -20,7 +20,9 @@
2020
:accept="parameter.fileType!.join(',')"
2121
>
2222
<slot name="empty">
23-
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
23+
<el-icon class="el-icon--upload">
24+
<upload-filled />
25+
</el-icon>
2426
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
2527
</slot>
2628
<template #tip>

src/components/ProTable/components/ColSetting.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<!-- 列设置 -->
3-
<el-drawer title="列设置" v-model="drawerVisible" size="450px">
3+
<el-drawer v-model="drawerVisible" title="列设置" size="450px">
44
<div class="table-main">
55
<el-table :data="colSetting" :border="true" row-key="prop" default-expand-all :tree-props="{ children: '_children' }">
66
<el-table-column prop="label" align="center" label="列名" />
7-
<el-table-column prop="isShow" align="center" label="显示" v-slot="scope">
7+
<el-table-column v-slot="scope" prop="isShow" align="center" label="显示">
88
<el-switch v-model="scope.row.isShow"></el-switch>
99
</el-table-column>
10-
<el-table-column prop="sortable" align="center" label="排序" v-slot="scope">
10+
<el-table-column v-slot="scope" prop="sortable" align="center" label="排序">
1111
<el-switch v-model="scope.row.sortable"></el-switch>
1212
</el-table-column>
1313
<template #empty>

0 commit comments

Comments
 (0)