JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q44637F
  • License MIT

Lint and type check knockout.js bindings in the view with view model types.

Package Exports

  • knockout-lint

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (knockout-lint) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme


Logo

KOLint

TypeScript type check Knockout HTML files using view models
Explore the docs »

Getting Started · Report Bug · Website · Contributing · Roadmap

npm - version Codacy Badge npm - knockout-lint GitHub - kolint LICENSE - MIT npm - downloads


KOLint is a lint tool for Knockout.JS. It can catch syntax errors, it also has a built-in TypeScript type checker that can be used on views to get type and TypeScript syntax errors.

Built with

  • meriyah - A 100% compliant, self-hosted javascript parser. Has support for ES2020 and TypeScript syntax.
  • TypeScript - Superset of JavaScript that compiles to clean JavaScript output.
  • jison - Generates bottom-up parsers in JavaScript. Its API is similar to Bison's.

Why?

Knockout has worked the same since 2010 and has never disappointed me. Due to it being a core library, it is compact, has cross-browser compatibility, and can be extended from parsing bindings differently and building view models with TypeScript decorators, to be used as a framework. The bindings works as simple as it gets using HTML attributes.

Headline features:

  • Elegant dependency tracking - automatically updates the right parts of your UI whenever your data model changes.
  • Declarative bindings - a simple and obvious way to connect parts of your UI to your data model. You can construct a complex dynamic UIs easily using arbitrarily nested binding contexts.
  • Trivially extensible - implement custom behaviors as new declarative bindings for easy reuse in just a few lines of code.

Additional benefits:

  • Pure JavaScript library - works with any server or client-side technology.
  • Can be added on top of your existing web application without requiring major architectural changes
  • Compact - around 13kb after gzipping
  • Works on any mainstream browser (IE 6+, Firefox 2+, Chrome, Safari, Edge, others)
  • Comprehensive suite of specifications (developed BDD-style) means its correct functioning can easily be verified on new browsers and platforms

Check out the demos at Knockout.JS website.

Roadmap

Knockout TypeScript Decorators Support

Our team will try to focus on getting support for TypeScript decorators as soon as possible. Check out the Knockout Decorators project.

Knockout Support Extensions

Linting and type checking views are quite remarkable, but not if it is not convenient. Therefore one of our goals is to make in-editor support for knockout in both Visual Studio Code and Visual Studio 2019. The extensions will include lint and type checking diagnostics visible in the text editor, autocompletion, IntelliSense, automatic importation of view models and binding handlers.

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 JavaScript files. This has the advantages of:

  1. 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.

  2. Performance — knockout will not have to parse the JavaScript and bindings or evaluate them.

See the open issues for a list of proposed features and known issues

This project is licensed under the MIT license. Go to license.