style(projects): 格式化代码

This commit is contained in:
Soybean 2021-07-20 10:07:35 +08:00
parent 1e393eb9d4
commit d680e7d931
7 changed files with 54 additions and 7 deletions

View File

@ -3,18 +3,37 @@ module.exports = {
browser: true,
es2021: true
},
extends: ['plugin:vue/vue3-recommended', 'airbnb-base', 'plugin:prettier/recommended'],
parser: 'vue-eslint-parser',
parserOptions: {
ecmaVersion: 12,
parser: '@typescript-eslint/parser',
sourceType: 'module'
},
plugins: ['vue', '@typescript-eslint'],
extends: [
'plugin:vue/vue3-recommended',
'airbnb-base',
'@vue/typescript/recommended',
'plugin:prettier/recommended',
'@vue/prettier/@typescript-eslint'
],
rules: {
'no-unused-vars': 1,
'import/extensions': ['error', 'never'],
'import/no-extraneous-dependencies': [2, { devDependencies: true }],
'import/no-unresolved': 0,
'no-shadow': 0
'no-shadow': 0,
'import/prefer-default-export': 0,
'vue/no-deprecated-slot-attribute': 1,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { ignoreRestSiblings: true }]
}
};

View File

@ -32,6 +32,8 @@
"@typescript-eslint/parser": "^4.28.4",
"@vitejs/plugin-vue": "^1.2.5",
"@vue/compiler-sfc": "^3.1.5",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"cz-customizable": "^6.3.0",

View File

@ -181,7 +181,7 @@ const plugins = [
];
/** 引入element-plus UI组件 */
export default function setupElementPlus(app: App<Element>) {
export default function setupElementPlus(app: App<Element>): void {
/** 国际化 */
locale.use(lang);
components.forEach(component => {

View File

@ -1,6 +1,6 @@
import smoothscroll from 'smoothscroll-polyfill';
/** 平滑滚动插件(兼容主流浏览器) */
export default function setupSmoothScroll() {
export default function setupSmoothScroll(): void {
smoothscroll.polyfill();
}

View File

@ -23,7 +23,7 @@ export const errorDuration = 3000 / 1000;
*
* @param error -
*/
export function errorHandler(error: any) {
export function errorHandler(error: any): void {
if (error.response) {
const status = error.response.status as ErrorStatus;
ElMessage.error(ERROR_STATUS[status]);

View File

@ -35,7 +35,7 @@ export default class CustomAxiosInstance {
}
/** 设置请求拦截器 */
setInterceptor(statusConfig: StatusConfig) {
setInterceptor(statusConfig: StatusConfig): void {
this.instance.interceptors.request.use(
config => {
const handleConfig = { ...config };

View File

@ -567,6 +567,20 @@
"@vue/compiler-dom" "3.1.5"
"@vue/shared" "3.1.5"
"@vue/eslint-config-prettier@^6.0.0":
version "6.0.0"
resolved "https://registry.npm.taobao.org/@vue/eslint-config-prettier/download/@vue/eslint-config-prettier-6.0.0.tgz#ad5912b308f4ae468458e02a2b05db0b9d246700"
integrity sha1-rVkSswj0rkaEWOAqKwXbC50kZwA=
dependencies:
eslint-config-prettier "^6.0.0"
"@vue/eslint-config-typescript@^7.0.0":
version "7.0.0"
resolved "https://registry.npm.taobao.org/@vue/eslint-config-typescript/download/@vue/eslint-config-typescript-7.0.0.tgz#220c70c2edf7a253e739298525f4d401b8ef0038"
integrity sha1-Igxwwu33olPnOSmFJfTUAbjvADg=
dependencies:
vue-eslint-parser "^7.0.0"
"@vue/reactivity@3.0.11":
version "3.0.11"
resolved "https://registry.nlark.com/@vue/reactivity/download/@vue/reactivity-3.0.11.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vue%2Freactivity%2Fdownload%2F%40vue%2Freactivity-3.0.11.tgz#07b588349fd05626b17f3500cbef7d4bdb4dbd0b"
@ -1518,6 +1532,13 @@ eslint-config-airbnb-base@^14.2.1:
object.assign "^4.1.2"
object.entries "^1.1.2"
eslint-config-prettier@^6.0.0:
version "6.15.0"
resolved "https://registry.nlark.com/eslint-config-prettier/download/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9"
integrity sha1-f5P2y31FqS8VN6cOzAY2bhrG/tk=
dependencies:
get-stdin "^6.0.0"
eslint-config-prettier@^8.3.0:
version "8.3.0"
resolved "https://registry.nlark.com/eslint-config-prettier/download/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a"
@ -1964,6 +1985,11 @@ get-own-enumerable-property-symbols@^3.0.0:
resolved "https://registry.nlark.com/get-own-enumerable-property-symbols/download/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664"
integrity sha1-tf3nfyLL4185C04ImSLFC85u9mQ=
get-stdin@^6.0.0:
version "6.0.0"
resolved "https://registry.nlark.com/get-stdin/download/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
integrity sha1-ngm/cSs2CrkiXoEgSPcf3pyJZXs=
get-stream@^6.0.0:
version "6.0.1"
resolved "https://registry.npm.taobao.org/get-stream/download/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
@ -4294,7 +4320,7 @@ vscode-vue-languageservice@^0.26.0:
vscode-pug-languageservice "^0.26.5"
vscode-typescript-languageservice "^0.26.5"
vue-eslint-parser@^7.9.0:
vue-eslint-parser@^7.0.0, vue-eslint-parser@^7.9.0:
version "7.9.0"
resolved "https://registry.nlark.com/vue-eslint-parser/download/vue-eslint-parser-7.9.0.tgz#5eeedc71f22ebc7b18b957d1ab171acf29a41e64"
integrity sha1-Xu7ccfIuvHsYuVfRqxcazymkHmQ=