From 5aa8cd2a5da539689974f9960566d2d57dfe9948 Mon Sep 17 00:00:00 2001 From: anyfork <874957743@qq.com> Date: Fri, 21 Jul 2023 14:32:14 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20fix:=20=E4=BF=AE=E5=A4=8DtabWidth?= =?UTF-8?q?=E7=BC=A9=E8=BF=9B=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.cjs | 63 +++++++++++++++++++++++++------------------------- README.md | 10 +++++--- vite.config.ts | 2 +- 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index fcffd4f..b9cb0f3 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,35 +1,36 @@ module.exports = { - env: { - browser: true, - es2021: true, - node: true - }, - extends: ['standard-with-typescript', 'plugin:vue/vue3-essential'], - overrides: [ - { - env: { + env: { + browser: true, + es2021: true, node: true - }, - files: ['.eslintrc.{js,cjs}'], - parserOptions: { - sourceType: 'script' - } + }, + extends: ['standard-with-typescript', 'plugin:vue/vue3-essential'], + overrides: [ + { + env: { + node: true + }, + files: ['.eslintrc.{js,cjs}'], + parserOptions: { + sourceType: 'script' + } + } + ], + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + project: ['./tsconfig.json'], + ecmaVersion: 'latest', + extraFileExtensions: ['.vue'], + sourceType: 'module' + }, + plugins: ['vue'], + rules: { + // 关闭下面/// , /// , /// 校验 + '@typescript-eslint/triple-slash-reference': 'off', + // 关闭Eslint 缩进校验规则 + indent: 'off', + // 关闭@typescript-eslint/indent缩进报错 + '@typescript-eslint/indent': 'off' } - ], - parser: 'vue-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser', - project: ['./tsconfig.json'], - ecmaVersion: 'latest', - extraFileExtensions: ['.vue'], - sourceType: 'module' - }, - plugins: ['vue'], - rules: { - // 关闭下面/// , /// , /// 校验 - '@typescript-eslint/triple-slash-reference': 'off', - // 关闭Eslint 缩进校验规则 - indent: 'off', - '@typescript-eslint/indent': 'error' - } } diff --git a/README.md b/README.md index 1f17dc0..55e2770 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## 一 项目简介 -对于多人协作开发来说,项目开发规范标准,非常重要,不仅能够统一标准,规范代码书写风格,还能便于后期维护了运营。 +对于多人协作开发来说,项目开发规范标准,非常重要,不仅能够统一标准,规范代码书写风格,还能便于后期维护和运营。 一直以来,每次采用`vite`搭建`Vue3`项目时,都苦于配置`Eslint`代码校验规范,网上的水贴层出不穷,你抄我的,我粘贴你的,没有几个是有用的,不仅容易误导他人,还浪费大量的时间排查问题。最近花了一些时间,查阅了很多资料,自己也通过反复验证,决定自己搭建一个简单的模板,集成好日常代码开发规范和提交规范,把常用 的`Vite`插件都配置好,在以后创建项目时直接使用,避免重复造轮子,同时也供他人参考。 @@ -19,7 +19,7 @@ 这是一个基于Vite4.X + Vue3.X + TypeScript + Pinia + Naive UI + Unocss + Eslint + Prettier + husky + lint-staged + commitlint + commitizen+ cz-customizable + conventional-changelog 构建的标准的Vue3项目模板。整个项目包依赖采用`pnpm`进行依赖管理,`Node`版本为16.17.0, 同时也集成了项目中常用的插件,包含 组件自动导入,API -## 二项目插件 +## 二 项目Vite插件 ## 三 项目创建 @@ -827,4 +827,8 @@ pnpm dev ## 六 参考文档 - + + + + + diff --git a/vite.config.ts b/vite.config.ts index f5a60e5..6f8df2b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,5 +5,5 @@ import eslint from 'vite-plugin-eslint' // https://vitejs.dev/config/ export default defineConfig({ - plugins: [vue(), eslint()] + plugins: [vue(), eslint()] })