From e567fe955678a2b01c0d7d72280ac2d5901b84e9 Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Mon, 27 Nov 2023 02:31:16 -0800 Subject: [PATCH] docs(tag-check): Add example and explain all options --- docs/user-guide/rules/tags-check.md | 58 ++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/rules/tags-check.md b/docs/user-guide/rules/tags-check.md index 8ca6ef827..da01c9a9a 100644 --- a/docs/user-guide/rules/tags-check.md +++ b/docs/user-guide/rules/tags-check.md @@ -3,7 +3,61 @@ id: tags-check title: tags-check --- -Allowing specify rules for any tag and validate that +Check if particular tags are self-closing or must include or exclude particular tags. + +Level: `error` + +## Config value + +1. true: enable rule +2. false: disable rule +3. {}: configuration object, mapping values of tags to their respective configuration. Tags configuration can have properties of: + +`selfclosing` + +If an element is or is not self-closing, when it otherwise should be. + +Level: `warn` + +`attrsRequired` + +If an element is missing an attribute that should exist. + +Level: `error` + +`redundantAttrs` + +If an element has an attribute that is not necessary. + +Level: `error` + +`attrsOptional` + +If an element has an attribute that is not included in the allowable set. + +Level: `error` + +### Example + +```json +{ + ... + "tags-check": { + "a": { + "selfclosing": true, + "attrsRequired": ["href", "title"], + "redundantAttrs": ["alt"], + } + }, + "script": { + "attrsOptional": [ + ["async", "async"], + ["defer", "defer"], + ], + }, + ... +} +``` The following pattern are **not** considered violations: @@ -15,7 +69,7 @@ The following pattern are **not** considered violations: asd ``` -The following pattern is considered violation: +The following pattern is considered a violation: ```html