diff --git a/.eslintrc.js b/.eslintrc.js
index 975fdef..28d4e0e 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,22 +1,52 @@
module.exports = {
root: true,
env: {
+ browser: true,
node: true,
+ es6: true,
},
extends: ["plugin:vue/vue3-essential", "eslint:recommended", "@vue/prettier"],
parserOptions: {
- "parser": "babel-eslint"
+ "parser": "babel-eslint",
+ "sourceType": 'module',
+ "ecmaVersion": 2020,
},
rules: {
- "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
- "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
+ "no-console": 0,
+ 'no-use-before-define': 'off',
+ 'no-unused-vars': [
+ 'warn',
+ {
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ },
+ ],
+ 'no-prototype-builtins': 'off',
+ 'space-before-function-paren': 'off',
+ 'vue/custom-event-name-casing': 'off',
+ 'vue/attributes-order': 'off',
+ 'vue/one-component-per-file': 'off',
+ 'vue/html-closing-bracket-newline': 'off',
+ 'vue/max-attributes-per-line': 'off',
+ 'vue/multiline-html-element-content-newline': 'off',
+ 'vue/singleline-html-element-content-newline': 'off',
+ 'vue/attribute-hyphenation': 'off',
+ 'vue/require-default-prop': 'off',
+ 'vue/no-unused-components': 'warn',
+ 'vue/no-setup-props-destructure': 'off',
"prettier/prettier": [
"warn",
{
- // singleQuote: none,
- // semi: false,
- trailingComma: "es5",
- },
- ],
+ 'printWidth': 80, // 每行代码长度(默认80)
+ 'tabWidth': 2, // 每个tab相当于多少个空格(默认2)
+ 'useTabs': false, // 是否使用tab进行缩进(默认false)
+ 'singleQuote': true, // 使用单引号(默认false)
+ 'semi': true, // 声明结尾使用分号(默认true)
+ 'trailingComma': 'es5', // 多行使用拖尾逗号(默认none)
+ 'bracketSpacing': true, // 对象字面量的大括号间使用空格(默认true)
+ 'jsxBracketSameLine': false, // 多行JSX中的>放置在最后一行的结尾,而不是另起一行(默认false)
+ 'arrowParens': 'avoid', // 只有一个参数的箭头函数的参数是否带括号(默认avoid)
+ }
+ ]
},
};
diff --git a/package.json b/package.json
index 8acd8f0..4529d0c 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"build": "vite build",
"build:mock": "vite build --mode mock",
"serve": "vite preview",
- "lint": "eslint --ext .js,.vue src"
+ "lint": "eslint --fix --ext .js,.vue src"
},
"browserslist": [
"> 1%",
diff --git a/prettier.config.js b/prettier.config.js
deleted file mode 100644
index c5e6901..0000000
--- a/prettier.config.js
+++ /dev/null
@@ -1,11 +0,0 @@
-module.exports = {
- printWidth: 80, // 每行代码长度(默认80)
- tabWidth: 2, // 每个tab相当于多少个空格(默认2)
- useTabs: false, // 是否使用tab进行缩进(默认false)
- singleQuote: false, // 使用单引号(默认false)
- semi: true, // 声明结尾使用分号(默认true)
- trailingComma: 'es5', // 多行使用拖尾逗号(默认none)
- bracketSpacing: true, // 对象字面量的大括号间使用空格(默认true)
- jsxBracketSameLine: false, // 多行JSX中的>放置在最后一行的结尾,而不是另起一行(默认false)
- arrowParens: "avoid", // 只有一个参数的箭头函数的参数是否带圆括号(默认avoid)
-};
\ No newline at end of file
diff --git a/src/App.vue b/src/App.vue
index 5c52862..ca18d1d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -10,4 +10,4 @@ body,
margin: 0;
padding: 0;
}
-
\ No newline at end of file
+
diff --git a/src/api/login.js b/src/api/login.js
index 337c996..8df8379 100644
--- a/src/api/login.js
+++ b/src/api/login.js
@@ -1,10 +1,10 @@
-import request from '@/utils/request'
+import request from '@/utils/request';
// 登录接口
export const Login = data => {
return request({
- url: "/api/login",
- method: "post",
+ url: '/api/login',
+ method: 'post',
data,
});
};
@@ -12,7 +12,7 @@ export const Login = data => {
// 获取登录用户信息
export const GetUserinfo = () => {
return request({
- url: "/api/userinfo",
- method: "get"
+ url: '/api/userinfo',
+ method: 'get',
});
-};
\ No newline at end of file
+};
diff --git a/src/api/menu.js b/src/api/menu.js
index c89f39d..719ecc2 100644
--- a/src/api/menu.js
+++ b/src/api/menu.js
@@ -1,10 +1,9 @@
-import request from '@/utils/request'
-
+import request from '@/utils/request';
// 获取菜单
export const GetMenus = () => {
return request({
- url: "/api/menus",
- method: "get"
+ url: '/api/menus',
+ method: 'get',
});
-};
\ No newline at end of file
+};
diff --git a/src/components/ProTable/index.vue b/src/components/ProTable/index.vue
index fdf41af..81a21b2 100644
--- a/src/components/ProTable/index.vue
+++ b/src/components/ProTable/index.vue
@@ -212,42 +212,42 @@
\ No newline at end of file
+
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index f622f13..c3c33ef 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -10,10 +10,10 @@
-
\ No newline at end of file
+
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index c5c71ac..fbb924b 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -3,10 +3,10 @@
@@ -15,4 +15,4 @@ export default defineComponent({
.home {
color: $mainColor;
}
-
\ No newline at end of file
+
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index d6a7afc..bcbea50 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -43,12 +43,12 @@ import {
toRefs,
ref,
computed,
-} from "vue";
-import { Login } from "@/api/login";
-import { useStore } from "vuex";
-import { useRouter, useRoute } from "vue-router";
+} from 'vue';
+import { Login } from '@/api/login';
+import { useStore } from 'vuex';
+import { useRouter, useRoute } from 'vue-router';
export default defineComponent({
- name: "login",
+ name: 'login',
setup() {
const { ctx } = getCurrentInstance(); // 可以把ctx当成vue2中的this
const store = useStore();
@@ -56,42 +56,42 @@ export default defineComponent({
const route = useRoute();
const state = reactive({
model: {
- userName: "admin",
- password: "123456",
+ userName: 'admin',
+ password: '123456',
},
rules: {
userName: [
- { required: true, message: "请输入用户名", trigger: "blur" },
+ { required: true, message: '请输入用户名', trigger: 'blur' },
],
password: [
- { required: true, message: "请输入密码", trigger: "blur" },
+ { required: true, message: '请输入密码', trigger: 'blur' },
{
min: 6,
max: 12,
- message: "长度在 6 到 12 个字符",
- trigger: "blur",
+ message: '长度在 6 到 12 个字符',
+ trigger: 'blur',
},
],
},
loading: false,
- btnText: computed(() => (state.loading ? "登录中..." : "登录")),
+ btnText: computed(() => (state.loading ? '登录中...' : '登录')),
loginForm: ref(null),
submit: () => {
if (state.loading) {
return;
}
- state.loginForm.validate(async (valid) => {
+ state.loginForm.validate(async valid => {
if (valid) {
state.loading = true;
const { code, data, message } = await Login(state.model);
if (+code === 200) {
ctx.$message.success({
- message: "登录成功",
+ message: '登录成功',
duration: 1000,
});
const targetPath = route.query.redirect;
- router.push(!!targetPath ? targetPath : "/");
- store.commit("app/setToken", data);
+ router.push(targetPath ? targetPath : '/');
+ store.commit('app/setToken', data);
} else {
ctx.$message.error(message);
}
@@ -146,4 +146,4 @@ export default defineComponent({
}
}
}
-
\ No newline at end of file
+
diff --git a/src/views/redirect/index.vue b/src/views/redirect/index.vue
index 19fceaa..8d96bf2 100644
--- a/src/views/redirect/index.vue
+++ b/src/views/redirect/index.vue
@@ -1,8 +1,10 @@
diff --git a/src/views/test/Add.vue b/src/views/test/Add.vue
index c421ab9..6c5f784 100644
--- a/src/views/test/Add.vue
+++ b/src/views/test/Add.vue
@@ -4,4 +4,4 @@
如果不需要在菜单中显示:
需要配置路由增加属性hidden: true,注意不是在meta中增加该属性,而是跟meta同级
-
\ No newline at end of file
+
diff --git a/src/views/test/Auth.vue b/src/views/test/Auth.vue
index a561153..cef9e5a 100644
--- a/src/views/test/Auth.vue
+++ b/src/views/test/Auth.vue
@@ -6,4 +6,4 @@