media-feature-name-value-allowed-list
Specify a list of allowed media feature name and value pairs.
@media screen and (min-width: 768px) {}/** ↑ ↑ * These features and values */Use this rule to enforce a subset of values for a media feature as a convention. For example, allow only 48em and 64em for min-width, so that every query uses one of your breakpoints.
This rule supports 2 message arguments: the media feature name and the disallowed value.
Options
Section titled “Options”Object<string, Array<string>>
Section titled “Object<string, Array<string>>”{ "media-feature-name": ["array", "of", "values", "/regex/"] }You can specify a regex for a media feature name, such as { "/width$/": [] }.
If a media feature name is found in the object, only its allowed-listed values are allowed. If the media feature name is not included in the object, anything goes.
Given:
{ "media-feature-name-value-allowed-list": { "min-width": ["768px", "1024px"], "/resolution/": ["/dpcm$/"] }}The following patterns are considered problems:
@media screen and (min-width: 1000px) {}@media screen and (min-resolution: 2dpi) {}@media screen and (min-width > 1000px) {}The following patterns are not considered problems:
@media screen and (min-width: 768px) {}@media screen and (min-width: 1024px) {}@media screen and (orientation: portrait) {}@media screen and (min-resolution: 2dpcm) {}@media screen and (resolution: 10dpcm) {}@media screen and (768px < min-width) {}