代码风格调整

This commit is contained in:
Baymax Zhang
2022-10-24 19:32:23 +08:00
parent 88b86e064f
commit 01147f574f
9 changed files with 80 additions and 25 deletions

43
.eslintrc.js Normal file
View File

@@ -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,
},
};

View File

@@ -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": {
}
}

2
.gitignore vendored
View File

@@ -12,7 +12,7 @@ selenium-debug.log
# Editor directories and files # Editor directories and files
.idea .idea
.vscode # .vscode
*.suo *.suo
*.ntvs* *.ntvs*
*.njsproj *.njsproj

9
.prettierrc.js Normal file
View File

@@ -0,0 +1,9 @@
module.exports = {
printWidth: 120,
tabWidth: 2,
semi: true,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
arrowParens: 'always',
};

9
.vscode/extensions.json vendored Normal file
View File

@@ -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": []
}

4
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}

8
jsconfig.json Normal file
View File

@@ -0,0 +1,8 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

View File

@@ -36,11 +36,14 @@
"@vue/compiler-sfc": "3.2.31", "@vue/compiler-sfc": "3.2.31",
"eslint": "^8.21.0", "eslint": "^8.21.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^17.0.0", "eslint-config-standard": "^17.0.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.4", "eslint-plugin-n": "^15.2.4",
"eslint-plugin-promise": "^6.0.0", "eslint-plugin-promise": "^6.0.0",
"eslint-plugin-vue": "^9.3.0", "eslint-plugin-vue": "^9.3.0",
"prettier": "2.7.1",
"sass": "1.50.0", "sass": "1.50.0",
"unplugin-auto-import": "0.6.9", "unplugin-auto-import": "0.6.9",
"vite": "2.6.14", "vite": "2.6.14",

View File

@@ -1,11 +1,11 @@
import { defineConfig, loadEnv } from 'vite'; import {defineConfig, loadEnv} from 'vite';
import path from 'path'; import path from 'path';
import createVitePlugins from './vite/plugins'; import createVitePlugins from './vite/plugins';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => { export default defineConfig(({mode, command}) => {
const env = loadEnv(mode, process.cwd()); const env = loadEnv(mode, process.cwd());
const { VITE_APP_ENV } = env; const {VITE_APP_ENV} = env;
return { return {
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上
@@ -25,7 +25,6 @@ export default defineConfig(({ mode, command }) => {
}, },
// vite 相关配置 // vite 相关配置
server: { server: {
port: 80,
host: '127.0.0.1', host: '127.0.0.1',
open: true, open: true,
proxy: { proxy: {