Skip to content

Commit 4c4ec06

Browse files
Flatten hooks folder (#186)
1 parent d381b80 commit 4c4ec06

File tree

28 files changed

+497
-466
lines changed

28 files changed

+497
-466
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import * as historyHelper from 'history';
33
import React from 'react';
44
import { defaultRegistry } from 'react-sweet-state';
55

6-
import { mockRoute } from '../../common/mocks';
7-
import { ResourceStore } from '../../controllers/resource-store';
6+
import { mockRoute } from '../common/mocks';
7+
import { ResourceStore } from '../controllers/resource-store';
88
import {
99
RouteComponent,
1010
Router,
1111
RouterActions,
1212
RouterActionsType,
1313
StaticRouter,
14-
} from '../../index';
14+
} from '../index';
1515

1616
const mockLocation = {
1717
pathname: '/projects/123/board/456',

src/common/utils/create-legacy-history/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createLegacyHistory } from './index';
22

33
type NodeChangeCallback = () => void;
44

5-
describe('createLegacyHistory', () => {
5+
describe('createLegacyHistory()', () => {
66
let onNodeChanges: NodeChangeCallback = () => {};
77

88
const triggerLocationChange = async (location: string, push = true) => {

src/common/utils/generate-path/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import { generatePath } from './index';
66

7-
describe('generatePath', () => {
7+
describe('generatePath()', () => {
88
describe('tests covering cases for PROJECT_SETTINGS_ISSUE_TYPES_ROUTE', () => {
99
const PROJECT_SETTINGS_ISSUE_TYPES_ROUTE =
1010
'/projects/:projectKey/settings/issuetypes/:issueTypeId?';

src/common/utils/match-route/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const Noop = () => null;
77
const DEFAULT_QUERY_PARAMS = {};
88
const { parse } = qs;
99

10-
describe('matchRoute', () => {
10+
describe('matchRoute()', () => {
1111
beforeEach(() => {
1212
matchRouteCache.cache.clear();
1313
});

src/common/utils/router-context/test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const mockLocation = {
1717
hash: '',
1818
};
1919

20-
describe('Router findRouterContext util', () => {
20+
describe('findRouterContext()', () => {
2121
it('should return the route match', () => {
2222
const context = findRouterContext(mockRoutes, { location: mockLocation });
2323

@@ -50,7 +50,7 @@ describe('Router findRouterContext util', () => {
5050
});
5151
});
5252

53-
describe('Router createRouterContext util', () => {
53+
describe('createRouterContext()', () => {
5454
it('should return the context for provided route', () => {
5555
const route = {
5656
path: '/foo/:page',

src/controllers/hooks/index.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/controllers/hooks/router-store/index.tsx

Lines changed: 0 additions & 93 deletions
This file was deleted.

src/controllers/index.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
1-
export {
2-
useResource,
3-
useRouter,
4-
useRouterActions,
5-
useQueryParam,
6-
usePathParam,
7-
useTimeout,
8-
} from './hooks';
9-
10-
export { Router } from './router';
11-
export { RouterActions } from './router-actions';
12-
export { RouterSubscriber } from './router-subscriber';
131
export { MemoryRouter } from './memory-router';
142
export { Redirect } from './redirect';
153
export { ResourceSubscriber } from './resource-subscriber';
4+
export { Router } from './router';
5+
export { RouterActions } from './router-actions';
6+
export { RouterSubscriber } from './router-subscriber';
167
export { StaticRouter } from './static-router';
178

189
export {
1910
createResource,
2011
useResourceStoreContext,
2112
ResourceDependencyError,
2213
} from './resource-store';
14+
2315
export type {
2416
CreateResourceArgBase,
2517
CreateResourceArgSync,
@@ -31,4 +23,10 @@ export {
3123
createRouterSelector,
3224
} from './router-store';
3325

26+
export { usePathParam } from './use-path-param';
27+
export { useQueryParam } from './use-query-param';
28+
export { useResource } from './use-resource';
29+
export { useRouter } from './use-router';
30+
export { useRouterActions } from './use-router-actions';
31+
3432
export { withRouter } from './with-router';

src/controllers/redirect/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import React, { Component } from 'react';
44
import { Location, MatchParams, Query, Route } from '../../common/types';
55
import { generateLocationFromPath } from '../../common/utils';
66

7-
import { useRouter } from '../hooks';
8-
97
import { RouterActionsType, RouterState } from '../router-store/types';
8+
import { useRouter } from '../use-router';
109

1110
export type RedirectProps = {
1211
to: Location | Route | string;

src/controllers/resource-store/test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
/* eslint-disable prefer-destructuring */
2-
/* eslint-disable prefer-promise-reject-errors */
31
import { mount } from 'enzyme';
42
import React from 'react';
53
import { BoundActions, defaultRegistry } from 'react-sweet-state';
64

75
import { ResourceType, RouteResourceResponse } from '../../common/types';
86

9-
import { useResource } from '../hooks';
107
import * as routerStoreModule from '../router-store';
8+
import { useResource } from '../use-resource';
119

1210
import { getResourceStore, ResourceDependencyError } from './index';
1311
import { getSliceForResource } from './selectors';

0 commit comments

Comments
 (0)