htmlhint-riot-rules
v0.5.0
Published
HTMLHint custom rules for Riot.js
Downloads
124
Readme
htmlhint-riot-rules
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
|ID|Description|Level|
|--|-----------|-----|
|file-line-limit|Module based development|warn|
|tag-name-include-hyphen|Tag module names|error|
|use-script-inside-tag|Use <script> inside tag|error|
|tag-expressions-simple|Keep tag expressions simple|warn|
|tag-options-primitive|Keep tag options primitive|warn|
|assign-this-to-tag|Assign this to tag|warn|
|properties-and-methods-order|Put tag properties and methods on top|warn|
|fake-es6-syntax-disabled|Avoid fake ES6 syntax|warn|
|tag-parent-disabled|Avoid tag.parent
|warn|
|use-each-in-syntax|Use each ... in
syntax|warn|
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
})