mirror of https://github.com/zulip/zulip.git
lint: Add TypeScript compiler as a linter.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
40e8fd24ff
commit
ecfb7c6a7f
|
@ -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`.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// "incremental": true,
|
||||
|
||||
/* Basic options */
|
||||
"noEmit": true,
|
||||
"target": "es5",
|
||||
"module": "es6",
|
||||
"jsx": "preserve",
|
||||
|
|
|
@ -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)")
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
ZULIP_PATH="$(dirname "$0")/.."
|
||||
exec "$ZULIP_PATH/node_modules/.bin/tsc" --project "$ZULIP_PATH/static/js" "$@"
|
|
@ -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'
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue