chore(eslint): 添加eslint并配置

This commit is contained in:
Coffee-crocodile 2022-08-04 13:43:44 +08:00
parent 6d16900836
commit d12ef03342
6 changed files with 72 additions and 15 deletions

15
.eslintignore Normal file
View File

@ -0,0 +1,15 @@
*.sh
node_modules
lib
*.md
*.woff
*.ttf
.vscode
.idea
/dist/
/public
/docs
.vscode
.local
!.env-config.ts
components.d.ts

36
.eslintrc.js Normal file
View File

@ -0,0 +1,36 @@
module.exports = {
root: true,
// 环境变量 https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-environments
env: {
browser: true, //浏览器全局变量。
node: true, // Node.js 全局变量和 Node.js 范围。
es2021: true, // 所有的ECMAScript6的特性除了模块
},
// 全局变量
globals: {},
// 指定解析器与解析器配置
parser: 'vue-eslint-parser',
parserOptions: {
ecmaVersion: 12,
parser: '@typescript-eslint/parser',
sourceType: 'module'
},
// 想要Linting规则的插件 https://eslint.org/docs/latest/user-guide/configuring/plugins
plugins: ['vue', '@typescript-eslint', 'prettier'],
// 指定扩展的配置,配置支持递归扩展,支持规则的覆盖和聚合。
extends: [
'eslint:recommended',
'plugin:vue/vue3-recommended',
'plugin:prettier/recommended',
'@vue/eslint-config-typescript/recommended',
'@vue/eslint-config-prettier',
'@vue/typescript/recommended'
],
rules: {
'no-var': 'error',
// 禁止出现console
'no-console': 'warn',
// 关闭debugger警告
"no-debugger": "off",
}
};

View File

@ -1,7 +1,6 @@
<div align="center"> <div align="center">
<img src="./public/pixel.svg"/> <img src="./public/pixel.svg"/>
<h1>Ench Admin</h1> <h1>Ench Admin</h1>
</div> </div>
一个基于Vue3、vite3、ts、pinia、NaiveUI,Vue-Router4的后台管理项目 一个基于Vue3、vite3、ts、pinia、NaiveUI,Vue-Router4的后台管理项目
@ -10,21 +9,18 @@
- [示例网页](https://ench- - [示例网页](https://ench-
admin.vercel.app/) admin.vercel.app/)
## 代码仓库 ## 代码仓库
- [github](https://github.com/chen-see/ench-admin) - [github](https://github.com/chen-see/ench-admin)
## 安装使用 ## 安装使用
- 环境配置 - 环境配置
**本地环境需要安装 pnpm 7.x 、Node.js 14.18+ 和 Git** **本地环境需要安装 pnpm 7.x 、Node.js 14.18+ 和 Git**
- 克隆代码 - 克隆代码
```bash ```bash
@ -47,4 +43,8 @@ pnpm dev
```bash ```bash
pnpm build pnpm build
``` ```
## 素材来源
[iconfont-阿里巴巴矢量图标库](https://www.iconfont.cn/collections/detail?spm=a313x.7781069.1998910419.d9df05512&cid=39973)

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/pixel.svg" /> <link rel="icon" type="image/svg+xml" href="/pixel.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>EnchAdmin</title> <title>Ench-Admin</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -12,7 +12,16 @@
"vue": "^3.2.37" "vue": "^3.2.37"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"@vitejs/plugin-vue": "^3.0.0", "@vitejs/plugin-vue": "^3.0.0",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.0",
"eslint": "^8.21.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.3.0",
"typescript": "^4.6.4", "typescript": "^4.6.4",
"vite": "^3.0.0", "vite": "^3.0.0",
"vue-tsc": "^0.38.4" "vue-tsc": "^0.38.4"

View File

@ -7,10 +7,10 @@ import HelloWorld from './components/HelloWorld.vue';
<template> <template>
<div> <div>
<a href="https://vitejs.dev" target="_blank"> <a href="https://vitejs.dev" target="_blank">
<img src="/pixel.svg" class="logo" alt="Vite logo" /> <img src="/pixel.svg" class="logo" />
</a> </a>
</div> </div>
<HelloWorld msg="Vite + Vue 的中后台模板" /> <HelloWorld msg="Ench-Admin 中后台模板" />
</template> </template>
<style scoped> <style scoped>
@ -20,9 +20,6 @@ import HelloWorld from './components/HelloWorld.vue';
will-change: filter; will-change: filter;
} }
.logo:hover { .logo:hover {
filter: drop-shadow(0 0 2em #646cffaa); filter: drop-shadow(0 0 2em #ed9d0aaa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
} }
</style> </style>