Open
Description
Is your feature request related to a problem? Please describe.
Today's tools are characterized by a much better style of configuration file
It's much more extensible and supports things like defaultSeverity
and presets that load before its own configuration
Describe the solution you'd like
We will rewrite the configuration in eslint
-style, see #279 (comment)
TODOs
- rewrite rules (feat: new configuration structure #445 merged)update docu (docs: documentation for new configuration structure #447 merged)move rules into attribute
"rules": { /* ... */ }
(feat: move rules into dedicated attribute #476 merged)parse inline rules with options (extracted to Improve parsing of inline rules #503)add attribute"extends"
(feat: add config attribute extends #489 in review)- define value
"htmlhint:recommended"
add attribute"defaultSeverity"
(is this still needed? 🤔)
this could be done after release 1.0.0add attribute"exclude"
(extracted to Exclusible files via configuration #502)
this could be done after release 1.0.0
Old proposal
We should rewrite the configuration file into something like this:
{
"extends": ["htmlhint:recommended"],
"defaultSeverity": "error",
"htmlVersion": "html5",
"rules": {
"attr-no-duplication": true,
"attr-unsafe-chars": true,
"attr-value-double-quotes": true,
"doctype-first": false,
"doctype-html5": true,
"id-class-ad-disabled": true,
"id-class-value": ["dash", { "severity": "warning" }],
"id-unique": true,
"inline-style-disabled": false,
"space-tab-mixed-disabled": ["tab", { "severity": "warning" }],
"spec-char-escape": true,
"src-not-empty": true,
"style-disabled": [true, { "severity": "warning" }],
"tag-pair": true,
"tag-self-close": false,
"tagname-lowercase": [
true,
{
"exceptions": ["linearGradient"]
}
],
"title-require": true,
"stylelint": [
true,
{
"extends": "stylelint-config-standard",
"rules": {
"block-no-empty": null,
"color-no-invalid-hex": true
}
}
],
"eslint": [
true,
{
"configFile": "./.eslintrc.json"
}
]
},
"exclude": ["test/**/*.html"]
}
Activity
Shinigami92 commentedon Sep 2, 2018
We will rewrite the configuration structure in eslint-style
Rules
alt-require
The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.
attr-lowercase
All attribute names must be in lowercase.
htmlhint:recommended
attr-no-duplication
Elements cannot have duplicate attributes.
htmlhint:recommended
attr-unsafe-chars
Attribute values cannot contain unsafe chars.
attr-value-double-quotes
Attribute values must be in double quotes.
htmlhint:recommended
attr-value-not-empty
All attributes must have values.
csslint
Scan css with csslint.
doctype-first
Doctype must be declared first.
htmlhint:recommended
doctype-html5
Invalid doctype. Use: "<!DOCTYPE html>"
head-script-disabled
The <script> tag cannot be used in a <head> tag.
href-abs-or-rel
An href attribute must be either absolute or relative.
id-class-ad-disabled
The id and class attributes cannot use the ad keyword, it will be blocked by adblock software.
id-class-value
The id and class attribute values must meet the specified rules.
id-unique
The value of id attributes must be unique.
htmlhint:recommended
inline-script-disabled
Inline script cannot be used.
inline-style-disabled
Inline style cannot be used.
jshint
Scan script with jshint.
space-tab-mixed-disabled
Do not mix tabs and spaces for indentation.
spec-char-escape
Special characters must be escaped.
htmlhint:recommended
src-not-empty
The src attribute of an img(script,link) must have a value.
htmlhint:recommended
style-disabled
<style> tags cannot be used.
tag-pair
Tag must be paired.
htmlhint:recommended
tag-self-close
Empty tags must be self closed.
tagname-lowercase
All html element names must be in lowercase.
htmlhint:recommended
title-require
<title> must be present in <head> tag.
htmlhint:recommended
Type Definition
fix: Maintain img size regardless of its state via grid + svg was not…
tom-spalding commentedon May 2, 2020
This is such a good idea.
Shinigami92 commentedon May 16, 2020
We may later think about using cosmiconfig
thedaviddias commentedon May 16, 2020
@Shinigami92 seems a great idea.
19 remaining items