Writing a standard
A standard file holds name, description, extends, lint and format. Comments and trailing commas are allowed:
// ../shared/acme/kscript-standard.json
{
"$schema": "https://raw.githubusercontent.com/kylepantall/kscript/master/editors/vscode/schemas/kscript-standard.schema.json",
"name": "acme",
"description": "Acme house style.",
"extends": "kscript:recommended",
"lint": {
"rules": { "KS6*": "error" },
"warnings_as_errors": true
},
"format": { "indent": 4, "max_blank_lines": 2 }
}lint takes rules (a severity for each code or prefix: off, hint, info, warning or error) and warnings_as_errors. format takes every format setting: indent, tab_width, print_width, max_blank_lines, end_of_line, preserve, rules and enabled (see Formatting).
Which files are checked and formatted (include and exclude) depends on each project's folders, so those stay in kscript.json. A standard that sets them gets a warning, and they are ignored. So are serve, test, app and packages.
Name a standard file kscript-standard.json, so a project can name its folder, or something.kscript-standard.json. The VS Code extension validates and completes both, and any other name works too.
Settings are written in snake_case (warnings_as_errors, print_width). An old camelCase name (warningsAsErrors, printWidth) is an error that names the new one. Unknown settings are warnings.
Where a standard can live
"standard" in kscript.json and "extends" in a standard take a built-in name, a path, or a list of them:
"standard": "kscript:recommended" // built in
"standard": "./standards/team.kscript-standard.json" // a file, relative to the file that names it
"standard": "../shared/acme" // a folder holding kscript-standard.json
"standard": "~/kscript/standard.json" // a file in your home folder
"standard": ["kscript:recommended", "./team.json", "./this-repo.json"] // several, applied in orderPaths in extends are relative to the standard, so standards can move together. A folder makes a standard easy to share as a Git submodule, a shared folder, or a package your team checks out next to its projects.
A standard that can't be found, isn't valid JSON, or extends itself (directly or through others) is an error, and kscript check stops with exit code 2.