From 7bfb9ce7d13cb41f6c90dde181e81242bd33c99c Mon Sep 17 00:00:00 2001 From: wy Date: Fri, 29 Jul 2022 18:05:24 +0800 Subject: [PATCH] chore: fig tools config --- .editorconfig | 16 ---------------- .eslintrc | 18 ++++++++++++++---- package.json | 11 +++++++---- postcss.config.js | 7 ------- tailwind.config.js | 1 + vite.config.ts | 8 ++++++-- 6 files changed, 28 insertions(+), 33 deletions(-) delete mode 100644 .editorconfig delete mode 100644 postcss.config.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index eebe3c2..0000000 --- a/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -# Editor configuration, see http://editorconfig.org - -# 表示最顶层的 EditorConfig 配置文件 -root = true - -[*] # 表示所有文件适用 -charset = utf-8 # 设置文件字符集为 utf-8 -indent_style = space # 缩进风格(tab | space) -indent_size = 2 # 缩进大小 -end_of_line = lf # 控制换行类型(lf | cr | crlf) -trim_trailing_whitespace = true # 去除行首的任意空白字符 -insert_final_newline = true # 始终在文件末尾插入一个新行 - -[*.md] # 表示仅 md 文件适用以下规则 -max_line_length = off -trim_trailing_whitespace = false \ No newline at end of file diff --git a/.eslintrc b/.eslintrc index 5d03228..90723e3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,9 +8,11 @@ "plugins": ["vue", "@typescript-eslint", "prettier", "tailwindcss", "import"], "extends": [ "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:vue/vue3-essential", + "plugin:vue/vue3-strongly-recommended", "plugin:vue/vue3-recommended", "plugin:tailwindcss/recommended", - "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended", "prettier" ], @@ -21,6 +23,14 @@ "sourceType": "module" }, "rules": { + "no-debugger": "error", + "no-unused-vars": [ + "warn", + { + "args": "after-used", + "argsIgnorePattern": "^_" + } + ], "quotes": [ "warn", "single", @@ -30,14 +40,14 @@ ], // 使用单引号 "vue/multi-word-component-names": 0, "prettier/prettier": "off", + "@typescript-eslint/no-unused-vars": "off", + "vue/script-setup-uses-vars": "off", "tailwindcss/classnames-order": "off", "tailwindcss/enforces-negative-arbitrary-values": "warn", "tailwindcss/enforces-shorthand": "warn", "tailwindcss/migration-from-tailwind-2": "warn", "tailwindcss/no-arbitrary-value": "off", "tailwindcss/no-custom-classname": "off", - "tailwindcss/no-contradicting-classname": "error", - "no-unused-vars": "warn", - "@typescript-eslint/no-unused-vars": "warn" + "tailwindcss/no-contradicting-classname": "error" } } diff --git a/package.json b/package.json index c3c6096..9f9e128 100644 --- a/package.json +++ b/package.json @@ -6,16 +6,19 @@ "prebuild": "lint-staged && vue-tsc --noEmit ", "build": "vite build", "dev": "vite", - "eslint": "eslint 'src/**/*.{ts,tsx,vue,less,css,json,js}' --fix", + "eslint": "eslint 'src/**/*.{ {j,t}s?(x),vue,{le,c,sa}ss }' --fix", + "format": "prettier '{src/**/*.{js,ts,tsx,md,html,less,css,json,vue},package.json,*.config.js,locales/*.yml}' --write", "lint": "lint-staged", "lint:prettier": "pretty-quick --verbose", "prepare": "husky install", - "prettier": "prettier '{src/**/*.{js,ts,tsx,md,html,less,css,json,vue},package.json,tailwind.config.js,locales/*.yml}' --write", "preview": "vite preview" }, "lint-staged": { - "src/**/*.{js,ts,tsx,md,html,less,css,json,vue}": "prettier --write", - "src/**/*.{ts,tsx,vue}": "eslint --fix", + "src/**/*.{{j,t}s?(x),vue,{le,c,sa}ss}": [ + "eslint --fix", + "prettier --write" + ], + "src/**/*.{md,html,json}": "prettier --write", "{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [ "prettier --write--parser json" ], diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index 44f2e62..0000000 --- a/postcss.config.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - plugins: [ - require('postcss-import'), - require('tailwindcss'), - require('autoprefixer'), - ] -} diff --git a/tailwind.config.js b/tailwind.config.js index 6fcc30c..6a80cb6 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires const colors = require('tailwindcss/colors'); module.exports = { diff --git a/vite.config.ts b/vite.config.ts index a31c7d8..2d355ca 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,15 +8,19 @@ import IconsResolver from 'unplugin-icons/resolver'; // https://vitejs.dev/config/ export default defineConfig({ + css: { + postcss: { + plugins: [require('postcss-import'), require('tailwindcss'), require('autoprefixer')], + }, + }, resolve: { alias: { '~/': `${path.resolve(__dirname, './src')}/`, - '/~/': `${path.resolve(__dirname, 'src')}/`, }, }, server: { host: '0.0.0.0', - port: 3000, + port: 5173, proxy: {}, cors: true, },