media-query-no-invalid
Disallow invalid media queries.
@media not(min-width: 300px) {}/** ↑ * This media query */Use this rule to avoid @media blocks that never apply. An invalid query is replaced by not all.
It works well with other rules that check feature names and values:
This rule supports 2 message arguments: the media query and the reason it is invalid.
Options
Section titled “Options”{ "media-query-no-invalid": true}The following patterns are considered problems:
@media not(min-width: 300px) {}@media (width == 100px) {}@media (color) and (hover) or (width) {}The following patterns are not considered problems:
@media not (min-width: 300px) {}@media (width = 100px) {}@media ((color) and (hover)) or (width) {}@media (color) and ((hover) or (width)) {}Optional secondary options
Section titled “Optional secondary options”ignoreFunctions
Section titled “ignoreFunctions”{ "ignoreFunctions": ["array", "of", "functions", "/regex/"] }Ignore the specified functions.
Given:
{ "media-query-no-invalid": [ true, { "ignoreFunctions": ["theme", "/^get.*$/"] } ]}The following patterns are not considered problems:
@media (min-width: theme(screens.md)) {}@media (max-width: get-default-width()) {}