QUICK-LINT-JS(1)

๐Ÿ“ฆ version 3.2.0, in alpine 3.24, nixos 26.05, nixpkgs unstable

๐Ÿ’… quick-lint-js(1) โ€” find bugs in JavaScript programs ๐Ÿ›โœจ

okay bestie, so this is quick-lint-js, and the manual name is QUICK-LINT-JS(1) in case you were wondering ๐Ÿซถ she's a linter, she finds bugs, she's iconic, periodt.

โœจ SYNOPSIS โœจ

quick-lint-js [--output-format=format] [<options>] file [file...]
quick-lint-js --lsp-server [<options>]
quick-lint-js --debug-apps
quick-lint-js --help
quick-lint-js --version

๐ŸŒธ DESCRIPTION ๐ŸŒธ

So quick-lint-js literally reads your JavaScript files and reports syntax errors and other bugs. that's the whole vibe. no cap, that's it. ๐Ÿ”ฅ

This command has three modes, bestie:

quick-lint-js [<options>] file [file...] : Batch mode (default). Check the given files, and report errors to the terminal (standard error). --output-format can be used to customize how errors look.

quick-lint-js --lsp-server : LSP server mode. Use this mode to integrate with code editors supporting LSP. For more information, see quick-lint-js-lsp(8).

quick-lint-js --debug-apps, quick-lint-js --help, quick-lint-js --version : Information mode. Prints information about quick-lint-js then exits.


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • --output-format=format โ€” customize how errors are printed. format is one of these lil cuties:
    • gnu-like (default): a human-readable format similar to GCC.
    • vim-qflist-json: machine-readable JSON which can be given to Vim's setqflist function.
    • emacs-lisp: Emacs Lisp association list format.
๐Ÿšซ Incompatible with --lsp-server.
  • --diagnostic-hyperlinks=when โ€” control whether to hyperlink error codes or not. This option is only used if --output-format=gnu-like. when is one of the following:
    • auto (default): shows error codes as hyperlinks only if the error output is a terminal. On Windows it behaves like 'never'.
    • always: always shows error codes as hyperlinks.
    • never: never shows error codes as hyperlinks.
๐Ÿšซ Incompatible with --lsp-server.

Added in quick-lint-js version 0.7.0.

  • --vim-file-bufnr=number โ€” set the bufnr property for errors printed with the --output-format=vim-qflist-json option.

--vim-file-bufnr applies only to the next input file given in the command line. Therefore, if multiple input files are given, --vim-file-bufnr can be specified multiple times. iykyk ๐Ÿ’…

  • --path-for-config-search=path โ€” for the following input file or --stdin, use path as the file's path when searching for a configuration file (see quick-lint-js.config(5)).

path must be a syntactically-valid path. path does not need to exist in the filesystem. wild, I know.

--path-for-config-search applies only to the next input file given in the command line. Therefore, if multiple input files are given, --path-for-config-search can be specified multiple times. If --path-for-config-search is the last option, it has no effect. ๐Ÿ˜ญ

--path-for-config-search overrides --stdin-path.

๐Ÿšซ Incompatible with --lsp-server.

Added in quick-lint-js version 0.4.0.

  • --stdin-path=path โ€” change the behavior of --stdin. --stdin still reads a string from standard input, but otherwise it behaves as if the file at path was specified instead:
    • The default language is determined by path (unless overridden by --language). See --language for details.
    • Searching for a configuration file is based on path (unless overridden by --config-file or --path-for-config-file). (See quick-lint-js.config(5) for details on configuration file searching.)

--stdin-path applies to only --stdin, not file paths (even special files such as /dev/stdin). rude but okay ๐Ÿ™ˆ

--stdin-path may appear anywhere in the command line (except after --).

path must be a syntactically-valid path. path does not need to exist in the filesystem. path may be a relative path or an absolute path. slay ๐Ÿ’…

๐Ÿšซ Incompatible with --lsp-server.

Added in quick-lint-js version 2.17.0.

  • --config-file=file โ€” read configuration options from file and apply them to input files which are given later in the command line. See quick-lint-js.config(5) for the format of configuration files.

If --config-file is given twice, then the file for the first --config-file option applies only to the input files between the two --config-file options, and the file for the second --config-file option applies only to the input files after the second --config-file option. See the EXAMPLE section for an example. ๐ŸŽ€

If --config-file is not given, quick-lint-js searches for a configuration file according to the rules specified in quick-lint-js.config(5).

--config-file overrides --path-for-config-file and --stdin-path.

๐Ÿšซ Incompatible with --lsp-server.

