1"use strict";(self.webpackChunkstylelint_io=self.webpackChunkstylelint_io||[]).push([["6556"],{9409:function(e,r,n){n.r(r),n.d(r,{metadata:function(){return a},default:function(){return u},frontMatter:function(){return i},contentTitle:function(){return l},toc:function(){return c},assets:function(){return o}});var a=JSON.parse('{"id":"user-guide/rules/declaration-property-max-values","title":"declaration-property-max-values","description":"Limit the number of values for a list of properties within declarations.","source":"@site/docs/user-guide/rules/declaration-property-max-values.md","sourceDirName":"user-guide/rules","slug":"/user-guide/rules/declaration-property-max-values","permalink":"/user-guide/rules/declaration-property-max-values","draft":false,"unlisted":false,"editUrl":"https://github.com/stylelint/stylelint/edit/main/lib/rules/declaration-property-max-values/README.md","tags":[],"version":"current","frontMatter":{"title":"declaration-property-max-values","sidebar_label":"declaration-property-max-values"},"sidebar":"docs","previous":{"title":"declaration-no-important","permalink":"/user-guide/rules/declaration-no-important"},"next":{"title":"declaration-property-unit-allowed-list","permalink":"/user-guide/rules/declaration-property-unit-allowed-list"}}'),s=n(4848),t=n(8453);let i={title:"declaration-property-max-values",sidebar_label:"declaration-property-max-values"},l="declaration-property-max-values",o={},c=[{value:"Options",id:"options",level:2},{value:"<code>Object<string, number></code>",id:"objectstring-number",level:3}];function d(e){let r={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.header,{children:(0,s.jsx)(r.h1,{id:"declaration-property-max-values",children:"declaration-property-max-values"})}),"\n",(0,s.jsx)(r.p,{children:"Limit the number of values for a list of properties within declarations."}),"\n",(0,s.jsxs)(r.p,{children:["This rule supports 2 ",(0,s.jsx)(r.a,{href:"/user-guide/configure#message",children:"message arguments"}),": the property name and the configured maximum."]}),"\n",(0,s.jsx)(r.h2,{id:"options",children:"Options"}),"\n",(0,s.jsx)(r.h3,{id:"objectstring-number",children:(0,s.jsx)(r.code,{children:"Object<string, number>"})}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-json",children:'{ "property-name": 0 }\n'})}),"\n",(0,s.jsx)(r.p,{children:"Specify pairs of a property and a max value. In practice, you should specify any positive integers as max values."}),"\n",(0,s.jsxs)(r.p,{children:["You can specify a regex for a property name, such as ",(0,s.jsx)(r.code,{children:'{ "/^margin/": 0 }'}),"."]}),"\n",(0,s.jsx)(r.p,{children:"Given:"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-json",children:'{\n "declaration-property-max-values": {\n "border": 2,\n "/^margin/": 1,\n "/(-webkit-)?transform$/": 1\n }\n}\n'})}),"\n",(0,s.jsx)(r.p,{children:"The following patterns are considered problems:"}),"\n",(0,s.jsxs)("div",{class:"invalid-pattern",children:[(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-css",children:"a { border: 1px solid blue; }\n"})}),(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-css",children:"a { margin: 1px 2px; }\n"})}),(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-css",children:"a { margin-inline: 1px 2px; }\n"})}),(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-css",children:"a { -webkit-transform: scale(1) rotate(30deg); }\n"})})]}),"\n",(0,s.jsxs)(r.p,{children:["The following patterns are ",(0,s.jsx)(r.em,{children:"not"})," considered problems:"]}),"\n",(0,s.jsxs)("div",{class:"valid-pattern",children:[(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-css",children:"a { border: 1px solid; }\n"})}),(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-css",children:"a { margin: 1px; }\n"})}),(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-css",children:"a { margin-inline: 1px; }\n"})}),(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-css",children:"a { -webkit-transform: scale(1); }\n"})})]})]})}function u(e={}){let{wrapper:r}={...(0,t.R)(),...e.components};return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:function(e,r,n){n.d(r,{R:function(){return i},x:function(){return l}});var a=n(6540);let s={},t=a.createContext(s);function i(e){let r=a.useContext(t);return a.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function l(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),a.createElement(t.Provider,{value:r},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.