1"use strict";(globalThis.webpackChunk_linthtml_doc=globalThis.webpackChunk_linthtml_doc||[]).push([[9238],{1561(e,n,r){r.r(n),r.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"user-guide/rules/list/attr-name-style","title":"attr-name-style","description":"If set, HTML attributes names must conform to the given format.","source":"@site/docs/user-guide/rules/list/attr-name-style.md","sourceDirName":"user-guide/rules/list","slug":"/user-guide/rules/list/attr-name-style","permalink":"/user-guide/rules/list/attr-name-style","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"attr-name-ignore-regex","permalink":"/user-guide/rules/list/attr-name-ignore-regex"},"next":{"title":"attr-new-line","permalink":"/user-guide/rules/list/attr-new-line"}}');var s=r(2540),l=r(3023);const i={},a="attr-name-style",o={},d=[{value:"Options",id:"options",level:2},{value:"format",id:"format",level:3},{value:"ignore",id:"ignore",level:3}];function c(e){const n={code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,l.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"attr-name-style",children:"attr-name-style"})}),"\n",(0,s.jsx)(n.p,{children:"If set, HTML attributes names must conform to the given format."}),"\n",(0,s.jsx)(n.h2,{id:"options",children:"Options"}),"\n",(0,s.jsx)(n.p,{children:"The rule accept the following as rule options."}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["A validation regexp ",(0,s.jsx)(n.em,{children:(0,s.jsx)(n.strong,{children:"deprecated"})})]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'module.exports = {\n rules: {\n "attr-name-style": [true, /^[0-9a-o]+$/],\n },\n};\n'})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["A string value form the following list value [",(0,s.jsx)(n.code,{children:"camel"}),",",(0,s.jsx)(n.code,{children:"regexp"}),",",(0,s.jsx)(n.code,{children:"lowercase"}),",",(0,s.jsx)(n.code,{children:"dash"}),"] ",(0,s.jsx)(n.em,{children:(0,s.jsx)(n.strong,{children:"deprecated"})})]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n "rules": {\n "attr-name-style": [true, "dash"]\n }\n}\n'})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"An config object"}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'"attr-name-style": [true, {\n format: "camel" | "regexp" | "lowercase" | "dash" | RegExp;\n ignore?: string | RegExp\n}],\n'})}),"\n",(0,s.jsx)(n.h3,{id:"format",children:"format"}),"\n",(0,s.jsx)(n.p,{children:"Given the following config:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'module.exports = {\n rules: {\n "attr-name-style": [\n "error", \n {\n format: \'dash\',\n }\n ]\n },\n};\n'})}),"\n",(0,s.jsx)(n.p,{children:"The following patterns are considered violations:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-html",children:' <div attrName=""></div>\n'})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-html",children:' <div attr_name=""></div>\n'})}),"\n",(0,s.jsx)(n.p,{children:"The following patterns are not considered violations:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-html",children:' <div attr-name=""></div>\n'})}),"\n",(0,s.jsx)(n.h3,{id:"ignore",children:"ignore"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"module.exports = {\n rules: {\n \"attr-name-style\": [\n \"error\", \n {\n format: 'dash',\n ignore: 'xLink'\n }\n ]\n },\n};\n"})}),"\n",(0,s.jsx)(n.p,{children:"The following patterns are considered violations:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-html",children:' <div attrName=""></div>\n'})}),"\n",(0,s.jsx)(n.p,{children:"The following patterns are not considered violations:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-html",children:' <div xLink=""></div>\n'})})]})}function h(e={}){const{wrapper:n}={...(0,l.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},3023(e,n,r){r.d(n,{R:()=>i,x:()=>a});var t=r(3696);const s={},l=t.createContext(s);function i(e){const n=t.useContext(l);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),t.createElement(l.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.