Skip to content

Commit

Permalink
style: 优化 undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyh2001 committed May 6, 2024
1 parent 6b50518 commit 3a0fed1
Show file tree
Hide file tree
Showing 25 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/fighting-add-component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ detectPublic()
function fetchCompName (): string {
const input: string = process.argv[2]

if (input === undefined) {
if (input === void 0) {
logError(
'\n' +
'命令使用方法为: pnpm new <component-name>' +
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/_utils/compatible/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const objectEntries = <T extends object>(obj: T): [keyof T, T[keyof T]][]
}

// 如果 Object.entries 存在则直接使用
if (Object.entries && Object.entries !== undefined) {
if (Object.entries && Object.entries !== void 0) {
return Object.entries(obj) as [keyof T, T[keyof T]][]
}

Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/_utils/is/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const isFunction = (value: any): value is Function => typeof value === 'f
export const isArray = Array.isArray

/** 是否为浏览器环境 */
export const isBrowser: boolean = typeof window !== 'undefined'
export const isBrowser: boolean = typeof window !== void 0

/**
* 是否为真值
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/alert/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Props = {
* @values default primary success danger warning info
* @default undefined
*/
type: setStringProp<FightingType>(undefined, (val: FightingType): boolean => {
type: setStringProp<FightingType>(void 0, (val: FightingType): boolean => {
return FIGHTING_TYPE.includes(val)
}),
/** 文字大小 */
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/avatar-group/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const Props = {
* @see object-fit https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit#try_it
* @values fill contain cover none scale-down
*/
fit: setStringProp<FightingFit>(undefined, (val: FightingFit): boolean => {
fit: setStringProp<FightingFit>(void 0, (val: FightingFit): boolean => {
return FIGHTING_FIT.includes(val)
})
} as const
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/avatar/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const Props = {
* @see object-fit https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit#try_it
* @values fill contain cover none scale-down
*/
fit: setStringProp<FightingFit>(undefined, (val: FightingFit): boolean => {
fit: setStringProp<FightingFit>(void 0, (val: FightingFit): boolean => {
return FIGHTING_FIT.includes(val)
}),
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/button-group/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Props = {
*
* @values large middle small mini
*/
size: setStringProp<FightingSize>(undefined, (val: FightingSize): boolean => {
size: setStringProp<FightingSize>(void 0, (val: FightingSize): boolean => {
return FIGHTING_SIZE.includes(val)
}),
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/fighting-design/button/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Props = {
*
* @values large middle small mini
*/
size: setStringProp<FightingSize>(undefined, (val: FightingSize): boolean => {
size: setStringProp<FightingSize>(void 0, (val: FightingSize): boolean => {
return FIGHTING_SIZE.includes(val)
}),
/** 是否为块级元素 */
Expand Down Expand Up @@ -64,7 +64,7 @@ export const Props = {
*
* @values default primary success danger warning info
*/
type: setStringProp<FightingType>(undefined, (val: FightingType): boolean => {
type: setStringProp<FightingType>(void 0, (val: FightingType): boolean => {
return FIGHTING_TYPE.includes(val)
}),
/** 是否自动获取焦点 */
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/card/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Props = {
*
* @values hover always
*/
shadow: setStringProp<CardShadow>(undefined, (val: CardShadow): boolean => {
shadow: setStringProp<CardShadow>(void 0, (val: CardShadow): boolean => {
return (['hover', 'always'] as const).includes(val)
}),
/** 自定义边框颜色 */
Expand Down
4 changes: 2 additions & 2 deletions packages/fighting-design/fighting-global/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export const Props = {
*
* @values large middle small mini
*/
size: setStringProp<FightingSize>(undefined, (val: FightingSize): boolean => {
size: setStringProp<FightingSize>(void 0, (val: FightingSize): boolean => {
return FIGHTING_SIZE.includes(val)
}),
/**
* 按钮的类型(非自定义按钮颜色时有效)
*
* @values default primary success danger warning info
*/
type: setStringProp<FightingType>(undefined, (val: FightingType): boolean => {
type: setStringProp<FightingType>(void 0, (val: FightingType): boolean => {
return FIGHTING_TYPE.includes(val)
}),
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/image/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const Props = {
* @values fill contain cover none scale-down
* @see object-fit https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit#try_it
*/
fit: setStringProp<FightingFit>(undefined, (val: FightingFit): boolean => {
fit: setStringProp<FightingFit>(void 0, (val: FightingFit): boolean => {
return FIGHTING_FIT.includes(val)
}),
/** 是否可以选中 */
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/input/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const Props = {
*
* @values large middle small mini
*/
size: setStringProp<FightingSize>(undefined, (val: FightingSize): boolean => {
size: setStringProp<FightingSize>(void 0, (val: FightingSize): boolean => {
return FIGHTING_SIZE.includes(val)
}),
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/layout/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const Props = {
* @values horizontal vertical
*/
direction: setStringProp<LayoutDirection>(
undefined,
void 0,
(val: LayoutDirection): boolean => {
return (['horizontal', 'vertical'] as const).includes(val)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/fighting-design/link/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Props = {
*
* @values default primary success danger warning
*/
type: setStringProp<FightingType>(undefined, (val: FightingType): boolean => {
type: setStringProp<FightingType>(void 0, (val: FightingType): boolean => {
return FIGHTING_TYPE.includes(val)
}),
/**
Expand All @@ -37,7 +37,7 @@ export const Props = {
*
* @values line background
*/
state: setStringProp<LinkState>(undefined, (val: LinkState): boolean => {
state: setStringProp<LinkState>(void 0, (val: LinkState): boolean => {
return (['line', 'background'] as const).includes(val)
}),
/** 是否禁用 */
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/notification/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Props = {
*
* @values default primary success danger warning
*/
type: setStringProp<FightingType>(undefined, (val: FightingType): boolean => {
type: setStringProp<FightingType>(void 0, (val: FightingType): boolean => {
return FIGHTING_TYPE.includes(val)
}),
/** 是否可关闭 */
Expand Down
4 changes: 2 additions & 2 deletions packages/fighting-design/option/src/option.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
/** 尝试查找到有效的值 */
const effectiveValue = values.find((value: any): boolean => {
// null、undefined、NaN 判断为假
if (value === null || value === undefined || Number.isNaN(value)) {
if (value === null || value === void 0 || Number.isNaN(value)) {
return false
}
Expand All @@ -110,7 +110,7 @@
})
// 如果三个值都为假,返回最后一个
return effectiveValue !== undefined ? effectiveValue : values[values.length - 1]
return effectiveValue !== void 0 ? effectiveValue : values[values.length - 1]
}
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/ripple/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Props = {
*
* @values default primary success danger warning
*/
type: setStringProp<FightingType>(undefined, (val: FightingType): boolean => {
type: setStringProp<FightingType>(void 0, (val: FightingType): boolean => {
return FIGHTING_TYPE.includes(val)
}),
/** 是否禁用 */
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/space/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Props = {
*
* @values large middle small mini
*/
spacing: setStringProp<FightingSize>(undefined, (val: FightingSize): boolean => {
spacing: setStringProp<FightingSize>(void 0, (val: FightingSize): boolean => {
return FIGHTING_SIZE.includes(val)
}),
/** 自定义纵向间距 */
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/swap/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Props = {
*
* @values sound swap
*/
type: setStringProp<SwapType>(undefined, (val: SwapType): boolean => {
type: setStringProp<SwapType>(void 0, (val: SwapType): boolean => {
return (['sound', 'swap'] as const).includes(val)
}),
/** 打开展示的图标 */
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/switch/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Props = {
*
* @values large middle small mini
*/
size: setStringProp<FightingSize>(undefined, (val: FightingSize): boolean => {
size: setStringProp<FightingSize>(void 0, (val: FightingSize): boolean => {
return FIGHTING_SIZE.includes(val)
}),
/** 是否禁用 */
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/tabs/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Props = {
* @see justify-content https://developer.mozilla.org/zh-CN/docs/Web/CSS/justify-content
*/
justifyContent: setStringProp<TabsJustifyContent>(
undefined,
void 0,
(val: TabsJustifyContent): boolean => {
return (
[
Expand Down
4 changes: 2 additions & 2 deletions packages/fighting-design/tag/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Props = {
*
* @values default primary success danger warning info
*/
type: setStringProp<FightingType>(undefined, (val: FightingType): boolean => {
type: setStringProp<FightingType>(void 0, (val: FightingType): boolean => {
return FIGHTING_TYPE.includes(val)
}),
/** 是否可关闭 */
Expand All @@ -39,7 +39,7 @@ export const Props = {
*
* @values large middle small mini
*/
size: setStringProp<FightingSize>(undefined, (val: FightingSize): boolean => {
size: setStringProp<FightingSize>(void 0, (val: FightingSize): boolean => {
return FIGHTING_SIZE.includes(val)
}),
/** 是否为简约模式 */
Expand Down
4 changes: 2 additions & 2 deletions packages/fighting-design/text/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Props = {
*
* @values default primary success danger warning
*/
type: setStringProp<FightingType>(undefined, (val: FightingType): boolean => {
type: setStringProp<FightingType>(void 0, (val: FightingType): boolean => {
return FIGHTING_TYPE.includes(val)
}),
/**
Expand Down Expand Up @@ -67,7 +67,7 @@ export const Props = {
* @see text-decoration https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-decoration
* @values overline line-through underline
*/
decoration: setStringProp<TextDecoration>(undefined, (val: TextDecoration): boolean => {
decoration: setStringProp<TextDecoration>(void 0, (val: TextDecoration): boolean => {
return (['overline', 'line-through', 'underline'] as const).includes(val)
}),
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/textarea/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const Props = {
* @see resize https://developer.mozilla.org/zh-CN/docs/Web/CSS/resize
* @values none both horizontal vertical
*/
resize: setStringProp<TextareaResize>(undefined, (val: TextareaResize): boolean => {
resize: setStringProp<TextareaResize>(void 0, (val: TextareaResize): boolean => {
return (['none', 'both', 'horizontal', 'vertical'] as const).includes(val)
}),
/** 是否可清空 */
Expand Down
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default (): UserConfigExport => {
entryFileNames: 'index.umd.js',
chunkFileNames: '[name].js',
assetFileNames: '[name].[ext]',
manualChunks: undefined,
manualChunks: void 0,
inlineDynamicImports: false,
globals: {
vue: 'Vue'
Expand Down Expand Up @@ -155,7 +155,7 @@ export default (): UserConfigExport => {
/**
* @see output.manualchunks https://cn.rollupjs.org/configuration-options/#output-manualchunks
*/
manualChunks: undefined,
manualChunks: void 0,
/**
* 使用原始模块名作为文件名
*
Expand Down Expand Up @@ -185,7 +185,7 @@ export default (): UserConfigExport => {
chunkFileNames: '[name].js',
assetFileNames: '[name].[ext]',
inlineDynamicImports: false,
manualChunks: undefined,
manualChunks: void 0,
preserveModules: true,
generatedCode: {
symbols: true
Expand Down

0 comments on commit 3a0fed1

Please sign in to comment.