KScript docs
EN

Lint standards

Built-in standards

kscript:recommended

kscript:recommended is the default. Its style rules (KS6xxx, such as KS6001 early returns and the unused code rules KS6002 to KS6005) are warnings.

It writes the formatter's layout out in full: print_width 80, max_blank_lines 1, end_of_line auto, and every format rule on. The indent is left to the editor's tab settings (2 for kscript fmt), so set format.indent in your own standard to pin it.

kscript:strict

kscript:strict extends kscript:recommended. Its style rules are errors, and lint.warnings_as_errors is on, so kscript check fails on any warning. It changes lint severities only; strict types, which hold every value to a proven type, are turned on with strict in a file or "strict": true in kscript.json:

JSON
// kscript.json
{ "standard": "kscript:strict" }

What a standard can't turn off

The correctness checks (KS1xxx to KS5xxx: unknown elements, undefined variables, wrong argument counts and so on) are always on at their built-in severity. A standard may change them, but it doesn't have to list them.

Style rules (KS6001 to KS6005, KS6007, KS6008, KS6013, KS6018 and KS6020 to KS6026) are opinions, so they are only on when a standard turns them on. That means:

  • "standard": [] uses no standard at all: correctness checks only, style rules off, and the formatter's defaults.
  • A standard of your own with no extends also starts with style rules off. Add "extends": "kscript:recommended" to keep them.

The old spellings (KS6006, KS6009 to KS6012, KS6014 and KS6019) are not opinions. In a .kscript file, each one is an error the engine itself refuses to run, and no standard or lint.rules entry changes that (see Style).

To see what a built-in standard sets, run kscript check --print-config in a folder without a kscript.json, or with "standard": "kscript:strict". They are defined in KScript.Core/Projects/Standards.cs, in the same JSON a standard file holds.