Skip to content

Analyzer

Introduction

What is this?

The analyzer allows you to find issues in your Knockout views (in HTML) build-time. The analyzer provides a set of predefined rules that helps you find common misstakes or enforce code style. You can also configure external tools such as TypeScript and ESLint to lint directly on the views.

html
<p data-bind="events: ..."></p>
              ~~~~~~
Binding handler "events" is not defined. Did you mean "event"?

Setup

sh
# Make sure you have the CLI installed.
$ npm install --save-dev @knuckles/cli

# This will configure the analyzer for you.
$ npx ko add analyzer
sh
# Make sure you have the CLI installed.
$ yarn add --dev @knuckles/cli

# This will configure the analyzer for you.
$ yarn ko add analyzer
sh
# Make sure you have the CLI installed.
$ pnpm add --save-dev @knuckles/cli

# This will configure the analyzer for you.
$ pnpm ko add analyzer
sh
# Make sure you have the CLI installed.
$ bun add --save-dev @knuckles/cli

# This will configure the analyzer for you.
$ bun ko add analyzer

Usage

sh
$ npx ko analyze --help
sh
$ yarn ko analyze --help
sh
$ pnpm ko analyze --help
sh
$ bun ko analyze --help

Whats next?