PageSourceSearch

https://stylelint.io/assets/js/2d1d5429.cbdd0f6c.js

js stylelint.io collected 2026-10-02 02:25:06 UTC 4,881 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkstylelint_io=self.webpackChunkstylelint_io||[]).push([["4683"],{6929:function(e,n,i){i.r(n),i.d(n,{metadata:function(){return a},default:function(){return o},frontMatter:function(){return r},contentTitle:function(){return l},toc:function(){return u},assets:function(){return d}});var a=JSON.parse('{"id":"user-guide/rules/media-feature-name-unit-allowed-list","title":"media-feature-name-unit-allowed-list","description":"Specify a list of allowed name and unit pairs within media features.","source":"@site/docs/user-guide/rules/media-feature-name-unit-allowed-list.md","sourceDirName":"user-guide/rules","slug":"/user-guide/rules/media-feature-name-unit-allowed-list","permalink":"/user-guide/rules/media-feature-name-unit-allowed-list","draft":false,"unlisted":false,"editUrl":"https://github.com/stylelint/stylelint/edit/main/lib/rules/media-feature-name-unit-allowed-list/README.md","tags":[],"version":"current","frontMatter":{"title":"media-feature-name-unit-allowed-list","sidebar_label":"media-feature-name-unit-allowed-list"},"sidebar":"docs","previous":{"title":"media-feature-name-no-vendor-prefix","permalink":"/user-guide/rules/media-feature-name-no-vendor-prefix"},"next":{"title":"media-feature-name-value-allowed-list","permalink":"/user-guide/rules/media-feature-name-value-allowed-list"}}'),s=i(4848),t=i(8453);let r={title:"media-feature-name-unit-allowed-list",sidebar_label:"media-feature-name-unit-allowed-list"},l="media-feature-name-unit-allowed-list",d={},u=[{value:"Options",id:"options",level:2},{value:"<code>Array&lt;string&gt;</code>",id:"arraystring",level:3}];function c(e){let n={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)(n.header,{children:(0,s.jsx)(n.h1,{id:"media-feature-name-unit-allowed-list",children:"media-feature-name-unit-allowed-list"})}),"\n",(0,s.jsx)(n.p,{children:"Specify a list of allowed name and unit pairs within media features."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (width: 50em) {}\n/**     \u2191         \u2191\n * This media feature name and these units */\n"})}),"\n",(0,s.jsxs)(n.p,{children:["This rule supports 2 ",(0,s.jsx)(n.a,{href:"/user-guide/configure#message",children:"message arguments"}),": the disallowed unit and the media feature name."]}),"\n",(0,s.jsx)(n.h2,{id:"options",children:"Options"}),"\n",(0,s.jsx)(n.h3,{id:"arraystring",children:(0,s.jsx)(n.code,{children:"Array<string>"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{ "media-feature-name": ["array", "of", "units"] }\n'})}),"\n",(0,s.jsxs)(n.p,{children:["You can specify a regex for a media feature name, such as ",(0,s.jsx)(n.code,{children:'{ "/height$/": [] }'}),"."]}),"\n",(0,s.jsx)(n.p,{children:"Given:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-json",children:'{\n  "media-feature-name-unit-allowed-list": {\n    "width": "em",\n    "/height/": ["em", "rem"]\n  }\n}\n'})}),"\n",(0,s.jsx)(n.p,{children:"The following patterns are considered problems:"}),"\n",(0,s.jsxs)("div",{class:"invalid-pattern",children:[(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (width: 50rem) {}\n"})}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (height: 1000px) {}\n"})}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (min-height: 1000px) {}\n"})}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (height <= 1000px) {}\n"})})]}),"\n",(0,s.jsxs)(n.p,{children:["The following patterns are ",(0,s.jsx)(n.em,{children:"not"})," considered problems:"]}),"\n",(0,s.jsxs)("div",{class:"valid-pattern",children:[(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (width: 50em) {}\n"})}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (width <= 50em) {}\n"})}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (height: 50em) {}\n"})}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-css",children:"@media (min-height: 50rem) {}\n"})})]})]})}function o(e={}){let{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},8453:function(e,n,i){i.d(n,{R:function(){return r},x:function(){return l}});var a=i(6540);let s={},t=a.createContext(s);function r(e){let n=a.useContext(t);return a.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),a.createElement(t.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.