KOLint is a type checker and lint tool for Knockout.JS views. TypeScript is used for type checking the Knockout view bindings when the viewmodel is defined in Typescript. The tool also checks for common mistakes in Knockout views. See documentation at docs.kolint.org.
- Add reference to your view:
<!-- ko-import ViewModel from './viewmodel' --> <!-- ko-viewmodel ViewModel -->
- Run KOLint without installing it:
$ npx knockout-lint view.html
Production compilation
KOLint has some amazing features not used with its full potential. KOLint will always be focused on linting and type checking, but a feature project to be made is to compile the knockout bindings into bundled JavaScript files. This has the advantages of:
-
Security — hackers will have a harder time getting any useful information from the bindings. Also, if using knockout 3.x or below, the code will not have to be evaluated.
-
Performance — knockout will not have to parse the JavaScript and bindings or evaluate them.