Skip to content

Commit ca3dccc

Browse files
committed
refactor: f2elint
1 parent d3b3bae commit ca3dccc

File tree

578 files changed

+21362
-21280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

578 files changed

+21362
-21280
lines changed

.dumi/plugin-gallery/gallery.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ type ComponentGroup = {
1717
}[]
1818
}
1919

20-
const components: ComponentGroup[] =
21-
ComponentConfig['menus']['zh']['/zh/components']
20+
const components: ComponentGroup[] = ComponentConfig['menus']['zh']['/zh/components']
2221

2322
const demos = Object.keys(DemosConfig)
2423

@@ -29,9 +28,7 @@ components.forEach(group => {
2928
group.children.forEach(item => {
3029
const keyArrs = item.path.split('/')
3130
const key = keyArrs[keyArrs.length - 1]
32-
componentToDemoPaths[key] = demos.filter(val =>
33-
val.startsWith(`${key}-demo`)
34-
)
31+
componentToDemoPaths[key] = demos.filter(val => val.startsWith(`${key}-demo`))
3532
componentToTitle[key] = item.title
3633
})
3734
})
@@ -116,10 +113,7 @@ export default props => {
116113
{currentComponent && currentDemoIndex !== null && (
117114
<div className={classNames(styles.body, styles.demoBody)}>
118115
<iframe
119-
src={
120-
'/~demos/' +
121-
componentToDemoPaths[currentComponent][currentDemoIndex]
122-
}
116+
src={'/~demos/' + componentToDemoPaths[currentComponent][currentDemoIndex]}
123117
style={{
124118
width: window.innerWidth,
125119
height: '100%',

.dumi/theme/builtins/Alert.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import React from 'react'
22
import './Alert.less'
33

4-
export default (props: any) => (
5-
<div className='__dumi-default-alert' {...props} />
6-
)
4+
export default (props: any) => <div className='__dumi-default-alert' {...props} />

.dumi/theme/builtins/Badge.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import React from 'react'
22
import './Badge.less'
33

4-
export default (props: any) => (
5-
<span className='__dumi-default-badge' {...props} />
6-
)
4+
export default (props: any) => <span className='__dumi-default-badge' {...props} />

.dumi/theme/builtins/SourceCode.less

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
//position: relative;
55
font-size: 13px;
66
& > .prism-code {
7-
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
8-
'Liberation Mono', monospace;
7+
font-family:
8+
ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
99
}
1010
background-color: @c-light-bg;
1111
border-radius: 12px;
@@ -44,7 +44,9 @@
4444
outline: none;
4545
cursor: pointer;
4646
opacity: 0.6;
47-
transition: opacity 0.2s, background 0.2s;
47+
transition:
48+
opacity 0.2s,
49+
background 0.2s;
4850

4951
&:hover {
5052
opacity: 0.8;

.dumi/theme/builtins/SourceCode.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ export default ({ code, lang, showCopy = true }: ICodeBlockProps) => {
1616

1717
return (
1818
<div className='__dumi-default-code-block'>
19-
<Highlight
20-
{...defaultProps}
21-
code={code}
22-
language={lang}
23-
theme={undefined}
24-
>
19+
<Highlight {...defaultProps} code={code} language={lang} theme={undefined}>
2520
{({ className, style, tokens, getLineProps, getTokenProps }) => (
2621
<pre className={className} style={style}>
2722
{showCopy && (

.dumi/theme/builtins/preview-default/Previewer.less

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
height: @s-btn;
4949
border-radius: 50%;
5050
background-color: #fd6458;
51-
box-shadow: (@s-btn + @s-btn-gap) 0 0 #ffbf2b,
51+
box-shadow:
52+
(@s-btn + @s-btn-gap) 0 0 #ffbf2b,
5253
(@s-btn + @s-btn-gap) * 2 0 0 #24cc3d;
5354
}
5455
}
@@ -113,12 +114,7 @@
113114

114115
[data-prefers-color='dark'] & {
115116
color: @c-heading-dark;
116-
background: linear-gradient(
117-
to top,
118-
@c-bg-dark,
119-
@c-bg-dark 50%,
120-
rgba(255, 255, 255, 0)
121-
)
117+
background: linear-gradient(to top, @c-bg-dark, @c-bg-dark 50%, rgba(255, 255, 255, 0))
122118
100%;
123119
}
124120
}
@@ -162,7 +158,9 @@
162158
cursor: pointer;
163159
opacity: 0.6;
164160
outline: none;
165-
transition: opacity 0.2s, background 0.2s;
161+
transition:
162+
opacity 0.2s,
163+
background 0.2s;
166164

167165
[data-prefers-color='dark'] & {
168166
opacity: 1;
@@ -321,7 +319,9 @@
321319
position: absolute;
322320
height: 2px;
323321
background: @c-primary;
324-
transition: left 0.2s, width 0.2s;
322+
transition:
323+
left 0.2s,
324+
width 0.2s;
325325
pointer-events: none;
326326

327327
[data-prefers-color='dark'] & {

.dumi/theme/builtins/preview-default/Previewer.tsx

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ export interface IPreviewerProps extends IPreviewerComponentProps {
4242
* @param file file path
4343
* @param source file source object
4444
*/
45-
function getSourceType(
46-
file: string,
47-
source: IPreviewerComponentProps['sources']['_']
48-
) {
45+
function getSourceType(file: string, source: IPreviewerComponentProps['sources']['_']) {
4946
// use file extension as source type first
5047
let type = file.match(/\.(\w+)$/)?.[1]
5148

@@ -62,14 +59,9 @@ const Previewer: React.FC<IPreviewerProps> = oProps => {
6259
const props = useLocaleProps<IPreviewerProps>(locale, oProps)
6360
const isActive = history?.location.hash === `#${props.identifier}`
6461
const isSingleFile = Object.keys(props.sources).length === 1
65-
const openCSB = useCodeSandbox(
66-
props.hideActions?.includes('CSB') ? null : props
67-
)
62+
const openCSB = useCodeSandbox(props.hideActions?.includes('CSB') ? null : props)
6863

69-
const [execMotions, isMotionRunning] = useMotions(
70-
props.motions || [],
71-
demoRef.current
72-
)
64+
const [execMotions, isMotionRunning] = useMotions(props.motions || [], demoRef.current)
7365
const [copyCode, copyStatus] = useCopy()
7466
const [currentFile, setCurrentFile] = useState('_')
7567
const [sourceType, setSourceType] = useState(
@@ -99,12 +91,8 @@ const Previewer: React.FC<IPreviewerProps> = oProps => {
9991
data-debug={props.debug || undefined}
10092
>
10193
<div className='__dumi-default-previewer-desc' data-title={props.title}>
102-
{props.title && (
103-
<AnchorLink to={`#${props.identifier}`}>{props.title}</AnchorLink>
104-
)}
105-
{props.description && (
106-
<div dangerouslySetInnerHTML={{ __html: props.description }} />
107-
)}
94+
{props.title && <AnchorLink to={`#${props.identifier}`}>{props.title}</AnchorLink>}
95+
{props.description && <div dangerouslySetInnerHTML={{ __html: props.description }} />}
10896
</div>
10997
<div className='__dumi-default-previewer-actions'>
11098
{props.debug && <span className='debug-badge'>Debug Only</span>}
@@ -156,10 +144,7 @@ const Previewer: React.FC<IPreviewerProps> = oProps => {
156144
<Tabs.Tab
157145
title={
158146
filename === '_'
159-
? `index.${getSourceType(
160-
filename,
161-
props.sources[filename]
162-
)}`
147+
? `index.${getSourceType(filename, props.sources[filename])}`
163148
: filename
164149
}
165150
key={filename}
@@ -168,11 +153,7 @@ const Previewer: React.FC<IPreviewerProps> = oProps => {
168153
</Tabs>
169154
)}
170155
<div className='__dumi-default-previewer-source'>
171-
<SourceCode
172-
code={currentFileCode}
173-
lang={sourceType}
174-
showCopy={false}
175-
/>
156+
<SourceCode code={currentFileCode} lang={sourceType} showCopy={false} />
176157
</div>
177158
</div>
178159
</div>

.dumi/theme/builtins/preview-default/use-code-sandbox.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,7 @@ export function useCodeSandbox(
167167
input.value = value
168168
}
169169
addField('parameters', data)
170-
addField(
171-
'query',
172-
'file=/app.tsx&resolutionWidth=375&resolutionHeight=700'
173-
)
170+
addField('query', 'file=/app.tsx&resolutionWidth=375&resolutionHeight=700')
174171

175172
form.setAttribute('data-demo', opts.title || '')
176173

.dumi/theme/components/Dark.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ const Dark: FC<darkProps> = ({ darkSwitch, onDarkSwitchClick, isSideMenu }) => {
8080
title='Dark theme'
8181
onClick={ev => changeColor(ev, baseColor)}
8282
className={`__dumi-default-dark-moon ${
83-
baseColor === prefersColor
84-
? '__dumi-default-dark-switch-active'
85-
: ''
83+
baseColor === prefersColor ? '__dumi-default-dark-switch-active' : ''
8684
}`}
8785
>
8886
{moonSvg}
@@ -95,9 +93,7 @@ const Dark: FC<darkProps> = ({ darkSwitch, onDarkSwitchClick, isSideMenu }) => {
9593
title='Light theme'
9694
onClick={ev => changeColor(ev, baseColor)}
9795
className={`__dumi-default-dark-sun ${
98-
baseColor === prefersColor
99-
? '__dumi-default-dark-switch-active'
100-
: ''
96+
baseColor === prefersColor ? '__dumi-default-dark-switch-active' : ''
10197
}`}
10298
>
10399
{sunSvg}
@@ -110,9 +106,7 @@ const Dark: FC<darkProps> = ({ darkSwitch, onDarkSwitchClick, isSideMenu }) => {
110106
title='Default to system'
111107
onClick={ev => changeColor(ev, baseColor)}
112108
className={`__dumi-default-dark-auto ${
113-
baseColor === prefersColor
114-
? '__dumi-default-dark-switch-active'
115-
: ''
109+
baseColor === prefersColor ? '__dumi-default-dark-switch-active' : ''
116110
}`}
117111
>
118112
{autoSvg}
@@ -132,9 +126,7 @@ const Dark: FC<darkProps> = ({ darkSwitch, onDarkSwitchClick, isSideMenu }) => {
132126
{isSideMenu ? allState.map(item => getSvg(item)) : getSvg(prefersColor)}
133127
</div>
134128
{!isSideMenu && darkSwitch && (
135-
<div className='__dumi-default-dark-switch-list'>
136-
{list.map(item => getSvg(item))}
137-
</div>
129+
<div className='__dumi-default-dark-switch-list'>{list.map(item => getSvg(item))}</div>
138130
)}
139131
</div>
140132
)

.dumi/theme/components/LocaleSelect.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ const LocaleSelect: FC<{ location: any }> = ({ location }) => {
1818
function getLocaleTogglePath(target: string) {
1919
const baseWithoutLocale = base.replace(`/${locale}`, '')
2020
const pathnameWithoutLocale =
21-
location.pathname.replace(
22-
new RegExp(`^${base}(/|$)`),
23-
`${baseWithoutLocale}$1`
24-
) || '/'
21+
location.pathname.replace(new RegExp(`^${base}(/|$)`), `${baseWithoutLocale}$1`) || '/'
2522

2623
// append locale prefix to path if it is not the default locale
2724
if (target !== locales[0].name) {
@@ -39,12 +36,9 @@ const LocaleSelect: FC<{ location: any }> = ({ location }) => {
3936
return pathnameWithoutLocale
4037
}
4138

42-
const [localeInStorage, setLocaleInStorage] = useLocalStorageState(
43-
'adm-doc-locale',
44-
{
45-
defaultValue: navigator.language.startsWith('zh') ? 'zh' : 'en',
46-
}
47-
)
39+
const [localeInStorage, setLocaleInStorage] = useLocalStorageState('adm-doc-locale', {
40+
defaultValue: navigator.language.startsWith('zh') ? 'zh' : 'en',
41+
})
4842

4943
useEffect(() => {
5044
if (localeInStorage !== locale) {
@@ -53,10 +47,7 @@ const LocaleSelect: FC<{ location: any }> = ({ location }) => {
5347
}, [])
5448

5549
return firstDiffLocale ? (
56-
<div
57-
className='__dumi-default-locale-select'
58-
data-locale-count={locales.length}
59-
>
50+
<div className='__dumi-default-locale-select' data-locale-count={locales.length}>
6051
<Link
6152
to={getLocaleTogglePath(firstDiffLocale.name)}
6253
onClick={() => {

0 commit comments

Comments
 (0)