diff --git a/.eslintrc.js b/.eslintrc.js index 38687c2..43b783b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,6 +6,7 @@ module.exports = { browser: true, }, extends: ['eslint:recommended', 'plugin:vue/vue3-recommended', 'plugin:prettier/recommended', '@vue/prettier'], + plugins: ['prettier', 'vue'], parser: 'vue-eslint-parser', parserOptions: { ecmaVersion: 'latest', @@ -23,7 +24,7 @@ module.exports = { 'no-console': 'off', 'vue/no-v-html': 'off', 'vue/html-self-closing': [ - 'error', + 'warn', { html: { void: 'any', @@ -91,31 +92,10 @@ module.exports = { 'EVENTS', 'CONTENT', ], - alphabetical: true, //字母顺序 + alphabetical: true, }, ], - // 'prettier/prettier': [ - // 'error', - // { - // printWidth: 120, - // tabWidth: 4, - // useTabs: false, - // semi: true, - // singleQuote: true, - // quoteProps: 'as-needed', - // jsxSingleQuote: false, - // trailingComma: 'es5', - // bracketSpacing: true, - // bracketSameLine: false, - // arrowParens: 'always', - // htmlWhitespaceSensitivity: 'ignore', - // vueIndentScriptAndStyle: true, - // endOfLine: 'auto', - // }, - // { - // usePrettierrc: true, - // }, - // ], + 'prettier/prettier': 'error', indent: [0, 4], eqeqeq: [2, 'always'], semi: [2, 'always'], diff --git a/.vscode/settings.json b/.vscode/settings.json index 13ee2b0..e1ac849 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,36 @@ { - "nuxt.isNuxtApp": false -} \ No newline at end of file + "nuxt.isNuxtApp": false, + "js/ts.implicitProjectConfig.checkJs": true, + "js/ts.implicitProjectConfig.strictNullChecks": true, + "git.autofetch": true, + "javascript.updateImportsOnFileMove.enabled": "always", + "typescript.updateImportsOnFileMove.enabled": "always", + "editor.codeActionsOnSave": { + "source.fixAll": true, + "source.organizeImports": true + }, + "[vue]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsx]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[html]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "vetur.format.defaultFormatter.html": "prettier", + "eslint.enable": true, + "eslint.format.enable": true, + "eslint.lintTask.enable": true, + "eslint.run": "onType", + "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "html", "vue"] +} diff --git a/TODO.md b/TODO.md index e97150d..0213683 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,3 @@ -| 问题描述 | 作者 | 记录时间 | 状态 | 解决时间 | -| ------------------------------------------------------------- | ---- | --------- | -------- | --------- | -| 自定义 SVG 图标颜色显示异常,初始颜色不对,鼠标移入颜色闪烁 | xwk | 2022.3.22 | _已解决_ | 2022.3.23 | -| perttier 保存时不会自动格式化属性排序、需要执行命令才能格式化 | xwk | 2022.3.23 | 待解决 | +| 问题描述 | 作者 | 记录时间 | 状态 | 解决时间 | 解决方法 | +| ------------------------------------------------------------- | ---- | --------- | -------- | --------- | ------------------------------------------------------------------------------ | +| perttier 保存时不会自动格式化属性排序、需要执行命令才能格式化 | xwk | 2022.3.23 | _已解决_ | 2022.3.24 | .vscode/settings.json 配置 "editor.codeActionsOnSave": {"source.fixAll": true} | diff --git a/package.json b/package.json index 14aa746..2905431 100644 --- a/package.json +++ b/package.json @@ -1,65 +1,64 @@ { - "name": "msb-shop-admin", - "author": { - "name": "向文可", - "email": "1041367524@qq.com" - }, - "private": true, - "version": "0.0.1", - "scripts": { - "dev": "vite", - "build:test": "vite build --mode test", - "build:preview": "vite build --mode preview", - "build:prod": "vite build --mode prod", - "preview": "vite preview", - "prepare": "husky install", - "lint": "eslint src/**/*.{vue,js,jsx} --fix" - }, - "dependencies": { - "@element-plus/icons": "^0.0.11", - "@vueup/vue-quill": "^1.0.0-beta.8", - "axios": "^0.26.1", - "dayjs": "^1.11.0", - "element-plus": "^2.1.2", - "lodash": "^4.17.21", - "qs": "^6.10.3", - "quill-image-uploader": "^1.2.2", - "sortablejs": "^1.14.0", - "vue": "^3.2.25", - "vue-router": "^4.0.14", - "vuex": "^4.0.2" - }, - "devDependencies": { - "@commitlint/cli": "^13.2.1", - "@commitlint/config-conventional": "^13.2.0", - "@commitlint/prompt-cli": "^13.2.1", - "@nabla/vite-plugin-eslint": "^1.4.0", - "@originjs/vite-plugin-global-style": "^1.0.2", - "@types/node": "^17.0.21", - "@vitejs/plugin-legacy": "^1.7.1", - "@vitejs/plugin-vue": "^2.2.0", - "@vitejs/plugin-vue-jsx": "^1.3.8", - "airbnb": "^0.0.2", - "consola": "^2.15.3", - "eslint": "^8.11.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-vue": "^8.5.0", - "husky": "^7.0.4", - "less": "^4.1.2", - "lint-staged": "^12.3.7", - "prettier": "^2.6.0", - "unplugin-auto-import": "^0.6.4", - "unplugin-vue-components": "^0.18.0", - "vite": "^2.8.0", - "vite-plugin-remove-console": "^0.0.6", - "vite-plugin-style-import": "^2.0.0", - "vite-plugin-svg-icons": "^2.0.1" - }, - "lint-staged": { - "src/**/*.{jsx,tsx,ts,js,vue}": [ - "prettier --write", - "eslint --fix" - ] - } + "name": "msb-shop-admin", + "author": { + "name": "向文可", + "email": "1041367524@qq.com" + }, + "private": true, + "version": "0.0.1", + "scripts": { + "dev": "vite", + "build:test": "vite build --mode test", + "build:preview": "vite build --mode preview", + "build:prod": "vite build --mode prod", + "preview": "vite preview", + "prepare": "husky install", + "lint": "eslint src/**/*.{vue,js,jsx} --fix" + }, + "dependencies": { + "@element-plus/icons": "^0.0.11", + "@vueup/vue-quill": "^1.0.0-beta.8", + "axios": "^0.26.1", + "dayjs": "^1.11.0", + "element-plus": "^2.1.2", + "lodash": "^4.17.21", + "qs": "^6.10.3", + "quill-image-uploader": "^1.2.2", + "sortablejs": "^1.14.0", + "vue": "^3.2.25", + "vue-router": "^4.0.14", + "vuex": "^4.0.2" + }, + "devDependencies": { + "@commitlint/cli": "^13.2.1", + "@commitlint/config-conventional": "^13.2.0", + "@nabla/vite-plugin-eslint": "^1.4.0", + "@originjs/vite-plugin-global-style": "^1.0.2", + "@types/node": "^17.0.21", + "@vitejs/plugin-legacy": "^1.7.1", + "@vitejs/plugin-vue": "^2.2.0", + "@vitejs/plugin-vue-jsx": "^1.3.8", + "airbnb": "^0.0.2", + "consola": "^2.15.3", + "eslint": "^8.11.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-vue": "^8.5.0", + "husky": "^7.0.4", + "less": "^4.1.2", + "lint-staged": "^12.3.7", + "prettier": "^2.6.0", + "unplugin-auto-import": "^0.6.4", + "unplugin-vue-components": "^0.18.0", + "vite": "^2.8.0", + "vite-plugin-remove-console": "^0.0.6", + "vite-plugin-style-import": "^2.0.0", + "vite-plugin-svg-icons": "^2.0.1" + }, + "lint-staged": { + "src/**/*.{jsx,tsx,ts,js,vue}": [ + "prettier --write", + "eslint --fix" + ] + } } diff --git a/vite.config.js b/vite.config.js index f6d1ea4..114ba67 100644 --- a/vite.config.js +++ b/vite.config.js @@ -12,9 +12,9 @@ import removeConsole from 'vite-plugin-remove-console'; import legacy from '@vitejs/plugin-legacy'; import eslintPlugin from '@nabla/vite-plugin-eslint'; -export default ({ command, mode }) => { - console.info('command', command); - console.info('mode', mode); +export default (configEnv) => { + console.info('command', configEnv.command); + console.info('mode', configEnv.mode); return { server: { host: '0.0.0.0',