Giter VIP home page Giter VIP logo

coc-htmlhint's Introduction

coc-htmlhint

fork from a Microsoft/vscode-htmlhint | HTMLHint

Integrates the HTMLHint static analysis tool into coc.nvim.

coc-htmlhint

Install

:CocInstall coc-htmlhint

Configuration options

  • htmlhint.enable: Enable coc-htmlhint extension, default: true
  • htmlhint.documentSelector: The associated document types to be linted, default: ["html", "htm"]
  • htmlhint.options: The htmlhint options object to provide args to the htmlhint command, default: {}

HTMLHint module

The coc-htmlhint extension will attempt to use the locally installed HTMLHint module (the project-specific module if present, or a globally installed HTMLHint module). If a locally installed HTMLHint isn't available, the extension will use the embedded version.

Rules

The HTMLHint extension uses the default rules provided by HTMLHint.

{
  "tagname-lowercase": true,
  "attr-lowercase": true,
  "attr-value-double-quotes": true,
  "doctype-first": true,
  "tag-pair": true,
  "spec-char-escape": true,
  "id-unique": true,
  "src-not-empty": true,
  "attr-no-duplication": true,
  "title-require": true,
  "empty-tag-not-self-closed": true
}

.htmlhintrc

If you'd like to modify the rules, you can provide a .htmlhintrc file in the root of your project folder with a reduced ruleset or modified values.

You can learn more about rule configuration at the HTMLHint Usage page.

Additional file types

By default, HTMLHint will run on any files associated with the "html" language service (i.e., ".html" and ".htm" files). If you'd like to use the HTMLHint extension with additional file types, you have two options:

Option 1: Treating your file like any other html file

Set g:coc_filetype_map in your .vimrc or init.vim file. :h g:coc_filetype_map

.vimrc/init.vim:

let g:coc_filetype_map = {
  \ 'htmldjango': 'html',
  \ 'blade': 'html',
  \ 'twig': 'html',
  \ 'jst': 'html',
  \ }

Option 2: Associating HTMLHint extension with other file type

For example, if you want HTMLHint to process .twig files, you would use "twig". Note that with this configuration, you need to open an html file first to activate the HTMLHint extension. Otherwise, you won't see any linter errors, (the extension is hard-coded to activate when the html language service activates).

coc-settings.json:

{
  "htmlhint.documentSelector": [
    "html",
    "twig"
  ]
}

Thanks

License

MIT


This extension is built with create-coc-extension

coc-htmlhint's People

Contributors

yaegassy avatar

Stargazers

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