chore: eslint

pull/35/head
xingyu 2023-09-20 10:20:30 +08:00
parent 4726b7448f
commit ceec03d98d
14 changed files with 428 additions and 381 deletions

View File

@ -3,24 +3,8 @@ const process = require('node:process')
process.env.ESLINT_TSCONFIG = 'tsconfig.json'
module.exports = {
extends: ['@antfu', '@unocss'],
extends: ['@xingyuv', '@unocss'],
rules: {
'max-len': ['error', { code: 140, tabWidth: 2, ignoreComments: true }],
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'prefer-promise-reject-errors': 'off',
'no-case-declarations': 'off',
'no-console': 'off',
'n/prefer-global/process': 'off',
'jsdoc/no-multi-asterisks': 'off',
'jsdoc/valid-types': 'off',
'jsdoc/check-param-names': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/require-returns-check': 'off',
},
}

View File

@ -60,7 +60,7 @@
"cron-parser": "^4.9.0",
"cropperjs": "^1.6.1",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.9",
"dayjs": "^1.11.10",
"echarts": "^5.4.3",
"lodash-es": "^4.17.21",
"nprogress": "^0.2.0",
@ -82,7 +82,6 @@
"xlsx": "^0.18.5"
},
"devDependencies": {
"@antfu/eslint-config": "^0.42.1",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@iconify/json": "^2.2.117",
@ -96,10 +95,11 @@
"@types/nprogress": "^0.2.0",
"@types/qs": "^6.9.8",
"@types/sortablejs": "^1.15.2",
"@unocss/eslint-config": "^0.55.7",
"@unocss/eslint-config": "^0.56.0",
"@vitejs/plugin-vue": "4.3.4",
"@vitejs/plugin-vue-jsx": "^3.0.2",
"@vue/compiler-sfc": "^3.3.4",
"@xingyuv/eslint-config": "^0.1.6",
"cross-env": "^7.0.3",
"cz-git": "^1.7.1",
"czg": "^1.7.1",
@ -128,7 +128,7 @@
"stylelint-prettier": "^4.0.2",
"terser": "^5.19.4",
"typescript": "^5.2.2",
"unocss": "^0.55.7",
"unocss": "^0.56.0",
"vite": "^4.4.9",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-mkcert": "^1.16.0",

File diff suppressed because it is too large Load Diff

View File

@ -43,10 +43,7 @@ function handleRemove(record: PreviewFileItem) {
if (index !== -1) {
const removed = fileListRef.value.splice(index, 1)
emit('delete', removed[0].url)
emit(
'list-change',
fileListRef.value.map(item => item.url),
)
emit('list-change', fileListRef.value.map(item => item.url))
}
}

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/await-thenable */
import type { RouteLocationNormalized, Router } from 'vue-router'
import { useRouter } from 'vue-router'

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/require-await */
import type { RouteLocationNormalized, Router } from 'vue-router'
import { Modal, notification } from 'ant-design-vue'
import { unref } from 'vue'
@ -124,7 +125,7 @@ export function createMessageGuard(router: Router) {
}
}
catch (error) {
warn(`message guard error:${error}`)
warn(`message guard error:${error as any}`)
}
return true
})

View File

@ -8,7 +8,7 @@ import { usePermissionStoreWithOut } from '@/store/modules/permission'
export function createParamMenuGuard(router: Router) {
const permissionStore = usePermissionStoreWithOut()
router.beforeEach(async (to, _, next) => {
router.beforeEach((to, _, next) => {
// filter no name route
if (!to.name) {
next()

10
src/types/config.d.ts vendored
View File

@ -1,14 +1,14 @@
import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '@/enums/menuEnum'
import {
import type { MenuModeEnum, MenuTypeEnum, MixSidebarTriggerEnum, TriggerEnum } from '@/enums/menuEnum'
import type {
ContentEnum,
PermissionModeEnum,
ThemeEnum,
RouterTransitionEnum,
SessionTimeoutProcessingEnum,
SettingButtonPositionEnum,
SessionTimeoutProcessingEnum
ThemeEnum,
} from '@/enums/appEnum'
import { CacheTypeEnum } from '@/enums/cacheEnum'
import type { CacheTypeEnum } from '@/enums/cacheEnum'
export type LocaleType = 'zh_CN' | 'en' | 'ru' | 'ja' | 'ko'

View File

@ -1,4 +1,4 @@
import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue'
import type { ComponentPublicInstance, ComponentRenderProxy, FunctionalComponent, VNode, VNodeChild, PropType as VuePropType } from 'vue'
declare global {
const __APP_INFO__: {
@ -26,10 +26,10 @@ declare global {
declare type Nullable<T> = T | null
declare type NonNullable<T> = T extends null | undefined ? never : T
declare type Recordable<T = any> = Record<string, T>
declare type ReadonlyRecordable<T = any> = {
declare interface ReadonlyRecordable<T = any> {
readonly [key: string]: T
}
declare type Indexable<T = any> = {
declare interface Indexable<T = any> {
[key: string]: T
}
declare type DeepPartial<T> = {

10
src/types/module.d.ts vendored
View File

@ -1,13 +1,15 @@
declare module '*.vue' {
import { DefineComponent } from 'vue'
const Component: DefineComponent<{}, {}, any>
import type { DefineComponent } from 'vue'
const Component: DefineComponent<object, object, any>
export default Component
}
declare module 'ant-design-vue/es/locale/*' {
import { Locale } from 'ant-design-vue/types/locale-provider'
import type { Locale } from 'ant-design-vue/types/locale-provider'
const locale: Locale & ReadonlyRecordable
export default locale as Locale & ReadonlyRecordable
export default locale
}
declare module 'virtual:*' {

View File

@ -1,5 +1,5 @@
import { ErrorTypeEnum } from '@/enums/exceptionEnum'
import { MenuModeEnum, MenuTypeEnum } from '@/enums/menuEnum'
import type { ErrorTypeEnum } from '@/enums/exceptionEnum'
import type { MenuModeEnum, MenuTypeEnum } from '@/enums/menuEnum'
// Lock screen information
export interface LockInfo {

View File

@ -1,4 +1,4 @@
import { RoleEnum } from '@/enums/roleEnum'
import type { RoleEnum } from '@/enums/roleEnum'
export {}

View File

@ -24,7 +24,6 @@ const [registerAccountDesc] = useDescription({
const [registerDrawer, { setDrawerProps }] = useDrawerInner(async (data) => {
setDrawerProps({ loading: true })
const res = await getUser(data.id)
console.info(res)
userInfo.value = res
loading.value = false
setDrawerProps({ loading: false })

View File

@ -1,30 +1,30 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "esnext"],
"jsx": "preserve",
"experimentalDecorators": true,
"noLib": false,
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"noLib": false,
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"strictFunctionTypes": false,
"jsx": "preserve",
"baseUrl": ".",
"allowJs": true,
"sourceMap": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"experimentalDecorators": true,
"lib": ["dom", "esnext"],
"noImplicitAny": false,
"skipLibCheck": true,
"types": ["vite/client"],
"removeComments": true,
"paths": {
"@/*": ["src/*"]
}
},
"types": ["vite/client"],
"resolveJsonModule": true,
"allowJs": true,
"sourceMap": true,
"removeComments": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"strictFunctionTypes": false,
"noImplicitAny": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true
},
"include": [
"src/**/*.ts",