PageSourceSearch

https://stylelint.io/assets/js/09db164a.13cfc802.js

js stylelint.io collected 2026-10-02 02:26:26 UTC 3,692 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkstylelint_io=self.webpackChunkstylelint_io||[]).push([["7369"],{9497:function(e,t,r){r.r(t),r.d(t,{metadata:function(){return n},default:function(){return a},frontMatter:function(){return i},contentTitle:function(){return c},toc:function(){return u},assets:function(){return p}});var n=JSON.parse('{"id":"user-guide/rules/custom-property-pattern","title":"custom-property-pattern","description":"Specify a pattern for custom properties.","source":"@site/docs/user-guide/rules/custom-property-pattern.md","sourceDirName":"user-guide/rules","slug":"/user-guide/rules/custom-property-pattern","permalink":"/user-guide/rules/custom-property-pattern","draft":false,"unlisted":false,"editUrl":"https://github.com/stylelint/stylelint/edit/main/lib/rules/custom-property-pattern/README.md","tags":[],"version":"current","frontMatter":{"title":"custom-property-pattern","sidebar_label":"custom-property-pattern"},"sidebar":"docs","previous":{"title":"custom-property-no-missing-var-function","permalink":"/user-guide/rules/custom-property-no-missing-var-function"},"next":{"title":"declaration-block-no-duplicate-custom-properties","permalink":"/user-guide/rules/declaration-block-no-duplicate-custom-properties"}}'),s=r(4848),o=r(8453);let i={title:"custom-property-pattern",sidebar_label:"custom-property-pattern"},c="custom-property-pattern",p={},u=[{value:"Options",id:"options",level:2},{value:"<code>string</code>",id:"string",level:3}];function l(e){let t={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.header,{children:(0,s.jsx)(t.h1,{id:"custom-property-pattern",children:"custom-property-pattern"})}),"\n",(0,s.jsx)(t.p,{children:"Specify a pattern for custom properties."}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-css",children:"a { --foo-: 1px; }\n/**   \u2191\n * The pattern of this */\n"})}),"\n",(0,s.jsxs)(t.p,{children:["This rule supports 2 ",(0,s.jsx)(t.a,{href:"/user-guide/configure#message",children:"message arguments"}),": the custom property name and the configured pattern."]}),"\n",(0,s.jsx)(t.h2,{id:"options",children:"Options"}),"\n",(0,s.jsx)(t.h3,{id:"string",children:(0,s.jsx)(t.code,{children:"string"})}),"\n",(0,s.jsxs)(t.p,{children:["Specify a regex string not surrounded with ",(0,s.jsx)(t.code,{children:'"/"'}),"."]}),"\n",(0,s.jsx)(t.p,{children:"Given:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-json",children:'{\n  "custom-property-pattern": "foo-.+"\n}\n'})}),"\n",(0,s.jsx)(t.p,{children:"The following patterns are considered problems:"}),"\n",(0,s.jsx)("div",{class:"invalid-pattern",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-css",children:":root { --boo-bar: 0; }\n"})})}),"\n",(0,s.jsxs)(t.p,{children:["The following patterns are ",(0,s.jsx)(t.em,{children:"not"})," considered problems:"]}),"\n",(0,s.jsx)("div",{class:"valid-pattern",children:(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-css",children:":root { --foo-bar: 0; }\n"})})})]})}function a(e={}){let{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:function(e,t,r){r.d(t,{R:function(){return i},x:function(){return c}});var n=r(6540);let s={},o=n.createContext(s);function i(e){let t=n.useContext(o);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),n.createElement(o.Provider,{value:t},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.