Skip to main content

media-feature-name-no-unknown

禁止未知的媒体功能名称。

¥Disallow unknown media feature names.

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

* This media feature name */

此规则认为 CSS 规范中定义的媒体功能名称(直至并包括编辑草稿)是已知的。

¥This rule considers media feature names defined in the CSS Specifications, up to and including Editor's Drafts, to be known.

此规则忽略浏览器前缀的媒体功能名称。

¥This rule ignores vendor-prefixed media feature names.

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of this rule.

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

@media screen and (unknown) {}
@media screen and (unknown: 10px) {}
@media screen and (unknown > 10px) {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

@media all and (monochrome) {}
@media (min-width: 700px) {}
@media (MIN-WIDTH: 700px) {}
@media (min-width: 700px) and (orientation: landscape) {}
@media (-webkit-min-device-pixel-ratio: 2) {}

可选的辅助选项

¥Optional secondary options

ignoreMediaFeatureNames: ["/regex/", /regex/, "string"]

鉴于:

¥Given:

["/^my-/", "custom"]

以下模式不被视为问题:

¥The following patterns are not considered problems:

@media screen and (my-media-feature-name) {}
@media screen and (custom: 10px) {}
@media screen and (100px < custom < 700px) {}
@media (min-width: 700px) and (custom: 10px) {}