KOLint
Search…
Installation

Installation

Note! If you want to learn about the syntax used in views, refer to the syntax documentation.
1
npm i -D knockout-lint
Copied!

Using the CLI

Installing npm globally (optional)

1
npm i -g knockout-lint
Copied!

Running the CLI

Use -c or --config to specify a custom path to a config file. Default is .kolintrc or .kolintrc.*.
1
kolint views/**/*.html
Copied!

Using the API

1
import * as kolint from 'knockout-lint';
2
3
// Creates a new program, can be used with multiple files.
4
const program = kolint.createProgram();
5
6
// Parsing a document
7
const document = program.parse(/* document text */);
8
9
// Compiling the document with built-in TypeScript compiler
10
const tsOut = program.compile(/* document path */, document);
11
12
// Getting diagnostics from program and built-in TypeScript compiler
13
const diagnostics = program.diagnostics.concat(tsOut.getDiagnostics());
Copied!
Last modified 4mo ago