diff --git a/.circleci/config.yml b/.circleci/config.yml index 53abbc89..af2574b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,6 +8,7 @@ jobs: - checkout - run: yarn install - run: yarn bootstrap + - run: yarn lint - run: yarn test publish-stable: docker: diff --git a/package.json b/package.json index af94fb5f..e86cceb1 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "pretest": "npm run lint", "test": "npm run testall || npm run testall", "coveralls": "cat ./test/coverage/lcov.info | coveralls", - "lint": "standard && standard --parser typescript-eslint-parser --plugin typescript packages/**/*.ts", + "lint": "lerna run typescript && standard && standard --parser typescript-eslint-parser --plugin typescript packages/**/*.ts", + "typescript": "lerna run typescript", "prepublish": "lerna run prepublish", "publish-canary": "lerna version prerelease --preid canary --force-publish", "lint-staged": "lint-staged" @@ -27,6 +28,7 @@ "standard": { "parser": "babel-eslint", "ignore": [ + "**/*.d.ts", "**/node_modules/**", "examples/with-ioc/**", "examples/with-kea/**", diff --git a/packages/next-server/tsconfig.json b/packages/next-server/tsconfig.json index 1e365ba7..e0e366bc 100644 --- a/packages/next-server/tsconfig.json +++ b/packages/next-server/tsconfig.json @@ -1,10 +1,12 @@ { "compilerOptions": { + "strict": true, "allowJs": true, "noEmit": true, "module": "esnext", "target": "ES2017", "esModuleInterop": true, + "moduleResolution": "node", "jsx": "react" } } diff --git a/packages/next/build/babel/plugins/react-loadable-plugin.ts b/packages/next/build/babel/plugins/react-loadable-plugin.ts index 131649c9..60b6ed5d 100644 --- a/packages/next/build/babel/plugins/react-loadable-plugin.ts +++ b/packages/next/build/babel/plugins/react-loadable-plugin.ts @@ -52,10 +52,12 @@ export default function ({ types: t }: {types: typeof BabelTypes}): PluginObj { if ( callExpression.isMemberExpression() && - callExpression.node.computed === false && - callExpression.get('property').isIdentifier({ name: 'Map' }) + callExpression.node.computed === false ) { - callExpression = callExpression.parentPath + const property = callExpression.get('property') + if (!Array.isArray(property) && property.isIdentifier({ name: 'Map' })) { + callExpression = callExpression.parentPath + } } if (!callExpression.isCallExpression()) return diff --git a/packages/next/package.json b/packages/next/package.json index f3fe8805..3701ccba 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -28,7 +28,8 @@ "scripts": { "build": "taskr", "release": "taskr release", - "prepublish": "npm run release" + "prepublish": "npm run release", + "typescript": "tsc --noEmit" }, "taskr": { "requires": [ @@ -91,6 +92,7 @@ "react-dom": "^16.0.0" }, "devDependencies": { + "@babel/parser": "7.2.0", "@taskr/clear": "1.1.0", "@taskr/esnext": "1.1.0", "@taskr/watch": "1.1.0", @@ -100,6 +102,7 @@ "@types/babel__template": "7.0.1", "@types/babel__traverse": "7.0.3", "@types/nanoid": "1.2.0", + "@types/node-fetch": "2.1.4", "@types/webpack": "4.4.20", "taskr": "1.1.0", "typescript": "3.1.6" diff --git a/packages/next/tsconfig.json b/packages/next/tsconfig.json index 2c685041..0c5457a5 100644 --- a/packages/next/tsconfig.json +++ b/packages/next/tsconfig.json @@ -1,20 +1,17 @@ { "compilerOptions": { + "strict": true, "allowJs": true, "noEmit": true, "module": "esnext", "target": "ES2017", "esModuleInterop": true, + "moduleResolution": "node", "jsx": "react", - "strictNullChecks": true, - "noImplicitAny": true, "baseUrl": "../..", "paths": { "@babel/types": [ - "babel-types/index.d.ts", - "@types/babel-types/index.d.ts", - "node_modules/@types/babel-types/index.d.ts", - "packages/next/node_modules/@types/babel-types/index.d.ts" + "@types/babel-types/index.d.ts" ] } } diff --git a/packages/next/types/index.d.ts b/packages/next/types/index.d.ts new file mode 100644 index 00000000..c938e9cf --- /dev/null +++ b/packages/next/types/index.d.ts @@ -0,0 +1,3 @@ +declare module '@babel/plugin-transform-modules-commonjs'; +declare module 'next-server/next-config'; +declare module 'next-server/constants';