kendo-lint

0.2.3 • Public • Published

kendo-lint

About kendo-lint

A static analysis (linting) tool that checks your usage of Kendo UI objects... automatically!

Compatibility and Requirements

kendo-lint was designed to inspect your Kendo UI configurations in a terminal environment with Node.js

kendo-lint currently depends on the following libraries:

  • Node
  • NPM
  • UglifyJS
  • Glob
  • Markdown
  • Optimist

kendo-lint has not been tested against any other versions of these libraries. You may find that versions other than these are compatible with kendo-lint, but we make no claims to support those version, nor can we troubleshoot issues that arise when using those versions.

Installation

npm install -g kendo-lint

Usage (command-line)

kendo-lint [options] [files]

If no file names are given, it will read from STDIN. By default it parses STDIN as JavaScript, pass --html to parse as HTML.

When file names are passed, the type will be determined from the extension, but it can be forced with either --js or --html.

To output results as a JSON array, pass --json.

API

var kendoLint = require("kendo-lint");

lintJS(code, filename)

var results = kendoLint.lintJS(code, filename);

Use this if you already have the code in memory. No file is read, the filename argument is just included in the results array, which will contain objects like this:

{ filename: filename,
  message: "Warning message",
  line: the line number,
  col: the column }

lintJSFile(filename, callback)

Pass the full path to the file to lint. Your callback is invoked with two arguments, error and results.

lintHTML(code, filename)

Use this to lint HTML code. It's similar to lintJS, except that for the time being we cannot report line/column information.

lintHTMLFile(filename, callback)

Similar to lintJSFile, but for HTML code.

What it does

The Kendo linting tool will search for code that constructs Kendo widgets, and check the passed options against the API documentation. Any mismatches are reported (invalid option name, or invalid type for option).

For JavaScript it looks for code like this:

(...).kendoWidgetName({ ... })

and check the options inside the brackets. It checks nested options too.

For HTML it searches MVVM constructs, like:

<div data-role="widget-name" data-option="..."> ... </div>

and tries to validate the widget name and given options against known API. However,

Readme

Keywords

none

Package Sidebar

Install

npm i kendo-lint

Weekly Downloads

4

Version

0.2.3

License

Apache 2.0

Last publish

Collaborators

  • bsatrom
  • mishoo