GithubHelp home page GithubHelp logo

alexbeauchemin / eslint-plugin-html Goto Github PK

View Code? Open in Web Editor NEW

This project forked from benoitzugmeyer/eslint-plugin-html

0.0 2.0 0.0 35 KB

An ESLint plugin to extract and lint scripts from HTML files.

License: ISC License

JavaScript 100.00%

eslint-plugin-html's Introduction

eslint-plugin-html

Build Status

This ESLint plugin extracts and lints scripts from HTML files.

Supported HTML extensions: .html, .xhtml, .htm, .vue, .hbs, .mustache, .php

Only script tags with no type attribute, with a type attribute containing a standard JavaScript MIME type such as text/javascript or application/javascript, or text/babel will be linted.

Usage

Simply add the plugin to your ESLint configuration. See ESLint documentation.

Example:

{
    "plugins": [
        "html"
    ]
}

Settings

By default, the code between <script> tags is dedented according to the first non-empty line. The setting html/indent allows to ensure every script tags follows an uniform indentation. Like the indent rule, you can pass a number of spaces, or "tab" to indent with one tab. Prefix this value with a + to be relative to the <script> tag indentation. Example:

{
    "plugins": [ "html" ],
    "settings": {
      "html/indent": "0",   // code should start at the beginning of the line (no initial indentation).
      "html/indent": "+2",  // indentation is the <script> indentation plus two spaces.
      "html/indent": "tab", // indentation is one tab at the beginning of the line.
    }
}

By default, this plugin won't warn if it encounter a problematic indentation (ex: a line is under indented). If you want to make sure the indentation is correct, use the html/report-bad-indent in conjonction with the indent rule. Pass 1 to display warnings, or 2 to display errors. Example:

{
    "plugins": [ "html" ],
    "settings": {
      "html/report-bad-indent": 2,
    }
}

eslint-plugin-html's People

Contributors

adalinesimonian avatar alexbeauchemin avatar ben52 avatar benoitzugmeyer avatar dictav avatar greggman avatar kmaglione avatar nagy-tamas avatar philipp90 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.