Tern Linter - angelozerr/tern.java GitHub Wiki
Tern Linter (Validator)
Since 0.9.0, Tern IDE provides a WTP Tern Validator
which uses several linter to validate your JavaScript files :
- Lint which is a semantic linter.
- ESLint.
- JSHint.
- JSCS. ( JSCS is JavaScript Code Style checker http://jscs.info/ )
WTP Tern Validator
is able to use those linter :
- as you are typing on the JavaScript (JSDT), HTML, JSP editors.
Manual/Build
Validation like other WTP Validators (HTML, XML, etc).
Tern linters are tern modules, so to activate validation with those linters, you must just select it (one or several) in the Tern / Modules
project properties page. So it's possible to validate your JavaScript files with
Lint and JSHint together for instance.
Each linter are tern plugin which are executed with node.js. The goal of tern linter is to provide the capability to add your own linter (ex : JSLint) easily.
Configuration
Tern Linter
To use tern validation, you must select one or several linters and configure it. Please read:
- Lint to configure the semantic linter.
- ESLint to configure ESLint.
- JSHint to configure JSHint.
- JSCS. ( JSCS is JavaScript Code Style checker http://jscs.info/ ) to configure JSCS.
WTP Tern Validator
WTP Tern Validator which uses linters (JSHint, ESLInt, etc) can be configured like other WTP Validator (HTML, XML, etc). To configure it, open the project properties and go at Validation
. By default Tern Validation is enable :
If you want that validation is done each time you save your JavaScript Editor, you must select Add Validation Builder
and check that Build
checkbox is checked for Tern Validator
:
Click on OK button, reopen the project properties and go at Builders
: you should see that Validation
builder is added to the Builders
list :
Now tern validation should be done as soon as you save your JavaScritpt editor.
Improvement (TODO)
- Tern Script path to ignore JavaScript files to ignore.