Skip to content

Commit

Permalink
Fix(style): linter acts differently on CI; just write decent types
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzowski committed Dec 11, 2019
1 parent c329a0a commit b4b33b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
31 changes: 15 additions & 16 deletions app/stories/mockNextRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@ import {action} from '@storybook/addon-actions';

declare type Url = string | UrlObject;

const router: RouterType = {
...Router.router,
replace: async (url: Url, as?: Url, options?: {}): Promise<boolean> => {
action('Router#replace')(url, as, options);
return true;
},
push: async (url: Url, as?: Url, options?: {}): Promise<boolean> => {
action('Router#push')(url, as, options);
return true;
},
prefetch: async (url: Url, as?: Url, options?: {}): Promise<void> => {
action('Router#prefetch')(url, as, options);
}
const router: Partial<RouterType> = Router.router ? {...Router.router} : {};

router.replace = async (url: Url, as?: Url, options?: {}): Promise<boolean> => {
action('Router#replace')(url, as, options);
return true;
};

router.push = async (url: Url, as?: Url, options?: {}): Promise<boolean> => {
action('Router#push')(url, as, options);
return true;
};

router.prefetch = async (url: Url, as?: Url, options?: {}): Promise<void> => {
action('Router#prefetch')(url, as, options);
};

// Monkeypatch the router instance
Router._router = Router.router;
Router.router = router;
Router.router = router as RouterType;

export {Router};
4 changes: 1 addition & 3 deletions app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
"exclude": [
".next",
".s2i",
".storybook",
"node_modules",
"static",
"stories"
"static"
]
}

0 comments on commit b4b33b9

Please sign in to comment.