Skip to content
David O'Trakoun edited this page Oct 5, 2016 · 2 revisions

Command line

First step

Install tern-lint with npm like this :

$ npm install -g tern-lint

Go at in your folder which contains your JavaScripts files to validate :

$ cd your/folder/which/contains/javascript/files

Execute the lint :

$ lint --format=pretty

This command loop for each JavaScript files of the your/folder/which/contains/javascript/files folder and validate each files.

The shell window should display errors like this :

{
 "messages": [
  {
   "message": "Unknow property 'getElementByIdXXX'",
   "from": 19,
   "to": 36,
   "severity": "warning"
  }
 ]
}

Configuration

.tern-project

You can customize the command line with the standard .tern-project to customize plugins, JSON type definitions or path with loadEagerly :

{
  "libs": [
    "browser",
    "jquery"
  ],
  "loadEagerly": [
    "importantfile.js"
  ],
  "plugins": {
    "requirejs": {
      "baseURL": "./",
      "paths": {}
    }
  }
}

If your/folder/which/contains/javascript/files contains a .tern-project, it will use it to know which plugins, JSON type definitions to load, which JavaScript files to validate (if loadEagerly is defined).

Options

The lint command waits several optional parameters :

  • --format=[json,pretty,vim] to format result messages as one line of json, with indentation, or for vim parsing
  • --strip-crs see tern manual.
  • --disable-loading-local see tern manual.
  • --verbose see tern manual.

Contents

Clone this wiki locally