diff --git a/runtime/reference/cli/check.md b/runtime/reference/cli/check.md index a2254c141..87c573b99 100644 --- a/runtime/reference/cli/check.md +++ b/runtime/reference/cli/check.md @@ -7,9 +7,9 @@ openGraphTitle: "deno check" description: "Download and type-check code without execution" --- -## Example +## Examples -Type-check without execution. +Type-check a TypeScript file without execution: ```ts title="example.ts" const x: string = 1 + 1n; @@ -18,3 +18,13 @@ const x: string = 1 + 1n; ```bash deno check example.ts ``` + +## Type-checking JavaScript files + +If you have a JavaScript-only project and want to type-check it with Deno, you +can use the `--check-js` flag instead of adding `// @ts-check` to every file or +setting `compilerOptions.checkJs` in your `deno.json`: + +```bash +deno check --check-js main.js +``` diff --git a/runtime/reference/cli/fmt.md b/runtime/reference/cli/fmt.md index 587ee5c05..83610128e 100644 --- a/runtime/reference/cli/fmt.md +++ b/runtime/reference/cli/fmt.md @@ -57,6 +57,16 @@ enclosed in triple backticks and have a language attribute. ::: +## Checking formatting in CI + +Use `--check` to verify files are formatted without modifying them. Add +`--fail-fast` to stop on the first unformatted file instead of reporting all of +them, which is useful in large codebases: + +```sh +deno fmt --check --fail-fast +``` + ## Ignoring Code ### JavaScript / TypeScript / JSONC