diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..6ec2926 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,43 @@ +module.exports = { + env: { + browser: true, + es2021: true, + node: true, + }, + settings: { + 'import/resolver': { + alias: { + map: [['@', './src']], + }, + }, + }, + extends: ['plugin:vue/vue3-essential', 'airbnb-base', 'prettier'], + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + plugins: ['vue'], + rules: { + 'import/no-cycle': 0, + 'import/prefer-default-export': 0, + 'import/order': 0, + 'no-lonely-if': 0, + 'no-unused-expressions': 0, + 'vue/multi-word-component-names': [ + 'error', + { + ignores: ['401', '404', 'Pagination', 'login', 'register', 'index', 'Navbar', 'Link', 'Logo'], + }, + ], + 'no-use-before-define': 0, + 'import/no-extraneous-dependencies': 0, + 'no-restricted-syntax': 0, + 'no-continue': 0, + 'guard-for-in': 0, + 'no-param-reassign': 0, + 'no-plusplus': 0, + 'no-shadow': 0, + 'import/extensions': 0, + 'func-names': 0, + }, +}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 840c164..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true, - "node": true - }, - "extends": [ - "plugin:vue/vue3-essential", - "airbnb-base" - ], - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": [ - "vue" - ], - "rules": { - } -} diff --git a/.gitignore b/.gitignore index 78a752d..128a7ac 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ selenium-debug.log # Editor directories and files .idea -.vscode +# .vscode *.suo *.ntvs* *.njsproj diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..f15266c --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,9 @@ +module.exports = { + printWidth: 120, + tabWidth: 2, + semi: true, + singleQuote: true, + trailingComma: 'all', + bracketSpacing: false, + arrowParens: 'always', +}; diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..88860d6 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": ["Vue.volar", "pmneo.tsimporter", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1b6457c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" +} diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..abe04df --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/package.json b/package.json index 1b40d56..e54559e 100644 --- a/package.json +++ b/package.json @@ -36,11 +36,14 @@ "@vue/compiler-sfc": "3.2.31", "eslint": "^8.21.0", "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-prettier": "^8.5.0", "eslint-config-standard": "^17.0.0", + "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.26.0", "eslint-plugin-n": "^15.2.4", "eslint-plugin-promise": "^6.0.0", "eslint-plugin-vue": "^9.3.0", + "prettier": "2.7.1", "sass": "1.50.0", "unplugin-auto-import": "0.6.9", "vite": "2.6.14", diff --git a/vite.config.js b/vite.config.js index 2519f4a..9c8dcf5 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,11 +1,11 @@ -import { defineConfig, loadEnv } from 'vite'; +import {defineConfig, loadEnv} from 'vite'; import path from 'path'; import createVitePlugins from './vite/plugins'; // https://vitejs.dev/config/ -export default defineConfig(({ mode, command }) => { +export default defineConfig(({mode, command}) => { const env = loadEnv(mode, process.cwd()); - const { VITE_APP_ENV } = env; + const {VITE_APP_ENV} = env; return { // 部署生产环境和开发环境下的URL。 // 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上 @@ -25,7 +25,6 @@ export default defineConfig(({ mode, command }) => { }, // vite 相关配置 server: { - port: 80, host: '127.0.0.1', open: true, proxy: {