diff --git a/docs/testing/linters.md b/docs/testing/linters.md index 2a63e83fcb..a6a84ea465 100644 --- a/docs/testing/linters.md +++ b/docs/testing/linters.md @@ -106,6 +106,8 @@ following checks: - Running `mypy` to check static types in Python code. Our [documentation on using mypy](../testing/mypy.html) covers mypy in more detail. +- Running `tsc` to compile TypeScript code. Our [documentation on + TypeScript](typescript.html) covers TypeScript in more detail. The rest of this document pertains to the checks that occur in `./tools/lint`. diff --git a/docs/testing/typescript.md b/docs/testing/typescript.md index 09d1f88f0c..385d65235a 100644 --- a/docs/testing/typescript.md +++ b/docs/testing/typescript.md @@ -32,11 +32,11 @@ The following resources are valuable for learning TypeScript: ## Type checking -TypeScript types are checked primarily via `webpack`, so you'll see -typing errors in red in your `run-dev.py` console as you do -development. - -TODO: Document command for running the type check manually. +TypeScript types are checked by the TypeScript compiler, `tsc`, which +is run as part of our [lint checks](linters.html). You can run the +compiler yourself with `tools/run-tsc`, which will check all the +TypeScript files once, or `tools/run-tsc --watch`, which will +continually recheck the files as you edit them. ## Linting and style diff --git a/package.json b/package.json index 6287ce2c86..5b755d50ff 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "zxcvbn": "4.4.2" }, "devDependencies": { + "@types/source-map": "0.5.2", "@typescript-eslint/eslint-plugin": "^1.12.0", "@typescript-eslint/parser": "^1.12.0", "casperjs": "casperjs/casperjs", diff --git a/static/js/tsconfig.json b/static/js/tsconfig.json index 442398e616..cd5984b36d 100644 --- a/static/js/tsconfig.json +++ b/static/js/tsconfig.json @@ -7,6 +7,7 @@ // "incremental": true, /* Basic options */ + "noEmit": true, "target": "es5", "module": "es6", "jsx": "preserve", diff --git a/tools/lint b/tools/lint index a88c480e0a..e212e8bc58 100755 --- a/tools/lint +++ b/tools/lint @@ -84,6 +84,8 @@ def run(): command.append('--force') linter_config.external_linter('mypy', command, ['py'], pass_targets=False, description="Static type checker for Python (config: mypy.ini)") + linter_config.external_linter('tsc', ['tools/run-tsc'], ['ts'], pass_targets=False, + description="TypeScript compiler (config: static/js/tsconfig.json)") linter_config.external_linter('gitlint', ['tools/commit-message-lint'], description="Checks commit messages for common formatting errors." "(config: .gitlint)") diff --git a/tools/run-tsc b/tools/run-tsc new file mode 100755 index 0000000000..d6bb801345 --- /dev/null +++ b/tools/run-tsc @@ -0,0 +1,3 @@ +#!/bin/sh +ZULIP_PATH="$(dirname "$0")/.." +exec "$ZULIP_PATH/node_modules/.bin/tsc" --project "$ZULIP_PATH/static/js" "$@" diff --git a/version.py b/version.py index 2212d6eeaf..8afbb7c350 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea # historical commits sharing the same major version, in which case a # minor version bump suffices. -PROVISION_VERSION = '42.0' +PROVISION_VERSION = '42.1' diff --git a/yarn.lock b/yarn.lock index 085bc8936f..d6c485902a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -329,6 +329,11 @@ "@types/express-serve-static-core" "*" "@types/mime" "*" +"@types/source-map@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@types/source-map/-/source-map-0.5.2.tgz#973459e744cc7445c85b97f770275b479b138e08" + integrity sha512-++w4WmMbk3dS3UeHGzAG+xJOSz5Xqtjys/TBkqG3qp3SeWE7Wwezqe5eB7B51cxUyh4PW7bwVotpsLdBK0D8cw== + "@types/tapable@*": version "1.0.4" resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370"