From b4b33b9ed201d15617ab52fb00afe61d7a87fa6e Mon Sep 17 00:00:00 2001 From: Alec Wenzowski Date: Tue, 10 Dec 2019 16:58:40 -0800 Subject: [PATCH] Fix(style): linter acts differently on CI; just write decent types --- app/stories/mockNextRouter.ts | 31 +++++++++++++++---------------- app/tsconfig.json | 4 +--- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/app/stories/mockNextRouter.ts b/app/stories/mockNextRouter.ts index b7827eabec..d6ae052249 100644 --- a/app/stories/mockNextRouter.ts +++ b/app/stories/mockNextRouter.ts @@ -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 => { - action('Router#replace')(url, as, options); - return true; - }, - push: async (url: Url, as?: Url, options?: {}): Promise => { - action('Router#push')(url, as, options); - return true; - }, - prefetch: async (url: Url, as?: Url, options?: {}): Promise => { - action('Router#prefetch')(url, as, options); - } +const router: Partial = Router.router ? {...Router.router} : {}; + +router.replace = async (url: Url, as?: Url, options?: {}): Promise => { + action('Router#replace')(url, as, options); + return true; +}; + +router.push = async (url: Url, as?: Url, options?: {}): Promise => { + action('Router#push')(url, as, options); + return true; +}; + +router.prefetch = async (url: Url, as?: Url, options?: {}): Promise => { + action('Router#prefetch')(url, as, options); }; -// Monkeypatch the router instance -Router._router = Router.router; -Router.router = router; +Router.router = router as RouterType; export {Router}; diff --git a/app/tsconfig.json b/app/tsconfig.json index 946ad48c3b..7c1d20a1a5 100644 --- a/app/tsconfig.json +++ b/app/tsconfig.json @@ -29,9 +29,7 @@ "exclude": [ ".next", ".s2i", - ".storybook", "node_modules", - "static", - "stories" + "static" ] }