Code Monkey home page Code Monkey logo

tern-lint's Introduction

tern-lint

Build Status

tern-lint provides :

  • the tern lint plugin lint.js to validate JS files.
  • the CodeMirror lint addon tern-lint.js which uses tern lint plugin lint.js

Integration

See Integration for more information to integrate the tern lint plugin in your editor.

with CodeMirror :

Here a screenshot with tern lint and CodeMirror :

CodeMirror & TernLint

with Eclipse :

If you are Eclipse user, you can use the tern lint.js too. See Tern IDE & Validation

Eclipse & TernLint

with Emacs

Emacs & TernLint

See tern-lint.el for more information.

with other editor

If you wish to integrate the tern lint with an editor (vim, etc), here the JSON request to post to the tern server :

{
 "query": {
  "type": "lint",
  "file": "test.js",
  "files": [
   {
    "name": "test.js",
    "text": "var elt = document.getElementByIdXXX('myId');",
    "type": "full"
   }
  ]
 }
}

and the JSON response of the tern server :

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

Validation rules

tern lint validate JS files but not syntax errors, it manages those validation rules :

  • unknown property. (ex : document.getElementByIdXXX where getElementByIdXXX is an unknown property of document)
  • unknown identifier. (ex : a = '' where a is an unknown identifier)
  • not a function (ex : var a = []; a.length() is not valid because length of array is not a function)
  • invalid argument (ex : document.getElementById(1000) is not valid because 1000 is a number and not a string)

See Validation rules for more informations.

Structure

The basic structure of the project is given in the following way:

  • demos/ demos with tern lint plugin which use CodeMirror.
  • codemirror/ contains the CodeMirror lint addon tern-lint.js, which is an implementation of CodeMirror lint addon with tern.lint.
  • lint.js/ the tern lint plugin.
  • test/ contains test of tern lint plugin.

tern-lint's People

Contributors

angelozerr avatar metamemoryt avatar rkistner avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.