Skip to content

Files

Latest commit

 

History

History
68 lines (48 loc) · 1.41 KB

media-feature-name-value-allowed-list.md

File metadata and controls

68 lines (48 loc) · 1.41 KB

Pattern: Use of non-allowed-listed media feature name/value pair

Issue: -

Description

This rule ignores media features within range and boolean context.

Examples

{
  "unprefixed-media-feature-name": ["array", "of", "values"],
  "/unprefixed-media-feature-name/": ["/regex/", "non-regex"]
}

If a media feature name is found in the object, only its whitelisted values are allowed. If the media feature name is not included in the object, anything goes.

If a name or value is surrounded with / (e.g. "/width$/"), it is interpreted as a regular expression. For example, /width$/ will match max-width and min-width.

Given:

{
  "min-width": ["768px", "1024px"],
  "/resolution/": ["/dpcm$/"]
}

The following pattern are considered violations:

@media screen and (min-width: 1000px) {}
@media screen and (min-resolution: 2dpi) {}

The following patterns are not considered violations:

@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) {}

Further Reading