Kendo UI Labs projects are experimental and largely built and supported by the community. As such Telerik does not provide official support for any of the Kendo UI Labs projects via Telerik support agreements. We do encourage you to open an issue or visit Stack Overflow.
A static analysis (linting) tool that checks your usage of Kendo UI objects... automatically!
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.
npm install -g kendo-lint
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
.
var kendoLint = require("kendo-lint");
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 }
Pass the full path to the file to lint. Your callback is invoked with
two arguments, error
and results
.
Use this to lint HTML code. It's similar to lintJS
, except that for
the time being we cannot report line/column information.
Similar to lintJSFile
, but for HTML code.
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, <script> tags are treated specially in HTML, specifically:
-
if there is no
src
attribute, and there is notype
or there is atype
that indicates that the content is JavaScript, then the content will be linted vialintJSFile
. -
if there is a
type
attribute containing the string "template" it will assume that the template generates some kind of HTML, so the content will be linted vialintHTMLFile
.
As mentioned, the linter relies on knowledge it gets from the Kendo
API documentation, so it will be as good as the docs. The data is
stored in lib/api.json
. To update this file, pass --parse-docs /path/to/kendo-docs-repo
.
If you would like to contribute to kendo-lint's source code, please read the [guidelines for pull requests and contributions] CONTRIBUTING.md). Following these guidelines will help make your contributions easier to bring in to the next release.
Use this section to list ways that a developer can obtain help or support for this project, for instance, Stack Overflow. Make sure to also leave the following section:
As a part of Kendo UI Labs, kendo-lint is intended to be a community-run project, and not an official part of any Kendo UI SKU (Web, DataViz, Mobile or Complete). As such, this project is not a supported part of Kendo UI, and is not covered under the support agreements for Kendo UI license holders. Please do not create support requests for this project, as these will be immediately closed and you'll be directed to post your question on a community forum.
For change logs and release notes, see the changelog file.
This project has been released under the Apache License, version 2.0, the text of which is included below. This license applies ONLY to the project-specific source of each repository and does not extend to Kendo UI itself, or any other 3rd party libraries used in a repository. For licensing information about Kendo UI, see the License Agreements page at KendoUI.com.
Copyright © 2013 Telerik
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.