Unverified Commit dd556bf9 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Add tsc type checking (#5826)

* Add tsc type checking

* Add linting on circle

* Add node-fetch types

* Use strict mode
parent 70985015
...@@ -8,6 +8,7 @@ jobs: ...@@ -8,6 +8,7 @@ jobs:
- checkout - checkout
- run: yarn install - run: yarn install
- run: yarn bootstrap - run: yarn bootstrap
- run: yarn lint
- run: yarn test - run: yarn test
publish-stable: publish-stable:
docker: docker:
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
"pretest": "npm run lint", "pretest": "npm run lint",
"test": "npm run testall || npm run testall", "test": "npm run testall || npm run testall",
"coveralls": "cat ./test/coverage/lcov.info | coveralls", "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", "prepublish": "lerna run prepublish",
"publish-canary": "lerna version prerelease --preid canary --force-publish", "publish-canary": "lerna version prerelease --preid canary --force-publish",
"lint-staged": "lint-staged" "lint-staged": "lint-staged"
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
"standard": { "standard": {
"parser": "babel-eslint", "parser": "babel-eslint",
"ignore": [ "ignore": [
"**/*.d.ts",
"**/node_modules/**", "**/node_modules/**",
"examples/with-ioc/**", "examples/with-ioc/**",
"examples/with-kea/**", "examples/with-kea/**",
......
{ {
"compilerOptions": { "compilerOptions": {
"strict": true,
"allowJs": true, "allowJs": true,
"noEmit": true, "noEmit": true,
"module": "esnext", "module": "esnext",
"target": "ES2017", "target": "ES2017",
"esModuleInterop": true, "esModuleInterop": true,
"moduleResolution": "node",
"jsx": "react" "jsx": "react"
} }
} }
...@@ -52,11 +52,13 @@ export default function ({ types: t }: {types: typeof BabelTypes}): PluginObj { ...@@ -52,11 +52,13 @@ export default function ({ types: t }: {types: typeof BabelTypes}): PluginObj {
if ( if (
callExpression.isMemberExpression() && callExpression.isMemberExpression() &&
callExpression.node.computed === false && callExpression.node.computed === false
callExpression.get('property').isIdentifier({ name: 'Map' })
) { ) {
const property = callExpression.get('property')
if (!Array.isArray(property) && property.isIdentifier({ name: 'Map' })) {
callExpression = callExpression.parentPath callExpression = callExpression.parentPath
} }
}
if (!callExpression.isCallExpression()) return if (!callExpression.isCallExpression()) return
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
"scripts": { "scripts": {
"build": "taskr", "build": "taskr",
"release": "taskr release", "release": "taskr release",
"prepublish": "npm run release" "prepublish": "npm run release",
"typescript": "tsc --noEmit"
}, },
"taskr": { "taskr": {
"requires": [ "requires": [
...@@ -91,6 +92,7 @@ ...@@ -91,6 +92,7 @@
"react-dom": "^16.0.0" "react-dom": "^16.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/parser": "7.2.0",
"@taskr/clear": "1.1.0", "@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0", "@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0", "@taskr/watch": "1.1.0",
...@@ -100,6 +102,7 @@ ...@@ -100,6 +102,7 @@
"@types/babel__template": "7.0.1", "@types/babel__template": "7.0.1",
"@types/babel__traverse": "7.0.3", "@types/babel__traverse": "7.0.3",
"@types/nanoid": "1.2.0", "@types/nanoid": "1.2.0",
"@types/node-fetch": "2.1.4",
"@types/webpack": "4.4.20", "@types/webpack": "4.4.20",
"taskr": "1.1.0", "taskr": "1.1.0",
"typescript": "3.1.6" "typescript": "3.1.6"
......
{ {
"compilerOptions": { "compilerOptions": {
"strict": true,
"allowJs": true, "allowJs": true,
"noEmit": true, "noEmit": true,
"module": "esnext", "module": "esnext",
"target": "ES2017", "target": "ES2017",
"esModuleInterop": true, "esModuleInterop": true,
"moduleResolution": "node",
"jsx": "react", "jsx": "react",
"strictNullChecks": true,
"noImplicitAny": true,
"baseUrl": "../..", "baseUrl": "../..",
"paths": { "paths": {
"@babel/types": [ "@babel/types": [
"babel-types/index.d.ts", "@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"
] ]
} }
} }
......
declare module '@babel/plugin-transform-modules-commonjs';
declare module 'next-server/next-config';
declare module 'next-server/constants';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment