A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.deno.com/runtime/reference/cli/lint/ below:

deno lint, linter

deno lint, linter

Command line usage:

deno lint [OPTIONS] [files]...

Lint JavaScript/TypeScript source code.

deno lint myfile1.ts myfile2.js

Print result as JSON:

Read from stdin:

cat file.ts | deno lint -
cat file.ts | deno lint --json -

List available rules:

To ignore specific diagnostics, you can write an ignore comment on the preceding line with a rule name (or multiple):

// deno-lint-ignore no-explicit-any
// deno-lint-ignore require-await no-empty

To ignore linting on an entire file, you can add an ignore comment at the top of the file:


Linting options Jump to heading# --compact Jump to heading#

Output lint result in compact format.

--fix Jump to heading#

Fix any linting errors for rules that support it.

--ignore Jump to heading#

Ignore linting particular source files.

--json Jump to heading#

Output lint result in JSON format.

--rules Jump to heading#

List available rules.

--rules-exclude Jump to heading#

Exclude lint rules.

--rules-include Jump to heading#

Include lint rules.

--rules-tags Jump to heading#

Use set of rules with a tag.

Options Jump to heading# --allow-import Jump to heading#

Short flag: -I

Allow importing from remote hosts. Optionally specify allowed IP addresses and host names, with ports as necessary. Default value: deno.land:443,jsr.io:443,esm.sh:443,cdn.jsdelivr.net:443,raw.githubusercontent.com:443,user.githubusercontent.com:443.

--config Jump to heading#

Short flag: -c

Configure different aspects of deno including TypeScript, linting, and code formatting. Typically the configuration file will be called deno.json or deno.jsonc and automatically detected; in that case this flag is not necessary.

--deny-import Jump to heading#

Deny importing from remote hosts. Optionally specify denied IP addresses and host names, with ports as necessary.

--ext Jump to heading#

Specify the file extension to lint when reading from stdin.For example, use jsx to lint JSX files or tsx for TSX files.This argument is necessary because stdin input does not automatically infer the file type.Example usage: cat file.jsx | deno lint - --ext=jsx.

--no-config Jump to heading#

Disable automatic loading of the configuration file.

--permit-no-files Jump to heading#

Don't return an error code if no files were found.

File watching options Jump to heading# --no-clear-screen Jump to heading#

Do not clear terminal screen when under watch mode.

--watch Jump to heading#

Watch for file changes and restart process automatically. Only local files from entry point module graph are watched.

--watch-exclude Jump to heading#

Exclude provided files/patterns from watch mode.

Available rules Jump to heading#

For a complete list of supported rules, visit List of rules documentation page.

Ignore directives Jump to heading# File level Jump to heading#

To ignore a whole file use // deno-lint-ignore-file at the top of the file:

You can also specify the reason for ignoring the file:

The ignore directive must be placed before the first statement or declaration:







import { bar } from "./bar.js";

function foo(): any {
  
}

You can also ignore certain diagnostics in the whole file:

If there are multiple // deno-lint-ignore-file directives, all but the first one are ignored:







function foo(): any {
  debugger; 
}
Line level Jump to heading#

To ignore specific diagnostics use // deno-lint-ignore <codes...> on the preceding line of the offending line.


function foo(): any {
  
}


function bar(a: any) {
  
}

You must specify the names of the rules to be ignored.

You can also specify the reason for ignoring the diagnostic:

Ignore ban-unused-ignore itself Jump to heading#

deno lint provides ban-unused-ignore rule, which will detect ignore directives that don't ever suppress certain diagnostics. This is useful when you want to discover ignore directives that are no longer necessary after refactoring the code.

In a few cases, however, you might want to ignore ban-unused-ignore rule itself. One of the typical cases would be when working with auto-generated files; it makes sense to add file-level ignore directives for some rules, and there's almost no need for detecting unused directives via ban-unused-ignore in this case.

You can use // deno-lint-ignore-file ban-unused-ignore as always if you want to suppress the rule for a whole file:

Do note that ignoring ban-unused-ignore itself only works via file-level ignore directives. This means that per line directives, like // deno-lint-ignore ban-unused-ignore, don't work at all. If you want to ignore ban-unused-ignore for some special reasons, make sure to add it as a file-level ignore directive.

More about linting and formatting Jump to heading#

For more information about linting and formating in Deno, and the differences between these two utilities, visit the Linting and Formatting page in our Fundamentals section.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4