-
-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite configuration structure #279
Rewrite configuration structure #279
Comments
We will rewrite the configuration structure in eslint-style{
"extends": ["htmlhint:recommended"],
"defaultSeverity": "error",
"htmlVersion": "html5",
"rules": {},
"exclude": ["test/**/*.html"]
} Rulesalt-requireThe alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value. { "alt-require": "off" }
{ "alt-require": "error" }
{ "alt-require": "warn" }
{ "alt-require": ["off"] }
{ "alt-require": ["error"] }
{ "alt-require": ["warn"] } attr-lowercaseAll attribute names must be in lowercase. { "attr-lowercase": "off" }
{ "attr-lowercase": "error" }
{ "attr-lowercase": "warn" }
{ "attr-lowercase": ["off"] }
{ "attr-lowercase": ["error", { "exceptions": ["viewBox"] }] }
{ "attr-lowercase": ["warn", { "exceptions": ["viewBox"] }] } htmlhint:recommended attr-no-duplicationElements cannot have duplicate attributes. { "attr-no-duplication": "off" }
{ "attr-no-duplication": "error" }
{ "attr-no-duplication": "warn" }
{ "attr-no-duplication": ["off"] }
{ "attr-no-duplication": ["error"] }
{ "attr-no-duplication": ["warn"] } htmlhint:recommended attr-unsafe-charsAttribute values cannot contain unsafe chars. { "attr-unsafe-chars": "off" }
{ "attr-unsafe-chars": "error" }
{ "attr-unsafe-chars": "warn" }
{ "attr-unsafe-chars": ["off"] }
{ "attr-unsafe-chars": ["error"] }
{ "attr-unsafe-chars": ["warn"] } attr-value-double-quotesAttribute values must be in double quotes. { "attr-value-double-quotes": "off" }
{ "attr-value-double-quotes": "error" }
{ "attr-value-double-quotes": "warn" }
{ "attr-value-double-quotes": ["off"] }
{ "attr-value-double-quotes": ["error"] }
{ "attr-value-double-quotes": ["warn"] } htmlhint:recommended
attr-value-not-emptyAll attributes must have values. { "attr-value-not-empty": "off" }
{ "attr-value-not-empty": "error" }
{ "attr-value-not-empty": "warn" }
{ "attr-value-not-empty": ["off"] }
{ "attr-value-not-empty": ["error"] }
{ "attr-value-not-empty": ["warn"] } csslintScan css with csslint. // check for .csslintrc
{ "csslint": "off" }
{ "csslint": "error" }
{ "csslint": "warn" }
{ "csslint": ["off"] }
// pass csslint config
{ "csslint": ["error", { "vendor-prefix": true }] }
{ "csslint": ["warn", { "vendor-prefix": true }] }
doctype-firstDoctype must be declared first. { "doctype-first": "off" }
{ "doctype-first": "error" }
{ "doctype-first": "warn" }
{ "doctype-first": ["off"] }
{ "doctype-first": ["error"] }
{ "doctype-first": ["warn"] } htmlhint:recommended
doctype-html5Invalid doctype. Use: "<!DOCTYPE html>" { "doctype-html5": "off" }
{ "doctype-html5": "error" }
{ "doctype-html5": "warn" }
{ "doctype-html5": ["off"] }
{ "doctype-html5": ["error"] }
{ "doctype-html5": ["warn"] }
head-script-disabledThe <script> tag cannot be used in a <head> tag. { "head-script-disabled": "off" }
{ "head-script-disabled": "error" }
{ "head-script-disabled": "warn" }
{ "head-script-disabled": ["off"] }
{ "head-script-disabled": ["error"] }
{ "head-script-disabled": ["warn"] } href-abs-or-relAn href attribute must be either absolute or relative. { "href-abs-or-rel": "off" }
{ "href-abs-or-rel": ["off"] }
{ "href-abs-or-rel": ["error", { "mode": "absolute" }] }
{ "href-abs-or-rel": ["warn", { "mode": "relative" }] }
id-class-ad-disabledThe id and class attributes cannot use the ad keyword, it will be blocked by adblock software. { "id-class-ad-disabled": "off" }
{ "id-class-ad-disabled": "error" }
{ "id-class-ad-disabled": "warn" }
{ "id-class-ad-disabled": ["off"] }
{ "id-class-ad-disabled": ["error"] }
{ "id-class-ad-disabled": ["warn"] } id-class-valueThe id and class attribute values must meet the specified rules. { "id-class-value": "off" }
{ "id-class-value": ["off"] }
{ "id-class-value": ["error", { "mode": "underline" }] }
{ "id-class-value": ["warn", { "mode": "dash" }] }
{ "id-class-value": ["warn", { "mode": "hump" }] }
id-uniqueThe value of id attributes must be unique. { "id-unique": "off" }
{ "id-unique": "error" }
{ "id-unique": "warn" }
{ "id-unique": ["off"] }
{ "id-unique": ["error"] }
{ "id-unique": ["warn"] } htmlhint:recommended inline-script-disabledInline script cannot be used. { "inline-script-disabled": "off" }
{ "inline-script-disabled": "error" }
{ "inline-script-disabled": "warn" }
{ "inline-script-disabled": ["off"] }
{ "inline-script-disabled": ["error"] }
{ "inline-script-disabled": ["warn"] } inline-style-disabledInline style cannot be used. { "inline-style-disabled": "off" }
{ "inline-style-disabled": "error" }
{ "inline-style-disabled": "warn" }
{ "inline-style-disabled": ["off"] }
{ "inline-style-disabled": ["error"] }
{ "inline-style-disabled": ["warn"] } jshintScan script with jshint. // check for .jshintrc
{ "jshint": "off" }
{ "jshint": "error" }
{ "jshint": "warn" }
{ "jshint": ["off"] }
// pass jshint config
{ "jshint": ["error", { "curly": true }] }
{ "jshint": ["warn", { "curly": true }] }
space-tab-mixed-disabledDo not mix tabs and spaces for indentation. { "space-tab-mixed-disabled": "off" }
{ "space-tab-mixed-disabled": ["off"] }
{ "space-tab-mixed-disabled": ["error", { "mode": "tab" }] }
{ "space-tab-mixed-disabled": ["warn", { "mode": "space" }] }
{ "space-tab-mixed-disabled": ["warn", { "mode": "space4" }] }
spec-char-escapeSpecial characters must be escaped. { "spec-char-escape": "off" }
{ "spec-char-escape": "error" }
{ "spec-char-escape": "warn" }
{ "spec-char-escape": ["off"] }
{ "spec-char-escape": ["error"] }
{ "spec-char-escape": ["warn"] } htmlhint:recommended src-not-emptyThe src attribute of an img(script,link) must have a value. { "src-not-empty": "off" }
{ "src-not-empty": "error" }
{ "src-not-empty": "warn" }
{ "src-not-empty": ["off"] }
{ "src-not-empty": ["error"] }
{ "src-not-empty": ["warn"] } htmlhint:recommended style-disabled<style> tags cannot be used. { "style-disabled": "off" }
{ "style-disabled": "error" }
{ "style-disabled": "warn" }
{ "style-disabled": ["off"] }
{ "style-disabled": ["error"] }
{ "style-disabled": ["warn"] } tag-pairTag must be paired. { "tag-pair": "off" }
{ "tag-pair": "error" }
{ "tag-pair": "warn" }
{ "tag-pair": ["off"] }
{ "tag-pair": ["error"] }
{ "tag-pair": ["warn"] } htmlhint:recommended tag-self-closeEmpty tags must be self closed. { "tag-self-close": "off" }
{ "tag-self-close": "error" }
{ "tag-self-close": "warn" }
{ "tag-self-close": ["off"] }
{ "tag-self-close": ["error"] }
{ "tag-self-close": ["warn"] } tagname-lowercaseAll html element names must be in lowercase. { "tagname-lowercase": "off" }
{ "tagname-lowercase": "error" }
{ "tagname-lowercase": "warn" }
{ "tagname-lowercase": ["off"] }
{ "tagname-lowercase": ["error"] }
{ "tagname-lowercase": ["warn"] } htmlhint:recommended title-require<title> must be present in <head> tag. { "title-require": "off" }
{ "title-require": "error" }
{ "title-require": "warn" }
{ "title-require": ["off"] }
{ "title-require": ["error"] }
{ "title-require": ["warn"] } htmlhint:recommended Type Definitionexport type RuleSeverity = 'off' | 'error' | 'warn';
export type RuleConfig = RuleSeverity | [RuleSeverity, { [key: string]: any } | undefined]; |
… working bc of lowercase b in viewbox This was in part due to HTML linter. It only has error level severity, eslint style warn severity support is in the works, see: htmlhint/HTMLHint#279 (comment) The other part was XML vs HTML fragment, latter's attributes are always set as lowercase! Which broke the SVG! Reference for fix is found in inline comment in code.
This is such a good idea. |
We may later think about using cosmiconfig |
@Shinigami92 seems a great idea. |
All unresolved tasks have been extracted into their own issues |
It looks like #489 is marked as completed here, but it didn't merge and there isn't another open issue about it. |
What with merge configuration (#489), still unavailable? |
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 configurationDescribe the solution you'd like
We will rewrite the configuration in
eslint
-style, see #279 (comment)TODOs
"rules": { /* ... */ }
(feat: move rules into dedicated attribute #476 merged)"extends"
(feat: add config attribute extends #489 in review)"htmlhint:recommended"
"defaultSeverity"
(is this still needed? 🤔)this could be done after release 1.0.0
"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:
The text was updated successfully, but these errors were encountered: