Skip to content

Commit e00f3c7

Browse files
committed
run code formatting
1 parent 4ebb28b commit e00f3c7

3 files changed

Lines changed: 41 additions & 23 deletions

File tree

packages/react-router-dom/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ export interface HashRouterProps {
173173
* A <Router> for use in web browsers. Stores the location in the hash
174174
* portion of the URL so it is not sent to the server.
175175
*/
176-
export function HashRouter({ basename = "/", children, window }: HashRouterProps) {
176+
export function HashRouter({
177+
basename = "/",
178+
children,
179+
window
180+
}: HashRouterProps) {
177181
let historyRef = React.useRef<HashHistory>();
178182
if (historyRef.current == null) {
179183
historyRef.current = createHashHistory({ window });

packages/react-router-native/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
useOutlet,
3333
useParams,
3434
useResolvedPath,
35-
useRoutes,
35+
useRoutes
3636
} from "react-router";
3737
import type { To } from "react-router";
3838

packages/react-router/index.tsx

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,7 @@ export function Router({
278278
locationProp = parsePath(locationProp);
279279
}
280280

281-
let {
282-
pathname, search, hash, state, key
283-
} = parseLocation(locationProp)
281+
let { pathname, search, hash, state, key } = parseLocation(locationProp);
284282

285283
let location = React.useMemo(() => {
286284
let trailingPathname = stripBasename(pathname, basename);
@@ -404,41 +402,57 @@ export function useLocation(): Location {
404402
/**
405403
* Returns a complete Location with an absolute pathname
406404
*/
407-
export function parseLocation({pathname = "/", ...rest}: Partial<Location>): Location {
405+
export function parseLocation({
406+
pathname = "/",
407+
...rest
408+
}: Partial<Location>): Location {
408409
const defaultLocation = {
409-
pathname: "/", search: "", hash: "",
410-
state: null, key: "default",
411-
}
412-
return {...defaultLocation, ...rest, pathname: normalizePathnameStart(pathname)}
410+
pathname: "/",
411+
search: "",
412+
hash: "",
413+
state: null,
414+
key: "default"
415+
};
416+
return {
417+
...defaultLocation,
418+
...rest,
419+
pathname: normalizePathnameStart(pathname)
420+
};
413421
}
414422

415423
/**
416424
* Returns a modified navigator to allow relative pathnames
417425
*/
418-
export function useNavigator(navigator: Navigator, basename: string): Navigator {
426+
export function useNavigator(
427+
navigator: Navigator,
428+
basename: string
429+
): Navigator {
419430
if (basename !== "") {
420-
return navigator
431+
return navigator;
421432
}
422433

423434
const makeRelative = (path: Path): Path => {
424435
return {
425-
...path, pathname: path.pathname.replace(/^\//, "")
426-
}
427-
}
436+
...path,
437+
pathname: path.pathname.replace(/^\//, "")
438+
};
439+
};
428440
const push = (to: To, state?: any): void => {
429-
navigator.push(makeRelative(resolvePath(to)), state)
430-
}
441+
navigator.push(makeRelative(resolvePath(to)), state);
442+
};
431443
const replace = (to: To, state?: any): void => {
432-
navigator.replace(makeRelative(resolvePath(to)), state)
433-
}
444+
navigator.replace(makeRelative(resolvePath(to)), state);
445+
};
434446
const createHref = (to: To): string => {
435-
return navigator.createHref(makeRelative(resolvePath(to)))
436-
}
447+
return navigator.createHref(makeRelative(resolvePath(to)));
448+
};
437449

438450
return {
439451
go: navigator.go,
440-
push, replace, createHref
441-
}
452+
push,
453+
replace,
454+
createHref
455+
};
442456
}
443457

444458
/**

0 commit comments

Comments
 (0)