Skip to content

Commit 4a12c3a

Browse files
committed
refactor: 全局格式化 🌟🌟🌟
1 parent 3d35f9e commit 4a12c3a

File tree

38 files changed

+5218
-4462
lines changed

38 files changed

+5218
-4462
lines changed

SECURITY.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Reporting a Vulnerability
22

3-
to ensure your application remains as secure as possible,To report a vulnerability, please email `1469442702@qq.com`.
3+
to ensure your application remains as secure as possible,To report a vulnerability, please email **1469442702@qq.com**.
44

55
# 报告漏洞
66

7-
为了确保您的应用程序尽可能安全,要报告漏洞,请发送电子邮件 `1469442702@qq.com`
7+
为了确保您的应用程序尽可能安全,要报告漏洞,请发送电子邮件 **1469442702@qq.com**

docs/.vitepress/cache/deps/_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
}
1111
},
1212
"chunks": {}
13-
}
13+
}
+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
{"type":"module"}
1+
{
2+
"type": "module"
3+
}

docs/.vitepress/cache/deps/vue.js

+5,129-4,361
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/.vitepress/config.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default defineConfig({
2727
markdown: {
2828
// 自定义 markdown 语法
2929
// => fightingPlugin(md)
30-
config: (md) => {
30+
config: md => {
3131
mdPlugin(md)
3232
// md.use(demoBlockPlugin, {
3333
// customClass: 'demoblock-custom',
@@ -61,6 +61,5 @@ export default defineConfig({
6161
// ]
6262
// })
6363
}
64-
6564
}
6665
})

docs/.vitepress/config/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type MarkdownIt from 'markdown-it'
66

77
/**
88
* 导出自定义插件方法
9-
*
9+
*
1010
* @param md markdown 实例
1111
*/
1212
export const fightingPlugin = (md: MarkdownIt): void => {

docs/.vitepress/config/plugin-code.ts

+5-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type Token from 'markdown-it/lib/token'
33

44
/**
55
* 渲染代码片段和描述内容
6-
*
6+
*
77
* @param md markdown 实例
88
*/
99
export const pluginCode = (md: MarkdownIt): void => {
@@ -16,12 +16,7 @@ export const pluginCode = (md: MarkdownIt): void => {
1616
*/
1717
const defaultRender = md.renderer.rules.fence
1818

19-
md.renderer.rules.fence = (
20-
tokens: Token[],
21-
idx: number,
22-
options: MarkdownIt.Options,
23-
env: any,
24-
): string => {
19+
md.renderer.rules.fence = (tokens: Token[], idx: number, options: MarkdownIt.Options, env: any): string => {
2520
/**
2621
* 获取到每一项
2722
*/
@@ -33,12 +28,12 @@ export const pluginCode = (md: MarkdownIt): void => {
3328
/**
3429
* 检测当前是否为 demo 自定义代码段
3530
*/
36-
const isInDemoContainer: boolean = prevToken && prevToken.nesting === 1 && prevToken.info.trim().match(/^demo\s*(.*)$/)
37-
31+
const isInDemoContainer: boolean =
32+
prevToken && prevToken.nesting === 1 && prevToken.info.trim().match(/^demo\s*(.*)$/)
3833

3934
/**
4035
* 如果是自定义代码段落,则继续获取里面的内容返回知道插槽内容
41-
*
36+
*
4237
* 否则返回默认的内容
4338
*/
4439
if (token.info.trim() === lang && isInDemoContainer) {

docs/.vitepress/config/plugin-demo.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import type Token from 'markdown-it/lib/token'
44

55
/**
66
* 自定义 markdown 语法
7-
*
7+
*
88
* ::: demo 代码片段展示
9-
*
9+
*
1010
* @param md markdown 实例
1111
*/
1212
export const pluginDemo = (md: MarkdownIt): void => {
@@ -32,4 +32,4 @@ export const pluginDemo = (md: MarkdownIt): void => {
3232
return '</vp-demo>'
3333
}
3434
})
35-
}
35+
}

docs/.vitepress/config/plugin-render.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import type MarkdownIt from 'markdown-it'
44

55
/**
66
* 将字符串内容渲染成为组件
7-
*
7+
*
88
* @param md markdown 实例
99
*/
1010
export const pluginRender = (md: MarkdownIt): void => {
1111
const sfcRegexp: RegExp = createSfcRegexp({ customBlocks: [TAG_NAME_TEMPLATE] })
1212
const render = md.render.bind(md)
1313

1414
/**
15-
*
15+
*
1616
* @param content 文档内容
1717
* @param env 环境对象
1818
*/
@@ -47,4 +47,4 @@ export const pluginRender = (md: MarkdownIt): void => {
4747

4848
return rendered
4949
}
50-
}
50+
}

docs/.vitepress/config/render.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ let seed = 0
1616

1717
/**
1818
* 将字符串解析为组件
19-
*
19+
*
2020
* @param content 代码内容部分
21-
* @returns
21+
* @returns
2222
*/
2323
export const renderComponent = (content: string): RenderComponentReturn | null => {
2424
if (!content) return null
@@ -77,7 +77,6 @@ export const renderComponent = (content: string): RenderComponentReturn | null =
7777
let pageScript = ''
7878

7979
if (componentsString) {
80-
8180
pageScript = `<script lang="ts">
8281
import * as Vue from 'vue'
8382
${scriptImports?.join(os.EOL)}

docs/.vitepress/config/utils.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { SFCTemplateCompileOptions } from '@vue/compiler-sfc'
55
export const stripScript = (content: string, id: string): string => {
66
/**
77
* 匹配到 js 部分代码段
8-
*
8+
*
99
* match() 方法检索返回一个字符串匹配正则表达式的结果
1010
* @see match https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/match
1111
*/
@@ -37,10 +37,10 @@ export const stripStyle = (content: string): string => {
3737

3838
/**
3939
* 编写例子时不一定有 template,所以采取的方案是剔除其他的内容
40-
*
40+
*
4141
* @see trim https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
4242
* @param content 模板内容字符串
43-
* @returns
43+
* @returns
4444
*/
4545
export const stripTemplate = (content: string): string => {
4646
content = content.trim()
@@ -50,11 +50,7 @@ export const stripTemplate = (content: string): string => {
5050
return content ? content.replace(ScriptOrStyleReplacePattern, '').trim() : content
5151
}
5252

53-
export const genInlineComponentText = (
54-
id: number,
55-
template: string,
56-
script: string
57-
): string => {
53+
export const genInlineComponentText = (id: number, template: string, script: string): string => {
5854
let source = template
5955
if (TemplateReplacePattern.test(source)) {
6056
source = source.replace(TemplateReplacePattern, '$1')
@@ -92,7 +88,7 @@ export const genInlineComponentText = (
9288
{
9389
searchValue: /import ({.*}) from 'fighting-design'/g,
9490
replaceValue: (s, s1) => `const ${s1} = FightingDesign`
95-
},
91+
}
9692
// {
9793
// searchValue: /import type ({.*}) from 'fighting-design'/g,
9894
// replaceValue: (s, s1) => `const ${s1} = FightingDesign`

docs/.vitepress/theme/components/src/search-list.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
export type SearchList = { title: string, rule: string, url: string }[]
1+
export type SearchList = { title: string; rule: string; url: string }[]
32

43
/**
54
* 搜索列表

docs/.vitepress/utils/nav.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { version } from '../../../packages/fighting-design/package.json'
22

33
/**
44
* 顶部导航栏菜单
5-
*
5+
*
66
* @see Nav https://vitepress.vuejs.org/guide/theme-nav#nav
77
*/
88
export const nav = [

docs/components/_demos/color/demo1.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
<template>
2929
<div class="f-color-box">
3030
<div v-for="(item, index) in colorList" :key="index" class="f-color-list">
31-
<div v-for="(color, i) in item" :key="i" class="f-color-item" :style="{ background: color }" @click="handleClick(color)">
31+
<div
32+
v-for="(color, i) in item"
33+
:key="i"
34+
class="f-color-item"
35+
:style="{ background: color }"
36+
@click="handleClick(color)"
37+
>
3238
<f-text>{{ color }}</f-text>
3339
</div>
3440
</div>

docs/components/_demos/dialog/demo3.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@
2222
<template>
2323
<f-button type="primary" @click="visible3 = true">打开</f-button>
2424

25-
<f-dialog v-model:visible="visible3" title="Title" :on-open="open" :on-open-end="openEnd" :on-close="close" :on-close-end="closeEnd">
25+
<f-dialog
26+
v-model:visible="visible3"
27+
title="Title"
28+
:on-open="open"
29+
:on-open-end="openEnd"
30+
:on-close="close"
31+
:on-close-end="closeEnd"
32+
>
2633
<h3>沁园春·雪</h3>
2734

2835
<p>北国风光,千里冰封,万里雪飘。</p>

docs/components/link.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
</template>
6666

6767
```html
68-
<f-link href="" state="line" type="primary">带有下划线</f-link> <f-link href="" state="bag" type="danger">hover 一下试试</f-link>
68+
<f-link href="" state="line" type="primary">带有下划线</f-link>
69+
<f-link href="" state="bag" type="danger">hover 一下试试</f-link>
6970
```
7071

7172
:::

docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"markdown-it": "^13.0.1",
1414
"markdown-it-container": "^3.0.0"
1515
}
16-
}
16+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@
7272
"git add"
7373
]
7474
}
75-
}
75+
}

packages/fighting-design/_hooks/use-list/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ export const useList = <T extends object>(prop: T, name: string): UseListReturn
9494
* 因为 prop 参数的键都是驼峰命名法,所以这里要转换为短横线连接命名
9595
*/
9696
styleList[`--f-${name}-${convertFormat(key)}`] = pixel
97-
? isNumber(propList[key]) ? sizeChange(propList[key] as number) : propList[key]
97+
? isNumber(propList[key])
98+
? sizeChange(propList[key] as number)
99+
: propList[key]
98100
: propList[key]
99101
}
100102
}

packages/fighting-design/_hooks/use-load-img/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export const useLoadImg = (prop: UseLoadImgProp): UseLoadImgReturn => {
1919
const isSuccess = ref<boolean>(true)
2020
/**
2121
* 是否展示节点元素
22-
*
22+
*
2323
* 因为在加载过程中 img 会展示一个撕裂的标志
24-
*
24+
*
2525
* 所以使用变量控制显示和隐藏
2626
*/
2727
const isShowNode = ref<boolean>(false)

packages/fighting-design/_hooks/use-ripples/index.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@ export * from './interface.d'
55

66
/**
77
* 点击的涟漪效果
8-
*
8+
*
99
* @param evt 事件对象
1010
* @param node 元素节点
1111
* @param options 配置对象
1212
*/
1313
export const useRipples = (evt: MouseEvent, node: HTMLElement, options: RipplesOptions): UseRipplesReturn => {
14-
1514
/**
1615
* 计算涟漪颜色
1716
*
1817
* 如果设置了 ripplesColor 则直接返回
19-
*
18+
*
2019
* 在 simple 和 text 模式下,根据 type 返回颜色
21-
*
20+
*
2221
* 否则返回默认白色
2322
*/
2423
const ripplesColor = computed((): string => {
25-
2624
if (options.ripplesColor) {
2725
return options.ripplesColor
2826
}
@@ -69,7 +67,6 @@ export const useRipples = (evt: MouseEvent, node: HTMLElement, options: RipplesO
6967
* @return { HTMLElement }
7068
*/
7169
const renderElement = (x: number, y: number): HTMLElement => {
72-
7370
/**
7471
* 新建个 span 元素
7572
*/
@@ -80,7 +77,6 @@ export const useRipples = (evt: MouseEvent, node: HTMLElement, options: RipplesO
8077

8178
// 如果是按钮,则需要添加容器
8279
if (options.component === 'f-button') {
83-
8480
const box: HTMLDivElement = document.createElement('div')
8581
box.className = 'f-button__ripples-box'
8682

packages/fighting-design/_hooks/use-ripples/interface.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface RipplesOptions {
2525

2626
/**
2727
* ripples 方法事件类型接口
28-
*
28+
*
2929
* @param layerX x 轴坐标
3030
* @param layerY y 轴坐标
3131
*/
@@ -36,7 +36,7 @@ export interface RipplesEvt extends Event {
3636

3737
/**
3838
* ripples 返回值类型接口
39-
*
39+
*
4040
* @param runRipples 生成涟漪方法
4141
*/
4242
export interface UseRipplesReturn {

packages/fighting-design/_hooks/use-tree-data/index.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ export * from './interface.d'
77

88
/**
99
* 针对 tree 组件的树形结构的处理
10-
*
10+
*
1111
* @param data 树形结构
12-
* @returns
12+
* @returns
1313
*/
1414
export const useTreeData = (data: TreeData): UseTreeDataReturn => {
15-
1615
/**
1716
* 处理后的树形结构
1817
*/
@@ -25,7 +24,7 @@ export const useTreeData = (data: TreeData): UseTreeDataReturn => {
2524

2625
/**
2726
* 隐藏节点方法
28-
*
27+
*
2928
* @param tree 树形结构
3029
*/
3130
const hidden = (tree: TreeData): void => {
@@ -40,7 +39,7 @@ export const useTreeData = (data: TreeData): UseTreeDataReturn => {
4039

4140
/**
4241
* 获取到指定的元素进行操作
43-
*
42+
*
4443
* @param data 树形结构
4544
* @param id id
4645
*/

packages/fighting-design/_utils/tree/interface.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* 扁平的树形结构类型接口
3-
*
3+
*
44
* @param label label
55
* @param level 标识
66
* @param show 是否展示

0 commit comments

Comments
 (0)