Skip to content

Commit 30ee18f

Browse files
committed
add: "eslint": "^8.10.0",
1 parent 1be68d8 commit 30ee18f

File tree

4 files changed

+1533
-3
lines changed

4 files changed

+1533
-3
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,42 @@ npm run dev
4646

4747
```js
4848
npm install @types/node --save-dev
49-
```
49+
```
50+
51+
打包功能
52+
53+
```js
54+
build: {
55+
     outDir: 'dist', // 指定打包路径,默认为项目根目录下的 dist 目录
56+
     terserOptions: {
57+
         compress: {
58+
             keep_infinity: true,  // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题
59+
             drop_console: true, // 生产环境去除 console
60+
             drop_debugger: true // 生产环境去除 debugger
61+
        },
62+
    },
63+
     chunkSizeWarningLimit: 1500 // chunk 大小警告的限制(以 kbs 为单位)
64+
}
65+
```
66+
67+
## 接入代码规范
68+
69+
ESlint 被称作下一代的 JS Linter 工具,能够将 JS 代码解析成 AST 抽象语法树,然后检测 AST 是否符合既定的规则。
70+
71+
```js
72+
yarn add eslint @typescript-eslint/parser @typescript/eslint-plugin eslint-plugin-vue
73+
```
74+
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
85+
86+
87+

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"preview": "vite preview"
99
},
1010
"dependencies": {
11+
"eslint": "^8.10.0",
1112
"vue": "^3.2.25"
1213
},
1314
"devDependencies": {

vite.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { defineConfig } from 'vite'
22
import vue from '@vitejs/plugin-vue'
3-
43
// https://vitejs.dev/config/
54
export default defineConfig({
6-
plugins: [vue()]
5+
 plugins: [vue()],
76
})

0 commit comments

Comments
 (0)