Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Bug 终结者
vue-vben-admin
提交
6890dd72
V
vue-vben-admin
项目概览
Bug 终结者
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6890dd72
编写于
4月 06, 2023
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf: 新包使用更严格的eslint
上级
762e5dee
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
96 addition
and
46 deletion
+96
-46
internal/eslint-config/.eslintrc.js
internal/eslint-config/.eslintrc.js
+1
-1
internal/eslint-config/src/strict.ts
internal/eslint-config/src/strict.ts
+46
-7
internal/stylelint-config/.eslintrc.js
internal/stylelint-config/.eslintrc.js
+1
-1
internal/vite-config/.eslintrc.js
internal/vite-config/.eslintrc.js
+1
-1
internal/vite-config/src/config/application.ts
internal/vite-config/src/config/application.ts
+8
-4
internal/vite-config/src/config/common.ts
internal/vite-config/src/config/common.ts
+2
-2
internal/vite-config/src/config/package.ts
internal/vite-config/src/config/package.ts
+6
-3
internal/vite-config/src/plugins/appConfig.ts
internal/vite-config/src/plugins/appConfig.ts
+3
-2
internal/vite-config/src/plugins/index.ts
internal/vite-config/src/plugins/index.ts
+9
-8
internal/vite-config/src/plugins/svgSprite.ts
internal/vite-config/src/plugins/svgSprite.ts
+2
-1
internal/vite-config/src/plugins/visualizer.ts
internal/vite-config/src/plugins/visualizer.ts
+1
-1
internal/vite-config/src/utils/env.ts
internal/vite-config/src/utils/env.ts
+2
-1
internal/vite-config/src/utils/modifyVars.ts
internal/vite-config/src/utils/modifyVars.ts
+3
-2
packages/hooks/.eslintrc.js
packages/hooks/.eslintrc.js
+1
-1
packages/hooks/src/index.ts
packages/hooks/src/index.ts
+0
-1
packages/hooks/src/onMountedOrActivated.ts
packages/hooks/src/onMountedOrActivated.ts
+1
-1
packages/hooks/src/useAttrs.ts
packages/hooks/src/useAttrs.ts
+1
-1
packages/hooks/src/useRefs.ts
packages/hooks/src/useRefs.ts
+1
-1
packages/types/.eslintrc.js
packages/types/.eslintrc.js
+1
-1
packages/types/src/utils.ts
packages/types/src/utils.ts
+6
-6
未找到文件。
internal/eslint-config/.eslintrc.js
浏览文件 @
6890dd72
module
.
exports
=
{
root
:
true
,
extends
:
[
'
@vben
'
],
extends
:
[
'
@vben
/eslint-config/strict
'
],
};
internal/eslint-config/src/strict.ts
浏览文件 @
6890dd72
import
baseLintConfig
from
'
./index
'
;
export
default
{
extends
:
[
baseLintConfig
],
extends
:
[
'
@vben
'
],
plugins
:
[
'
simple-import-sort
'
],
rules
:
{
'
simple-import-sort/imports
'
:
'
error
'
,
'
simple-import-sort/exports
'
:
'
error
'
,
'
@typescript-eslint/ban-types
'
:
'
error
'
,
'
@typescript-eslint/ban-ts-ignore
'
:
'
error
'
,
'
@typescript-eslint/ban-ts-comment
'
:
'
error
'
,
'
@typescript-eslint/no-explicit-any
'
:
'
error
'
,
'
@typescript-eslint/ban-ts-comment
'
:
[
'
error
'
,
{
'
ts-expect-error
'
:
'
allow-with-description
'
,
'
ts-ignore
'
:
'
allow-with-description
'
,
'
ts-nocheck
'
:
'
allow-with-description
'
,
'
ts-check
'
:
false
,
},
],
/**
* 【强制】关键字前后有一个空格
* @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
*/
'
keyword-spacing
'
:
'
off
'
,
'
@typescript-eslint/keyword-spacing
'
:
[
'
error
'
,
{
before
:
true
,
after
:
true
,
overrides
:
{
return
:
{
after
:
true
},
throw
:
{
after
:
true
},
case
:
{
after
:
true
},
},
},
],
/**
* 禁止出现空函数,普通函数(非 async/await/generator)、箭头函数、类上的方法除外
* @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
*/
'
no-empty-function
'
:
'
off
'
,
'
@typescript-eslint/no-empty-function
'
:
[
'
error
'
,
{
allow
:
[
'
arrowFunctions
'
,
'
functions
'
,
'
methods
'
],
},
],
/**
* 优先使用 interface 而不是 type 定义对象类型
* @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
*/
'
@typescript-eslint/consistent-type-definitions
'
:
[
'
warn
'
,
'
interface
'
],
'
vue/attributes-order
'
:
'
error
'
,
'
vue/require-default-prop
'
:
'
error
'
,
...
...
internal/stylelint-config/.eslintrc.js
浏览文件 @
6890dd72
module
.
exports
=
{
root
:
true
,
extends
:
[
'
@vben
'
],
extends
:
[
'
@vben
/eslint-config/strict
'
],
};
internal/vite-config/.eslintrc.js
浏览文件 @
6890dd72
module
.
exports
=
{
root
:
true
,
extends
:
[
'
@vben
'
],
extends
:
[
'
@vben
/eslint-config/strict
'
],
};
internal/vite-config/src/config/application.ts
浏览文件 @
6890dd72
import
{
type
UserConfig
,
defineConfig
,
mergeConfig
,
loadEnv
}
from
'
vite
'
;
import
{
resolve
}
from
'
node:path
'
;
import
dayjs
from
'
dayjs
'
;
import
{
readPackageJSON
}
from
'
pkg-types
'
;
import
{
defineConfig
,
loadEnv
,
mergeConfig
,
type
UserConfig
}
from
'
vite
'
;
import
{
createPlugins
}
from
'
../plugins
'
;
import
{
generateModifyVars
}
from
'
../utils/modifyVars
'
;
import
{
commonConfig
}
from
'
./common
'
;
import
{
createPlugins
}
from
'
../plugins
'
;
import
dayjs
from
'
dayjs
'
;
interface
DefineOptions
{
overrides
?:
UserConfig
;
options
?:
{};
options
?:
{
//
};
}
function
defineApplicationConfig
(
defineOptions
:
DefineOptions
=
{})
{
...
...
internal/vite-config/src/config/common.ts
浏览文件 @
6890dd72
import
{
type
UserConfig
}
from
'
vite
'
;
import
UnoCSS
from
'
unocss/vite
'
;
import
{
presetTypography
,
presetUno
}
from
'
unocss
'
;
import
UnoCSS
from
'
unocss/vite
'
;
import
{
type
UserConfig
}
from
'
vite
'
;
const
commonConfig
:
UserConfig
=
{
server
:
{
...
...
internal/vite-config/src/config/package.ts
浏览文件 @
6890dd72
import
{
type
UserConfig
,
defineConfig
,
mergeConfig
}
from
'
vite
'
;
import
{
readPackageJSON
}
from
'
pkg-types
'
;
import
{
commonConfig
}
from
'
./common
'
;
import
{
defineConfig
,
mergeConfig
,
type
UserConfig
}
from
'
vite
'
;
import
dts
from
'
vite-plugin-dts
'
;
import
{
commonConfig
}
from
'
./common
'
;
interface
DefineOptions
{
overrides
?:
UserConfig
;
options
?:
{};
options
?:
{
//
};
}
function
definePackageConfig
(
defineOptions
:
DefineOptions
=
{})
{
...
...
internal/vite-config/src/plugins/appConfig.ts
浏览文件 @
6890dd72
import
colors
from
'
picocolors
'
;
import
{
readPackageJSON
}
from
'
pkg-types
'
;
import
{
type
PluginOption
}
from
'
vite
'
;
import
{
getEnvConfig
}
from
'
../utils/env
'
;
import
{
createContentHash
}
from
'
../utils/hash
'
;
import
{
readPackageJSON
}
from
'
pkg-types
'
;
import
colors
from
'
picocolors
'
;
const
GLOBAL_CONFIG_FILE_NAME
=
'
_app.config.js
'
;
const
PLUGIN_NAME
=
'
app-config
'
;
...
...
internal/vite-config/src/plugins/index.ts
浏览文件 @
6890dd72
import
vue
from
'
@vitejs/plugin-vue
'
;
import
vueJsx
from
'
@vitejs/plugin-vue-jsx
'
;
// @ts-ignore: type unless
import
DefineOptions
from
'
unplugin-vue-define-options/vite
'
;
import
{
type
PluginOption
}
from
'
vite
'
;
import
purgeIcons
from
'
vite-plugin-purge-icons
'
;
import
{
createAppConfigPlugin
}
from
'
./appConfig
'
;
import
{
configCompressPlugin
}
from
'
./compress
'
;
import
{
configHtmlPlugin
}
from
'
./html
'
;
import
{
configMockPlugin
}
from
'
./mock
'
;
import
{
configCompressPlugin
}
from
'
./compress
'
;
import
{
configVisualizerConfig
}
from
'
./visualizer
'
;
import
{
configSvgIconsPlugin
}
from
'
./svgSprite
'
;
import
{
createAppConfigPlugin
}
from
'
./appConfig
'
;
import
vue
from
'
@vitejs/plugin-vue
'
;
import
vueJsx
from
'
@vitejs/plugin-vue-jsx
'
;
import
purgeIcons
from
'
vite-plugin-purge-icons
'
;
// @ts-ignore
import
DefineOptions
from
'
unplugin-vue-define-options/vite
'
;
import
{
configVisualizerConfig
}
from
'
./visualizer
'
;
interface
Options
{
isBuild
:
boolean
;
...
...
internal/vite-config/src/plugins/svgSprite.ts
浏览文件 @
6890dd72
...
...
@@ -3,9 +3,10 @@
* https://github.com/anncwb/vite-plugin-svg-icons
*/
import
{
createSvgIconsPlugin
}
from
'
vite-plugin-svg-icons
'
;
import
{
resolve
}
from
'
node:path
'
;
import
type
{
PluginOption
}
from
'
vite
'
;
import
{
createSvgIconsPlugin
}
from
'
vite-plugin-svg-icons
'
;
export
function
configSvgIconsPlugin
({
isBuild
}:
{
isBuild
:
boolean
})
{
const
svgIconsPlugin
=
createSvgIconsPlugin
({
...
...
internal/vite-config/src/plugins/visualizer.ts
浏览文件 @
6890dd72
/**
* Package file volume analysis
*/
import
{
type
PluginOption
}
from
'
vite
'
;
import
visualizer
from
'
rollup-plugin-visualizer
'
;
import
{
type
PluginOption
}
from
'
vite
'
;
export
function
configVisualizerConfig
()
{
return
visualizer
({
...
...
internal/vite-config/src/utils/env.ts
浏览文件 @
6890dd72
import
{
join
}
from
'
node:path
'
;
import
dotenv
from
'
dotenv
'
;
import
{
readFile
}
from
'
fs-extra
'
;
import
{
join
}
from
'
node:path
'
;
/**
* 获取当前环境下生效的配置文件名
...
...
internal/vite-config/src/utils/modifyVars.ts
浏览文件 @
6890dd72
import
{
generate
}
from
'
@ant-design/colors
'
;
import
{
resolve
}
from
'
node:path
'
;
// @ts-ignore
import
{
generate
}
from
'
@ant-design/colors
'
;
// @ts-ignore: typo
import
{
getThemeVariables
}
from
'
ant-design-vue/dist/theme
'
;
const
primaryColor
=
'
#0960bd
'
;
...
...
packages/hooks/.eslintrc.js
浏览文件 @
6890dd72
module
.
exports
=
{
root
:
true
,
extends
:
[
'
@vben
'
],
extends
:
[
'
@vben
/eslint-config/strict
'
],
};
packages/hooks/src/index.ts
浏览文件 @
6890dd72
export
*
from
'
./onMountedOrActivated
'
;
export
*
from
'
./useAttrs
'
;
export
*
from
'
./useRefs
'
;
export
{
useTimeoutFn
}
from
'
@vueuse/core
'
;
packages/hooks/src/onMountedOrActivated.ts
浏览文件 @
6890dd72
import
{
type
AnyFunction
}
from
'
@vben/types
'
;
import
{
nextTick
,
on
Mounted
,
onActiva
ted
}
from
'
vue
'
;
import
{
nextTick
,
on
Activated
,
onMoun
ted
}
from
'
vue
'
;
/**
* 在 OnMounted 或者 OnActivated 时触发
...
...
packages/hooks/src/useAttrs.ts
浏览文件 @
6890dd72
import
{
getCurrentInstance
,
reactive
,
shallowRef
,
watchEffect
}
from
'
vue
'
;
import
{
type
Recordable
}
from
'
@vben/types
'
;
import
{
getCurrentInstance
,
reactive
,
shallowRef
,
watchEffect
}
from
'
vue
'
;
interface
Options
{
excludeListeners
?:
boolean
;
...
...
packages/hooks/src/useRefs.ts
浏览文件 @
6890dd72
import
type
{
Ref
}
from
'
vue
'
;
import
{
ref
,
onBeforeUpdate
}
from
'
vue
'
;
import
{
onBeforeUpdate
,
ref
}
from
'
vue
'
;
export
function
useRefs
():
[
Ref
<
HTMLElement
[]
>
,
(
index
:
number
)
=>
(
el
:
HTMLElement
)
=>
void
]
{
const
refs
=
ref
([])
as
Ref
<
HTMLElement
[]
>
;
...
...
packages/types/.eslintrc.js
浏览文件 @
6890dd72
module
.
exports
=
{
root
:
true
,
extends
:
[
'
@vben
'
],
extends
:
[
'
@vben
/eslint-config/strict
'
],
};
packages/types/src/utils.ts
浏览文件 @
6890dd72
...
...
@@ -31,9 +31,9 @@ type Recordable<T> = Record<string, T>;
/**
* 字符串类型对象(只读)
*/
type
ReadonlyRecordable
<
T
=
any
>
=
{
interface
ReadonlyRecordable
<
T
=
any
>
{
readonly
[
key
:
string
]:
T
;
}
;
}
/**
* setTimeout 返回值类型
...
...
@@ -47,12 +47,12 @@ type IntervalHandle = ReturnType<typeof setInterval>;
export
{
type
AnyFunction
,
type
AnyPromiseFunction
,
type
AnyNormalFunction
,
type
Nullable
,
type
AnyPromiseFunction
,
type
IntervalHandle
,
type
NonNullable
,
type
Record
able
,
type
Null
able
,
type
ReadonlyRecordable
,
type
Recordable
,
type
TimeoutHandle
,
type
IntervalHandle
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录