Repository: Yoctol/bottender
Pull request #445 (2019-09-23 09:23:26)

fix: eslint


Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 9426365f..694f37de 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -40,7 +40,7 @@ jobs:
           root: .
           paths:
             - node_modules
-            - packages/*/lib
+            - packages/*/dist
   lint-node-10:
     <<: *docker_10
     steps:
@@ -90,7 +90,7 @@ jobs:
           root: .
           paths:
             - node_modules
-            - packages/*/lib
+            - packages/*/dist
   lint-node-8:
     <<: *docker_8
     steps:
diff --git a/.eslintrc.js b/.eslintrc.js
index 3210a114..b8897f02 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -18,6 +18,7 @@ module.exports = {
     'consistent-return': 'off',
     'global-require': 'off',
     'no-param-reassign': 'off',
+    'no-undef': 'off',
     'prefer-destructuring': 'off',
     'prettier/prettier': [
       'error',
diff --git a/__mocks__/fs.js b/__mocks__/fs.ts
similarity index 84%
rename from __mocks__/fs.js
rename to __mocks__/fs.ts
index 81d84698..dfab7349 100644
--- a/__mocks__/fs.js
+++ b/__mocks__/fs.ts
@@ -1,4 +1,4 @@
-const fs = jest.genMockFromModule('fs');
+const fs = jest.genMockFromModule('fs') as any;
 
 let mockFiles;
 
diff --git a/__mocks__/ioredis.js b/__mocks__/ioredis.ts
similarity index 100%
rename from __mocks__/ioredis.js
rename to __mocks__/ioredis.ts
diff --git a/__mocks__/messaging-api-line.js b/__mocks__/messaging-api-line.ts
similarity index 96%
rename from __mocks__/messaging-api-line.js
rename to __mocks__/messaging-api-line.ts
index a9979c35..c0df3eea 100644
--- a/__mocks__/messaging-api-line.js
+++ b/__mocks__/messaging-api-line.ts
@@ -1,6 +1,6 @@
 import createMockInstance from 'jest-create-mock-instance';
 
-const MessagingAPILine = jest.genMockFromModule('messaging-api-line');
+const MessagingAPILine = jest.genMockFromModule('messaging-api-line') as any;
 const { Line, LineClient } = require.requireActual('messaging-api-line');
 
 MessagingAPILine.Line = Line;
diff --git a/__mocks__/messaging-api-messenger.js b/__mocks__/messaging-api-messenger.ts
similarity index 75%
rename from __mocks__/messaging-api-messenger.js
rename to __mocks__/messaging-api-messenger.ts
index 74284963..ed7c46f4 100644
--- a/__mocks__/messaging-api-messenger.js
+++ b/__mocks__/messaging-api-messenger.ts
@@ -1,6 +1,8 @@
 import createMockInstance from 'jest-create-mock-instance';
 
-const MessagingAPIMessenger = jest.genMockFromModule('messaging-api-messenger');
+const MessagingAPIMessenger = jest.genMockFromModule(
+  'messaging-api-messenger'
+) as any;
 const { MessengerClient } = require.requireActual('messaging-api-messenger');
 
 MessagingAPIMessenger.MessengerClient.connect = jest.fn(() =>
diff --git a/__mocks__/messaging-api-slack.js b/__mocks__/messaging-api-slack.ts
similarity index 95%
rename from __mocks__/messaging-api-slack.js
rename to __mocks__/messaging-api-slack.ts
index edb836f5..39cafb5f 100644
--- a/__mocks__/messaging-api-slack.js
+++ b/__mocks__/messaging-api-slack.ts
@@ -1,6 +1,6 @@
 import createMockInstance from 'jest-create-mock-instance';
 
-const MessagingAPISlack = jest.genMockFromModule('messaging-api-slack');
+const MessagingAPISlack = jest.genMockFromModule('messaging-api-slack') as any;
 const { SlackOAuthClient } = require.requireActual('messaging-api-slack');
 
 MessagingAPISlack.SlackOAuthClient.connect = jest.fn(() =>
diff --git a/__mocks__/messaging-api-telegram.js b/__mocks__/messaging-api-telegram.ts
similarity index 75%
rename from __mocks__/messaging-api-telegram.js
rename to __mocks__/messaging-api-telegram.ts
index 765aae90..dcfe377a 100644
--- a/__mocks__/messaging-api-telegram.js
+++ b/__mocks__/messaging-api-telegram.ts
@@ -1,6 +1,8 @@
 import createMockInstance from 'jest-create-mock-instance';
 
-const MessagingAPITelegram = jest.genMockFromModule('messaging-api-telegram');
+const MessagingAPITelegram = jest.genMockFromModule(
+  'messaging-api-telegram'
+) as any;
 const { TelegramClient } = require.requireActual('messaging-api-telegram');
 
 MessagingAPITelegram.TelegramClient.connect = jest.fn(() =>
diff --git a/__mocks__/messaging-api-viber.js b/__mocks__/messaging-api-viber.ts
similarity index 95%
rename from __mocks__/messaging-api-viber.js
rename to __mocks__/messaging-api-viber.ts
index ebb041b5..2108b371 100644
--- a/__mocks__/messaging-api-viber.js
+++ b/__mocks__/messaging-api-viber.ts
@@ -1,6 +1,6 @@
 import createMockInstance from 'jest-create-mock-instance';
 
-const MessagingAPIViber = jest.genMockFromModule('messaging-api-viber');
+const MessagingAPIViber = jest.genMockFromModule('messaging-api-viber') as any;
 const { ViberClient } = require.requireActual('messaging-api-viber');
 
 MessagingAPIViber.ViberClient.connect = jest.fn(() =>
diff --git a/package.json b/package.json
index 3a363f2c..a46a6bb6 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
     "lint:staged": "lint-staged",
     "publish": "yarn run clean && yarn run build && lerna publish",
     "prepublishOnly": "npm run build",
+    "postinstall": "npm run compile",
     "test": "npm run lint && npm run check && npm run testonly",
     "testonly": "jest --detectOpenHandles --forceExit",
     "testonly:cov": "jest --coverage --runInBand --detectOpenHandles --forceExit",
diff --git a/packages/bottender/bin/cli.ts b/packages/bottender/bin/cli.ts
index 4f46430b..3d3d68f2 100755
--- a/packages/bottender/bin/cli.ts
+++ b/packages/bottender/bin/cli.ts
@@ -1,3 +1,4 @@
 #!/usr/bin/env node
 
+// eslint-disable-next-line import/no-unresolved
 require('../dist/cli');
diff --git a/packages/bottender/package.json b/packages/bottender/package.json
index a3304837..97950bee 100644
--- a/packages/bottender/package.json
+++ b/packages/bottender/package.json
@@ -22,7 +22,7 @@
   ],
   "types": "dist/index.d.ts",
   "dependencies": {
-    "@bottender/express": "^1.0.0-alpha.2",
+    "@bottender/express": "file:../bottender-express",
     "@hapi/joi": "^15.1.1",
     "@slack/rtm-api": "^5.0.2",
     "arg": "^4.1.1",
diff --git a/packages/bottender/src/cli/providers/sh/index.ts b/packages/bottender/src/cli/providers/sh/index.ts
index 16190919..39402fc4 100644
--- a/packages/bottender/src/cli/providers/sh/index.ts
+++ b/packages/bottender/src/cli/providers/sh/index.ts
@@ -1,12 +1,9 @@
 export default {
   title: 'Bottender',
-  subcommands: new Set(['help', 'init', 'test']),
+  subcommands: new Set(['help', 'init', 'start', 'dev']),
   get init() {
     return require('./init').default;
   },
-  get test() {
-    return require('./test').default;
-  },
   get start() {
     return require('./start').default;
   },
diff --git a/packages/bottender/src/session/MemorySessionStore.ts b/packages/bottender/src/session/MemorySessionStore.ts
index 4c4ccd51..aea03689 100644
--- a/packages/bottender/src/session/MemorySessionStore.ts
+++ b/packages/bottender/src/session/MemorySessionStore.ts
@@ -20,6 +20,7 @@ function getMaxSize(arg: MemoryOption): number | undefined {
     return arg.maxSize;
   }
 
+  // eslint-disable-next-line no-useless-return
   return;
 }
 
diff --git a/packages/bottender/tsconfig.json b/packages/bottender/tsconfig.json
index c7690e71..dcb5b720 100644
--- a/packages/bottender/tsconfig.json
+++ b/packages/bottender/tsconfig.json
@@ -5,5 +5,8 @@
     "rootDir": "./src"
   },
   "include": ["src/**/*"],
-  "exclude": ["**/__tests__"]
+  "exclude": ["**/__tests__"],
+  "references": [
+    { "path": "../bottender-express" }
+  ]
 }
diff --git a/packages/bottender/utils.js b/packages/bottender/utils.js
index 4dcd9ca0..3db10aa1 100644
--- a/packages/bottender/utils.js
+++ b/packages/bottender/utils.js
@@ -1,1 +1,2 @@
+/* eslint-disable import/no-unresolved */
 module.exports = require('./dist/utils');
diff --git a/packages/create-bottender-app/bin/cli.js b/packages/create-bottender-app/bin/cli.js
index 588b621d..3153591e 100755
--- a/packages/create-bottender-app/bin/cli.js
+++ b/packages/create-bottender-app/bin/cli.js
@@ -1,5 +1,6 @@
 #!/usr/bin/env node
 
+// eslint-disable-next-line import/no-unresolved
 const init = require('../dist').default;
 
 init();
diff --git a/packages/create-bottender-app/template-typescript/index.js b/packages/create-bottender-app/template-typescript/index.js
index 61dac047..51418052 100644
--- a/packages/create-bottender-app/template-typescript/index.js
+++ b/packages/create-bottender-app/template-typescript/index.js
@@ -1,1 +1,2 @@
+/* eslint-disable import/no-unresolved */
 module.exports = require('./dist').App;
diff --git a/yarn.lock b/yarn.lock
index d6350ac7..4c28122d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -138,6 +138,13 @@
     lodash "^4.17.13"
     to-fast-properties "^2.0.0"
 
+"@bottender/express@file:packages/bottender-express":
+  version "1.0.0-alpha.2"
+  dependencies:
+    body-parser "^1.19.0"
+    express "^4.17.1"
+    lodash "^4.17.15"
+
 "@cnakazawa/watch@^1.0.3":
   version "1.0.3"
   resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef"


Test patch:
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/checkMessengerProfile.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/checkMessengerProfile.spec.ts
index 81a0708d..9582dfbd 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/checkMessengerProfile.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/checkMessengerProfile.spec.ts
@@ -1,9 +1,9 @@
 import { checkMessengerProfile } from '../profile';
+import { log } from '../../../shared/log';
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/createPersona.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/createPersona.spec.ts
index 5f179e1c..1cee4c7c 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/createPersona.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/createPersona.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { createPersona } from '../persona';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/deleteGetStarted.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/deleteGetStarted.spec.ts
index 091dce95..c3be9eed 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/deleteGetStarted.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/deleteGetStarted.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { deleteGetStarted } from '../get-started';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/deleteGreeting.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/deleteGreeting.spec.ts
index 37950e09..8b13f2f0 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/deleteGreeting.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/deleteGreeting.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { deleteGreeting } from '../greeting';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/deleteMessengerProfile.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/deleteMessengerProfile.spec.ts
index 96372a14..a3458be3 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/deleteMessengerProfile.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/deleteMessengerProfile.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { deleteMessengerProfile } from '../profile';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/deletePersistentMenu.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/deletePersistentMenu.spec.ts
index 5f26c1a3..9f1848f7 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/deletePersistentMenu.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/deletePersistentMenu.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { deletePersistentMenu } from '../persistent-menu';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/deletePersona.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/deletePersona.spec.ts
index 0b2b196f..b73991da 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/deletePersona.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/deletePersona.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { deletePersona } from '../persona';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/deleteWhitelistedDomains.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/deleteWhitelistedDomains.spec.ts
index cc85d41d..e6dbced1 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/deleteWhitelistedDomains.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/deleteWhitelistedDomains.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { deleteWhitelistedDomains } from '../whitelisted-domains';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/getGetStarted.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/getGetStarted.spec.ts
index d5b5cf8a..4c8a7d82 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/getGetStarted.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/getGetStarted.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { getGetStarted } from '../get-started';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/getGreeting.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/getGreeting.spec.ts
index 8383832c..12002076 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/getGreeting.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/getGreeting.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { getGreeting } from '../greeting';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/getMessengerProfile.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/getMessengerProfile.spec.ts
index f61d8954..9c10a08a 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/getMessengerProfile.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/getMessengerProfile.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { getMessengerProfile } from '../profile';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/getPersistentMenu.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/getPersistentMenu.spec.ts
index ceacd79c..8f090600 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/getPersistentMenu.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/getPersistentMenu.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { getPersistentMenu } from '../persistent-menu';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/getPersona.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/getPersona.spec.ts
index a10ac2be..902fecd3 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/getPersona.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/getPersona.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { getPersona } from '../persona';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/getWhitelistedDomains.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/getWhitelistedDomains.spec.ts
index 858008f0..2999bff3 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/getWhitelistedDomains.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/getWhitelistedDomains.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { getWhitelistedDomains } from '../whitelisted-domains';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/listPersona.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/listPersona.spec.ts
index d0fb2ab6..a4a6e152 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/listPersona.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/listPersona.spec.ts
@@ -1,13 +1,13 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
 import { listPersona } from '../persona';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-messenger');
 
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/setMessengerProfile.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/setMessengerProfile.spec.ts
index 7b35ab9b..46c1d75f 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/setMessengerProfile.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/setMessengerProfile.spec.ts
@@ -1,3 +1,6 @@
+import { MessengerClient } from 'messaging-api-messenger';
+
+import { log } from '../../../shared/log';
 import { setMessengerProfile } from '../profile';
 
 jest.mock('messaging-api-messenger');
@@ -6,9 +9,6 @@ jest.mock('warning');
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { MessengerClient } = require('messaging-api-messenger');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/messenger/__tests__/setWebhook.spec.ts b/packages/bottender/src/cli/providers/messenger/__tests__/setWebhook.spec.ts
index f5050d74..243c965b 100644
--- a/packages/bottender/src/cli/providers/messenger/__tests__/setWebhook.spec.ts
+++ b/packages/bottender/src/cli/providers/messenger/__tests__/setWebhook.spec.ts
@@ -1,3 +1,7 @@
+import Confirm from 'prompt-confirm';
+import { MessengerClient } from 'messaging-api-messenger';
+
+import { log } from '../../../shared/log';
 import { setWebhook } from '../webhook';
 
 jest.mock('messaging-api-messenger');
@@ -7,12 +11,8 @@ jest.mock('../../../shared/getWebhookFromNgrok');
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const Confirm = require('prompt-confirm');
-const { MessengerClient } = require('messaging-api-messenger');
-
 const getWebhookFromNgrok = require('../../../shared/getWebhookFromNgrok')
   .default;
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const FAKE_TOKEN = '__FAKE_TOKEN__';
diff --git a/packages/bottender/src/cli/providers/sh/__tests__/index.spec.ts b/packages/bottender/src/cli/providers/sh/__tests__/index.spec.ts
index 8e48a333..ee1c71e2 100644
--- a/packages/bottender/src/cli/providers/sh/__tests__/index.spec.ts
+++ b/packages/bottender/src/cli/providers/sh/__tests__/index.spec.ts
@@ -2,7 +2,8 @@ import sh from '..';
 
 jest.mock('../init');
 jest.mock('../help');
-jest.mock('../test');
+jest.mock('../start');
+jest.mock('../dev');
 
 describe('sh cli', () => {
   it('should exist', () => {
@@ -19,8 +20,13 @@ describe('sh cli', () => {
     expect(sh.help).toEqual(help);
   });
 
-  it('should return test module', () => {
-    const test = require('../test').default;
-    expect(sh.test).toEqual(test);
+  it('should return start module', () => {
+    const start = require('../start').default;
+    expect(sh.start).toEqual(start);
+  });
+
+  it('should return dev module', () => {
+    const dev = require('../dev').default;
+    expect(sh.dev).toEqual(dev);
   });
 });
diff --git a/packages/bottender/src/cli/providers/telegram/__tests__/deleteWebhook.spec.ts b/packages/bottender/src/cli/providers/telegram/__tests__/deleteWebhook.spec.ts
index 8fbeccfa..074674b2 100644
--- a/packages/bottender/src/cli/providers/telegram/__tests__/deleteWebhook.spec.ts
+++ b/packages/bottender/src/cli/providers/telegram/__tests__/deleteWebhook.spec.ts
@@ -1,12 +1,12 @@
+import { TelegramClient } from 'messaging-api-telegram';
+
 import { deleteWebhook } from '../webhook';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-telegram');
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { TelegramClient } = require('messaging-api-telegram');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/telegram/__tests__/getWebhook.spec.ts b/packages/bottender/src/cli/providers/telegram/__tests__/getWebhook.spec.ts
index 2a227d65..b5f2c3b2 100644
--- a/packages/bottender/src/cli/providers/telegram/__tests__/getWebhook.spec.ts
+++ b/packages/bottender/src/cli/providers/telegram/__tests__/getWebhook.spec.ts
@@ -1,12 +1,12 @@
+import { TelegramClient } from 'messaging-api-telegram';
+
 import { getWebhook } from '../webhook';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-telegram');
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { TelegramClient } = require('messaging-api-telegram');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/telegram/__tests__/setWebhook.spec.ts b/packages/bottender/src/cli/providers/telegram/__tests__/setWebhook.spec.ts
index b293a60e..d2aabc45 100644
--- a/packages/bottender/src/cli/providers/telegram/__tests__/setWebhook.spec.ts
+++ b/packages/bottender/src/cli/providers/telegram/__tests__/setWebhook.spec.ts
@@ -1,3 +1,7 @@
+import Confirm from 'prompt-confirm';
+import { TelegramClient } from 'messaging-api-telegram';
+
+import { log } from '../../../shared/log';
 import { setWebhook } from '../webhook';
 
 jest.mock('messaging-api-telegram');
@@ -7,12 +11,8 @@ jest.mock('../../../shared/getWebhookFromNgrok');
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const Confirm = require('prompt-confirm');
-const { TelegramClient } = require('messaging-api-telegram');
-
 const getWebhookFromNgrok = require('../../../shared/getWebhookFromNgrok')
   .default;
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/viber/__tests__/deleteWebhook.spec.ts b/packages/bottender/src/cli/providers/viber/__tests__/deleteWebhook.spec.ts
index 28daabfa..f51000ec 100644
--- a/packages/bottender/src/cli/providers/viber/__tests__/deleteWebhook.spec.ts
+++ b/packages/bottender/src/cli/providers/viber/__tests__/deleteWebhook.spec.ts
@@ -1,12 +1,12 @@
+import { ViberClient } from 'messaging-api-viber';
+
 import { deleteWebhook } from '../webhook';
+import { log } from '../../../shared/log';
 
 jest.mock('messaging-api-viber');
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const { ViberClient } = require('messaging-api-viber');
-
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/cli/providers/viber/__tests__/setWebhook.spec.ts b/packages/bottender/src/cli/providers/viber/__tests__/setWebhook.spec.ts
index c785c760..ebe6eb9b 100644
--- a/packages/bottender/src/cli/providers/viber/__tests__/setWebhook.spec.ts
+++ b/packages/bottender/src/cli/providers/viber/__tests__/setWebhook.spec.ts
@@ -1,3 +1,7 @@
+import Confirm from 'prompt-confirm';
+import { ViberClient } from 'messaging-api-viber';
+
+import { log } from '../../../shared/log';
 import { setWebhook } from '../webhook';
 
 jest.mock('messaging-api-viber');
@@ -7,12 +11,8 @@ jest.mock('../../../shared/getWebhookFromNgrok');
 jest.mock('../../../shared/log');
 jest.mock('../../../shared/getConfig');
 
-const Confirm = require('prompt-confirm');
-const { ViberClient } = require('messaging-api-viber');
-
 const getWebhookFromNgrok = require('../../../shared/getWebhookFromNgrok')
   .default;
-const log = require('../../../shared/log');
 const getConfig = require('../../../shared/getConfig').default;
 
 const MOCK_FILE_WITH_PLATFORM = {
diff --git a/packages/bottender/src/session/__tests__/MongoSessionStore.spec.ts b/packages/bottender/src/session/__tests__/MongoSessionStore.spec.ts
index c23564df..001080e0 100644
--- a/packages/bottender/src/session/__tests__/MongoSessionStore.spec.ts
+++ b/packages/bottender/src/session/__tests__/MongoSessionStore.spec.ts
@@ -1,11 +1,10 @@
 import subMinutes from 'date-fns/subMinutes';
+import { MongoClient } from 'mongodb';
 
 import MongoSessionStore from '../MongoSessionStore';
 
 jest.mock('mongodb');
 
-const { MongoClient } = require('mongodb');
-
 const MINUTES_IN_ONE_YEAR = 365 * 24 * 60;
 
 function setup(options = {}) {
diff --git a/packages/bottender/test-utils.js b/packages/bottender/test-utils.js
index caf09044..3b26c270 100644
--- a/packages/bottender/test-utils.js
+++ b/packages/bottender/test-utils.js
@@ -1,1 +1,2 @@
+/* eslint-disable import/no-unresolved */
 module.exports = require('./dist/test-utils');