0.5.0 • Published 3 years ago

htmlhint-riot-rules v0.5.0

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

htmlhint-riot-rules

npm version Build Status Coverage Status GitHub license npm

HTMLHint custom rules for Riot.js

Install

npm install htmlhint-riot-rules

Useage

with htmlhint-loader

// webpack.config.js

var htmlhintRiotRules = require('htmlhint-riot-rules')

module.exports = {
  module: {
    rules: [{
      enforce: 'pre',
      test: /\.tag\.html/,
      loader: 'htmlhint-loader',
      exclude: /node_modules/,
      options: {
        customRules: htmlhintRiotRules(),
        'file-line-limit': true, // Change the limit by set numeric. 'true' meaning default size 100. 
        'tag-name-include-hyphen': true,
        'use-script-inside-tag': true,
        'tag-expressions-simple': true, // Change the limit by set numeric. 'true' meaning default size 10. 
        'tag-options-primitive': true,
        'assign-this-to-tag': true,
        'properties-and-methods-order': true,
        'fake-es6-syntax-disabled': true,
        'tag-parent-disabled': true,
        'use-each-in-syntax': true
      }
    }]
  }
}

with gulp-htmlhint

// gulp.config.js

var gulp = require('gulp');
var htmlhint = require("gulp-htmlhint");
var htmlhintRiotRules = require('htmlhint-riot-rules')

gulp.src("./src/*.tag.html")
  .pipe(htmlhint('.htmlhintrc', htmlhintRiotRules()))

CLI

.htmlhintrc

{
  "file-line-limit": true,
  "tag-name-include-hyphen": true,
  "use-script-inside-tag": true,
  "tag-expressions-simple": true,
  "tag-options-primitive": true,
  "assign-this-to-tag": true,
  "properties-and-methods-order": true,
  "fake-es6-syntax-disabled": true,
  "tag-parent-disabled": true,
  "use-each-in-syntax": true
}
htmlhint --config .htmlhintrc --rulesdir ./node_modules/htmlhint-riot-rules/add_rules **/*.tag.html 

Rules

IDDescriptionLevel
file-line-limitModule based developmentwarn
tag-name-include-hyphenTag module nameserror
use-script-inside-tagUse <script> inside tagerror
tag-expressions-simpleKeep tag expressions simplewarn
tag-options-primitiveKeep tag options primitivewarn
assign-this-to-tagAssign this to tagwarn
properties-and-methods-orderPut tag properties and methods on topwarn
fake-es6-syntax-disabledAvoid fake ES6 syntaxwarn
tag-parent-disabledAvoid tag.parentwarn
use-each-in-syntaxUse each ... in syntaxwarn

Options

You can specify rules to disable with JSON arguments. By default all rules are turned on and it is up to you to disable them.

var htmlhintRiotRules = require('htmlhint-riot-rules')

var customRules = htmlhintRiotRules({
  'avoid-tag-parent': false
})
0.5.0

3 years ago

0.4.0

5 years ago

0.3.14

5 years ago

0.3.13

5 years ago

0.3.12

5 years ago

0.3.11

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago