Skip to content

Commit 1d6281c

Browse files
committed
chore: format code.
1 parent 965264a commit 1d6281c

21 files changed

+175
-144
lines changed

.kktrc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ export default (conf: Configuration, env: 'production' | 'development', options:
4040
conf.output = { ...conf.output, publicPath: './' };
4141
}
4242
return conf;
43-
}
43+
};

renovate.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
"extends": [
3-
"config:base"
4-
]
2+
"extends": ["config:base"]
53
}

src/components/Loading.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
export default function Loading() {
22
return (
3-
<div style={{ color: '#fff', minHeight: 100, display: 'flex', textAlign: 'center', justifyContent: 'center', alignItems: 'center' }}>
3+
<div
4+
style={{
5+
color: '#fff',
6+
minHeight: 100,
7+
display: 'flex',
8+
textAlign: 'center',
9+
justifyContent: 'center',
10+
alignItems: 'center',
11+
}}
12+
>
413
<span>Loading...</span>
514
</div>
6-
)
7-
}
15+
);
16+
}

src/components/Search.module.less

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
.input {
32
max-width: 420px;
43
}
@@ -14,9 +13,9 @@
1413
}
1514
a {
1615
color: #669eb9;
17-
transition: color .3s;
16+
transition: color 0.3s;
1817
&:hover {
1918
color: #78bfe0;
2019
}
2120
}
22-
}
21+
}

src/components/Search.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
import { useState, Fragment} from 'react';
1+
import { useState, Fragment } from 'react';
22
import Input from '@uiw/react-input';
33
import Button from '@uiw/react-button';
44
import { useDispatch } from 'react-redux';
5-
import { Link, useNavigate }from 'react-router-dom';
5+
import { Link, useNavigate } from 'react-router-dom';
66
import { Dispatch } from '../models';
77
import styles from './Search.module.less';
88

99
export default function Search() {
1010
const dispatch = useDispatch<Dispatch>();
1111
const [value, setValue] = useState<string>();
1212
const navigate = useNavigate();
13-
const [links] = useState<{to: string, label: string}[]>([
13+
const [links] = useState<{ to: string; label: string }[]>([
1414
{
1515
to: '/pkg/uiw',
16-
label: 'uiw'
16+
label: 'uiw',
1717
},
1818
{
1919
to: '/pkg/vue',
20-
label: 'vue'
20+
label: 'vue',
2121
},
2222
{
2323
to: '/pkg/react',
24-
label: 'react'
24+
label: 'react',
2525
},
2626
{
2727
to: '/pkg/react@17',
28-
label: 'react@17'
28+
label: 'react@17',
2929
},
3030
{
3131
to: '/pkg/react@17.0.1',
32-
label: 'react@17.0.1'
32+
label: 'react@17.0.1',
3333
},
3434
]);
3535
return (
@@ -42,12 +42,18 @@ export default function Search() {
4242
setValue(e.target.value);
4343
}}
4444
addonAfter={
45-
<Button onClick={() => {
46-
if (value) {
47-
dispatch.global.update({ showSearch: false });
48-
navigate(`/pkg/${value}`);
49-
}
50-
}} icon="arrow-right" size="small" basic type="light" />
45+
<Button
46+
onClick={() => {
47+
if (value) {
48+
dispatch.global.update({ showSearch: false });
49+
navigate(`/pkg/${value}`);
50+
}
51+
}}
52+
icon="arrow-right"
53+
size="small"
54+
basic
55+
type="light"
56+
/>
5157
}
5258
placeholder="package or package@version"
5359
/>
@@ -64,7 +70,7 @@ export default function Search() {
6470
>
6571
{item.label}
6672
</Link>
67-
)
73+
);
6874
})}
6975
</div>
7076
</Fragment>

src/hook/usePath.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export function usePath() {
1414
}, [filename, other]);
1515

1616
useEffect(() => {
17-
setPkgName(`${org ? `${org}/${name}`: name}`);
17+
setPkgName(`${org ? `${org}/${name}` : name}`);
1818
}, [org, name]);
1919

20-
return { org, name, filename, other, filePath, pkgName }
21-
}
20+
return { org, name, filename, other, filePath, pkgName };
21+
}

