Git Product home page Git Product logo

codemirror-lint-eslint's Introduction

codemirror-lint-eslint

codemirror-lint-eslint provides the eslint-lint.js which is a CodeMirror addon to use CodeMirror Lint with ESLint.

You can play with the demo index.html which validate JavaScript content of a CodeMirror editor with ESLint:

CodeMirror & ESLint

How to use it?

To use eslint-lint.js, you must declare your CodeMirror instance with javascript mode, and activate lint (gutters & lint to true) like this :

var editor = CodeMirror.fromTextArea(document.getElementById("code-js"), {
    lineNumbers: true,
    mode: "javascript",
    gutters: ["CodeMirror-lint-markers"],
    lint: true
});

and include several scripts (see index.html to see the full scripts and CSS to include).

  • ESLint scripts :
<script src="http://eslint.org/js/app/eslint.js" ></script> 
  • Commons Codemirror :
<link rel=stylesheet href="resources/codemirror/doc/docs.css">
<link rel="stylesheet" href="resources/codemirror/lib/codemirror.css">
<script src="resources/codemirror/lib/codemirror.js"></script>
  • JavaScript mode
<script src="resources/codemirror/mode/javascript/javascript.js"></script> 
  • Commons Lint interface
<link rel="stylesheet" href="resources/codemirror/addon/lint/lint.css">
<script src="resources/codemirror/addon/lint/lint.js"></script> 
  • Lint implementation with ESLint
<script src="eslint-lint.js"></script>

Structure

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

  • eslint-lint.js the CodeMirror Lint addon which uses ESLint.
  • index.html the demo which uses ESLint with CodeMirror editor.
  • resources folder which contains CodeMirror & ESLint resources.

codemirror-lint-eslint's People

Contributors

angelozerr 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.