Skip to content

Commit 1e4a509

Browse files
committed
style: revert changes on src/ and __test__
1 parent 2899537 commit 1e4a509

16 files changed

+37
-33
lines changed

__tests__/cases/non-parallel/pjax.general.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
patientClick,
55
selectFileTreeItem,
66
sleep,
7-
waitForLegacyPJAXRedirect,
7+
waitForLegacyPJAXRedirect
88
} from '../../utils'
99

1010
describe(`in Gitako project page`, () => {

__tests__/cases/non-parallel/pjax.internal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
patientClick,
66
selectFileTreeItem,
77
sleep,
8-
waitForLegacyPJAXRedirect,
8+
waitForLegacyPJAXRedirect
99
} from '../../utils'
1010

1111
describe(`in Gitako project page`, () => {

__tests__/cases/non-parallel/project-page.gitako.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ import {
33
expectToFind,
44
expectToNotFind,
55
scroll,
6-
selectFileTreeItem,
6+
selectFileTreeItem
77
} from '../../utils'
88

99
describe(`in Gitako project page`, () => {
10-
beforeAll(() =>
11-
page.goto('https://github.com/EnixCoda/Gitako/tree/test/200-changed-files-200-lines-each'),
12-
)
10+
beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako/tree/test/200-changed-files-200-lines-each'))
1311

1412
it('should render Gitako', async () => {
1513
await expectToFind('.gitako-side-bar .gitako-side-bar-body-wrapper')

__tests__/cases/parallel/expand-to-target.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { expectToFind, selectFileTreeItem, sleep, waitForLegacyPJAXRedirect } from '../../utils'
1+
import {
2+
expectToFind,
3+
selectFileTreeItem,
4+
sleep,
5+
waitForLegacyPJAXRedirect
6+
} from '../../utils'
27

38
describe(`in Gitako project page`, () => {
49
beforeAll(() => page.goto('https://github.com/EnixCoda/Gitako/tree/develop/src'))

__tests__/utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function listenTo<Args extends any[] = any[]>(
4040
(event, target, callbackName, oneTime) => {
4141
const t = target === 'document' ? document : window
4242
const onEvent = (...args: any[]): void => {
43-
;(window[callbackName as any] as any as (...args: any[]) => void)(...args)
43+
;((window[callbackName as any] as any) as (...args: any[]) => void)(...args)
4444
if (oneTime) t.removeEventListener(event, onEvent)
4545
}
4646
t.addEventListener(event, onEvent)
@@ -81,9 +81,7 @@ export async function patientClick(selector: string) {
8181
}
8282

8383
export async function expandFloatModeSidebar() {
84-
const rect = await (
85-
await page.$('.gitako-toggle-show-button')
86-
)?.evaluate(button => {
84+
const rect = await (await page.$('.gitako-toggle-show-button'))?.evaluate(button => {
8785
const { x, y, width, height } = button.getBoundingClientRect()
8886
// pass required properties to avoid serialization issues
8987
return { x, y, width, height }

src/components/Icon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
ReplyIcon as Reply,
2525
SearchIcon as Search,
2626
TabIcon as Tab,
27-
XIcon as X,
27+
XIcon as X
2828
} from '@primer/octicons-react'
2929
import * as React from 'react'
3030
import { cx } from 'utils/cx'

src/components/MetaBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { BranchName, Breadcrumb, Flex, Text } from '@primer/components'
22
import { GitBranchIcon } from '@primer/octicons-react'
33
import { platform } from 'platforms'
44
import * as React from 'react'
5-
import { createAnchorClickHandler } from 'utils/createAnchorClickHandler'
5+
import { createAnchorClickHandler } from "utils/createAnchorClickHandler"
66

77
type Props = {
88
metaData: MetaData

src/components/SideBarBodyWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function SideBarBodyWrapper({
104104

105105
const dummySize: [number, number] = React.useMemo(() => [size, size], [size])
106106

107-
const defaultSideBarWidth = React.useMemo(() => getDefaultConfigs().sideBarWidth, [])
107+
const defaultSideBarWidth = React.useMemo(() => getDefaultConfigs().sideBarWidth, []);
108108

109109
return (
110110
<div

src/content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as ReactDOM from 'react-dom'
77
import {
88
insertLogoMountPoint,
99
insertSideBarMountPoint,
10-
persistGitakoElements,
10+
persistGitakoElements
1111
} from 'utils/DOMHelper'
1212
import './content.scss'
1313

src/global.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ type TreeNode = {
1717
sha?: string
1818
accessDenied?: boolean
1919
comments?: {
20-
active: number
21-
resolved: number
20+
active: number,
21+
resolved: number,
2222
}
2323
diff?: {
2424
status: 'modified' | 'added' | 'removed' | 'renamed'

src/platforms/GitHub/DOMHelper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export function getCurrentBranch(passive = false) {
5454
if (title !== defaultTitle && !title.includes(' ')) return title
5555
}
5656

57-
const findFileButtonSelector = 'main .file-navigation a[data-hotkey="t"]'
57+
const findFileButtonSelector =
58+
'main .file-navigation a[data-hotkey="t"]'
5859
const urlFromFindFileButton: string | null = $(
5960
findFileButtonSelector,
6061
element => (element as HTMLAnchorElement).href,

src/platforms/Gitea/API.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ export async function getTreeData(
7777
): Promise<GiteaAPI.TreeData> {
7878
const search = new URLSearchParams()
7979
if (recursive) search.set('recursive', '1')
80-
const url = `${API_ENDPOINT}/repos/${userName}/${repoName}/git/trees/${branchName}?` + search
80+
const url =
81+
`${API_ENDPOINT}/repos/${userName}/${repoName}/git/trees/${branchName}?` + search
8182
return await request(url, { accessToken })
8283
}
8384

@@ -93,14 +94,14 @@ export async function getBlobData(
9394

9495
export async function OAuth(code: string): Promise<string | null> {
9596
const endpoint = `https://gitako.enix.one/oauth/gitea?`
96-
const res = await fetch(endpoint + new URLSearchParams({ code }).toString(), {
97-
method: 'post',
98-
})
97+
const res = await fetch(endpoint + new URLSearchParams({ code }).toString(), {
98+
method: 'post',
99+
})
99100

100-
if (res.ok) {
101-
const body = await res.json()
102-
const accessToken = body?.accessToken
103-
if (typeof accessToken === 'string') return accessToken
104-
}
105-
return null
101+
if (res.ok) {
102+
const body = await res.json()
103+
const accessToken = body?.accessToken
104+
if (typeof accessToken === 'string') return accessToken
105+
}
106+
return null
106107
}

src/platforms/Gitea/URLHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ export function getCurrentPath(branchName = '') {
6767
return path.map(decodeURIComponent)
6868
}
6969
return []
70-
}
70+
}

src/utils/EventHub.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class EventSubscription<Data, Listener extends VoidFN<Data> = VoidFN<Data
1919
export class EventHub<
2020
Shape extends {
2121
[event: string]: any
22-
},
22+
}
2323
> {
2424
ports: {
2525
[key in keyof Shape]: EventSubscription<Shape[key]>

src/utils/hooks/useResizeHandler.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export function useResizeHandler(
3131
if (!pointerDown.current) return
3232
const [x0, y0] = initialSizeRef.current
3333
// Allow minor movement, this happened unintentionally for few times when I use track pad
34-
pointerMoved.current =
35-
pointerMoved.current || (clientX - x0) ** 2 + (clientY - y0) ** 2 > distanceTolerance ** 2
34+
pointerMoved.current = pointerMoved.current || (clientX - x0) ** 2 + (clientY - y0) ** 2 > distanceTolerance ** 2
3635
const [x1, y1] = baseSize.current
3736
onResize([x1 + clientX - x0, y1 + clientY - y0])
3837
}

src/utils/hooks/useStateIO.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as React from 'react'
22

3-
export function useStateIO<S>(initialState: S | (() => S)): {
3+
export function useStateIO<S>(
4+
initialState: S | (() => S),
5+
): {
46
value: S
57
onChange: React.Dispatch<React.SetStateAction<S>>
68
} {

0 commit comments

Comments
 (0)