Added in quick-lint-js version 0.3.0.

  • --language=languageid โ€” interpret input files which are given later in the command line as if they were written in languageid. languageid is one of the following:
    • default (default): infer the languageid from the file's extension:
      • .js: javascript-jsx
      • .jsx: javascript-jsx
      • .d.ts: typescript-definition
      • .ts: typescript
      • .tsx: typescript-jsx
      • (anything else): javascript-jsx
    • javascript: the latest ECMAScript standard with proposed features.
    • javascript-jsx: like javascript but with JSX (React) extensions.
    • typescript: the latest TypeScript version.
    • typescript-definition: the latest TypeScript version (.d.ts file).
    • typescript-jsx: like typescript but with JSX (React) extensions.

If --language is given twice, then the languageid for the first --language option applies only to the input files between the two --language options, and the languageid for the second --language option applies only to the input files after the second --language option. See the EXAMPLE section for an example.

If --language is the last option, it has no effect. ๐Ÿ’€

If the input file is --stdin:

  • If --stdin-path is specified, its path is used for --language=default.
  • If --stdin-path is not specified, then the path is assumed to be example.js. This means that --language=default will behave like --language=javascript-jsx.
๐Ÿšซ Incompatible with --lsp-server.

Added in quick-lint-js version 2.10.0.

  • --exit-fail-on=errors โ€” cause quick-lint-js to exit with a non-zero exit code if any of the discovered errors is listed in errors.

See the ERROR LISTS section for a description of the format for errors.

๐Ÿšซ Incompatible with --lsp-server.
  • --stdin โ€” read standard input as an input file.

If none of --config-file, --path-for-config-search, or --stdin-path are specified, an empty configuration file is assumed. If --config-file is specified, file is used for linting standard input. If --config-file is not specified and either --stdin-path or --path-for-config-search is specified, quick-lint-js searches for a configuration file according to the rules specified in quick-lint-js.config(5) starting from --stdin-path's path or --path-for-config-search's path.

If neither --stdin-path nor --language are specified, the javascript-jsx language is used.

๐Ÿšซ Incompatible with --lsp-server.

Added in quick-lint-js version 0.3.0.

  • --lsp, --lsp-server โ€” run quick-lint-js in LSP server mode. Use this mode to integrate with code editors supporting LSP. For more information, see quick-lint-js-lsp(8).
๐Ÿšซ Incompatible with --output-format.
  • --snarky โ€” add spice to your failures. ๐ŸŒถ๏ธ This option makes error messages more interesting.

Added in quick-lint-js version 2.5.0.

  • -h, --help โ€” print a help message and exit.

