Skip to main content

media-feature-name-allowed-list

Specify a list of allowed media feature names.

@media (min-width: 700px) {}
/** ↑
* This media feature name */

Use this rule to enforce a subset of media features as a convention. For example, allow only width, prefers-reduced-motion and prefers-color-scheme if those are the only features you test.

This rule supports 1 message argument: the disallowed media feature name.

Options​

Array<string>​

["array", "of", "media-features", "/regex/"]

Given:

{
"media-feature-name-allowed-list": ["max-width", "/^my-/"]
}

The following patterns are considered problems:

@media (min-width: 50em) {}
@media print and (min-resolution: 300dpi) {}
@media (min-width < 50em) {}
@media (10em < min-width < 50em) {}

The following patterns are not considered problems:

@media (max-width: 50em) {}
@media (my-width: 50em) {}
@media (max-width > 50em) {}
@media (10em < my-width < 50em) {}