src/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ function App() {
4040

4141
ReactDOM.render(
4242
<Provider store={store}>
43-
<GitHubCorners
44-
size={54}
45-
target="_parent"
46-
href="https://github.com/uiwjs/npm-unpkg"
47-
/>
43+
<GitHubCorners size={54} target="_parent" href="https://github.com/uiwjs/npm-unpkg" />
4844
<App />
4945
</Provider>,
5046
document.getElementById('root'),

src/models/global.ts

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createModel } from '@rematch/core';
22
import { RootModel } from './';
33
import { getDirectoryTrees, getFileContent } from '../servers/unpkg';
4-
import {dataFilesSort} from '../utils/utils';
4+
import { dataFilesSort } from '../utils/utils';
55

66
export interface Files {
77
path: string;
@@ -14,33 +14,35 @@ export interface Files {
1414
}
1515

1616
export interface PackageJSON {
17-
name: string;
18-
version: string;
19-
description: string;
20-
author: string;
21-
homepage?: string;
22-
repository?: {
23-
type?: string;
24-
url?: string;
25-
} | string;
26-
license: string;
27-
main: string;
28-
module: string;
29-
files: string[];
30-
publishConfig?: {
31-
[key: string]: any;
32-
}
33-
keywords: string[];
34-
peerDependencies?: {
35-
[key: string]: string;
36-
}
37-
dependencies?: {
38-
[key: string]: string;
39-
}
40-
devDependencies?: {
41-
[key: string]: string;
42-
}
43-
gitHead?: string;
17+
name: string;
18+
version: string;
19+
description: string;
20+
author: string;
21+
homepage?: string;
22+
repository?:
23+
| {
24+
type?: string;
25+
url?: string;
26+
}
27+
| string;
28+
license: string;
29+
main: string;
30+
module: string;
31+
files: string[];
32+
publishConfig?: {
33+
[key: string]: any;
34+
};
35+
keywords: string[];
36+
peerDependencies?: {
37+
[key: string]: string;
38+
};
39+
dependencies?: {
40+
[key: string]: string;
41+
};
42+
devDependencies?: {
43+
[key: string]: string;
44+
};
45+
gitHead?: string;
4446
}
4547

4648
export interface GlobalState {
@@ -59,7 +61,7 @@ export type Params = {
5961
name?: string;
6062
filename?: string;
6163
'*'?: string;
62-
}
64+
};
6365

6466
export const global = createModel<RootModel>()({
6567
state: {
@@ -78,8 +80,8 @@ export const global = createModel<RootModel>()({
7880
...payload,
7981
}),
8082
},
81-
effects: (dispatch) => {
82-
const { global } = dispatch
83+
effects: (dispatch) => {
84+
const { global } = dispatch;
8385
return {
8486
async setPkgname(params: Params) {
8587
const { name, org } = params || {};
@@ -106,7 +108,7 @@ export const global = createModel<RootModel>()({
106108
async getPackageJSON(_, state) {
107109
const data: PackageJSON = await getFileContent(`${state.global.pkgname}/package.json`);
108110
if (data && typeof data === 'object') {
109-
global.update({ package: {...data }, notFindPkg: false });
111+
global.update({ package: { ...data }, notFindPkg: false });
110112
} else {
111113
global.update({
112114
package: undefined,
@@ -118,15 +120,15 @@ export const global = createModel<RootModel>()({
118120
if (!filepath) {
119121
dispatch.global.update({ content: '', extname: '' });
120122
return;
121-
};
122-
const type = filepath.replace(/.+\./,'');
123+
}
124+
const type = filepath.replace(/.+\./, '');
123125
const data: PackageJSON = await getFileContent(`${state.global.pkgname}/${filepath}`);
124126
if (typeof data === 'string' || !data) {
125127
dispatch.global.update({ content: data, extname: type });
126128
} else if (data && /\.(json|map)$/.test(filepath)) {
127129
dispatch.global.update({ content: JSON.stringify(data, null, 2), extname: type });
128130
}
129131
},
130-
}
131-
}
132+
};
133+
},
132134
});

src/models/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export const store = init<RootModel, FullModel>({
1414
plugins: [loadingPlugin()],
1515
});
1616

17-
export type Store = typeof store
18-
export type Dispatch = RematchDispatch<RootModel>
19-
export type RootState = RematchRootState<RootModel, FullModel>
17+
export type Store = typeof store;
18+
export type Dispatch = RematchDispatch<RootModel>;
19+
export type RootState = RematchRootState<RootModel, FullModel>;

src/pages/Home/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default function Home() {
88
<Search />
99
</div>
1010
);
11-
}
11+
}

0 commit comments

Comments
 (0)