The output format is not intended to be machine-parsable and may change in the future. (so don't @ her with your regex parser bestie ๐Ÿ˜ญ)

  • --debug-apps โ€” print a list of running quick-lint-js instances which have the debug app enabled.

The output format is not intended to be machine-parsable and may change in the future.

--debug-apps is only supported on Linux, macOS, and Windows. ๐Ÿ’ป

  • -v, --version โ€” print version information and exit.

The output format is not intended to be machine-parsable and may change in the future.


๐Ÿฆ‹ ERROR LISTS ๐Ÿฆ‹

Some options, such as --exit-fail-on, accept an error list. An error list is a comma-separated list of error code predicates and error category predicates. so many predicates, it's giving grammar class ngl ๐ŸŒˆ

An error list can contain any number of include, exclude, and default predicates. An include predicate is a '+' followed by the name of an error code or error category. An exclude predicate is a '-' followed by the name of an error code or error category. A default predicate is the name of an error code or error category with no sigil. no sigil, no drama ๐Ÿ’…

An error list containing only include and exclude predicates modifies a default set of error codes. The default set is decided by the option, but is often the set of all error codes. An error list containing at least one default predicate empties the set of error codes, then treats the default predicates as if they were include predicates. ๐Ÿ˜ฎ

The order of predicates within an error list does not matter. Included predicates are processed first, adding to the set of error codes. Excluded predicates are processed second, removing from the set of error codes. ok so order doesn't matter but processing order does, make it make sense ๐Ÿ™ˆ

Error codes have the form E0000, where 0000 is four decimal digits (0-9).

The following error categories are supported:

  • all โ€” all error codes. every single one. ๐Ÿ‘‘

Example error lists ๐Ÿ“

  • E0102,E0110 โ€” only error codes E0102 and E0110, excluding all other error codes.
  • -E0102 โ€” the default set of error codes, except for error code E0102.
  • +E0102 โ€” the default set of error codes, and also error code E0102.
  • all,-E0102 โ€” all error codes, except for error code E0102.
  • E0100,-E0100,+E0200 โ€” only error code E0200, excluding all other error codes.
  • +E0200,-E0100,E0100 โ€” only error code E0200, excluding all other error codes.

โญ EXIT STATUS โญ

  • 0 โ€” main character behavior, honestly:
    • Batch mode: Linting succeeded with no errors or warnings. ๐ŸŽ‰
    • LSP server mode: The LSP client requested that the server shut down. This exit status may change in the future.
  • non-0 โ€” the not-so-slay outcome:
    • Batch mode: Linting failed with at least one error or warning, or at least one file could not be opened and read. ๐Ÿ˜ญ
    • The specific status code may change in the future.

๐Ÿ’œ ENVIRONMENT ๐Ÿ’œ

  • LC_ALL, LC_MESSAGES โ€” change the language used for error and warning messages. For example, set LC_ALL=en to see messages written in United States English. ๐Ÿ—ฃ๏ธ

okay that's part 1, bestie โ€” the rest is coming, don't move ๐Ÿ’–

๐ŸŒธ EXAMPLE ๐ŸŒธ

Okay bestie, this is the part where it all clicks. Real commands, real vibes. Let's go ๐Ÿ’…


โœจ lint one file, messages to your terminal โœจ

Say you've got a file called lib/index.js and you just want the tea spilled straight into your terminal:

$ quick-lint-js lib/index.js
lib/index.js:1:20: error: variable used before declaration: language [E0058]
lib/index.js:2:7: note: variable declared here [E0058]
lib/index.js:3:1: error: assignment to const variable [E0003]
lib/index.js:1:7: note: const variable declared here [E0003]
lib/index.js:5:25: warning: use of undeclared variable: ocupation [E0057]

Look at that. error, note, warning โ€” the whole emotional spectrum in one run ๐Ÿ˜ญ And yeah, ocupation is literally misspelled in the example. That's the whole point, bestie โ€” it's the undeclared variable. Don't come for it ๐Ÿ™ˆ


โœจ three files, machine-readable, straight into a json file โœจ

Now the glow-up: lint three files at once and write machine-readable messages to /tmp/vim-qflist.json:

$ quick-lint-js --output-format=vim-qflist-json \
    --vim-bufnr=3 lib/pizza-dough.js \
    --vim-bufnr=4 lib/pizza-sauce.js \
    --vim-bufnr=6 lib/pineapple.js \
    >/tmp/vim-qflist.json

Notice how each file gets its own --vim-bufnr? That's the pairing, periodt. Errors for lib/pizza-dough.js will include "bufnr":3 in the output and errors for lib/pineapple.js will include "bufnr":6. So your editor knows exactly which buffer to point at ๐ŸŽฏ (And yes, pineapple on pizza is a whole debate โ€” not our problem today ๐Ÿ)


โœจ lint it, but don't fail on one specific thing โœจ

Here's the mood: you want to lint bad.js but you do not want to fail on use-of-undeclared-variable errors. So you negate the code with a minus sign:

$ quick-lint-js --exit-fail-on=-E0057 bad.js
bad.js:5:25: warning: use of undeclared variable: $ [E0057]
$ echo $?
0

See that? The warning still shows up in the output, but $? comes back as 0. So the lint runs, you see the message, but the exit status doesn't scream at you. Iconic behavior, honestly ๐Ÿ‘‘


โœจ different config files for different files โœจ

Source files get the strict config, test files get the lax one. As they should ๐Ÿ’–

$ quick-lint-js \
    --config-file strict-quick-lint-js.config src/index.js src/helpers.js \
    --config-file lax-quick-lint-js.config test/test-app.js

Each --config-file applies to the files that follow it. Strict for src/index.js and src/helpers.js, lax for test/test-app.js. Balanced. Responsible. Main character energy ๐ŸŒˆ


โœจ linting a temp file with your project's config โœจ

Got some unsaved buffer in /tmp and you still want your project's config to apply? Say less:

$ quick-lint-js --path-for-config-search=src/server.js /tmp/unsaved12m1uz.js
/tmp/unsaved12m1uz.js:12:5: warning: use of undeclared variable: document [E0057]

You're linting /tmp/unsaved12m1uz.js, but --path-for-config-search=src/server.js makes it search for the config as if the file lived at that path. Sneaky? A little. Useful? Extremely ๐Ÿซถ


โœจ .js as JavaScript, .jsx as JavaScript+JSX โœจ

Two --language flags, two globs, zero chaos:

$ quick-lint-js \
    --language javascript *.js \
    --language javascript-jsx *.jsx

The first --language applies to the *.js files, the second applies to the *.jsx files. It's giving organized. It's giving understood the assignment ๐Ÿ’…


โœจ linting standard input โœจ

Last one, and it's a lil magic trick โ€” read from stdin:

$ quick-lint-js --language javascript --stdin

Pipe something in, get lint results out. No file needed. Chef's kiss ๐Ÿงš


๐Ÿ’œ SEE ALSO ๐Ÿ’œ

Go read these next, bestie, they're the supporting cast:


Okay that's the whole page!! You made it to the end, I'm so proud of you ๐Ÿ˜ญ๐Ÿ’– This was quick-lint-js version 3.2.0, served up in the QUICK-LINT-JS(1) section of the manual. Go forth and lint, my love โ€” no cap, you're gonna slay โœจ๐Ÿฆ‹๐ŸŽ€

๐Ÿ“ฆ where this page comes from