【问题标题】:CSS lint throwing errorsCSS lint 抛出错误
【发布时间】:2017-07-19 17:03:57
【问题描述】:

我正在运行 lint 并收到以下错误。

Unexpected vendor-prefix "-webkit-animation" 

Unexpected named color "white" 

这是我遇到错误的 css 类

.well-classname--progress {
  -webkit-animation: loadbar 1s linear forwards;
  animation: loadbar 1s linear forwards;
  opacity: 0;
  transform: translateX(-100%) translate3d(0, 0, 0);
  // margin-right: 1px;
}

.well-classname--progress:not(:last-child) {
  border-right: 1px solid white;
}

知道为什么我会收到这些 lint 错误吗?

【问题讨论】:

  • Lint 有助于保持一些编码风格。这不是代码错误。只是在设置里是禁止的。
  • 我明白了。但是我该如何解决它们。如果不修复它们,我就无法前进:(
  • 禁用它。如果您使用的是 JetBrains 的一些 IDE,请转到设置并找到 Lint 它会显示结果,您可以在其中禁用您想要的或更改规则。

标签: css stylelint


【解决方案1】:

意外的供应商前缀“-webkit-animation”

这是value-no-vendor-prefix stylelint 规则。

您可以使用autoprefixer 避免包含供应商前缀属性。

或者只是禁用此规则。

意外的命名颜色“白色”

这是 color-named 规则设置为“从不”。

您可以将其设置为“always-where-possible”,如果您想始终使用命名颜色,请将white 替换为#fff(首选)。

【讨论】:

  • 谢谢。我实际上最终会做同样的事情。仍会将您的答案标记为答案:)
猜你喜欢
  • 1970-01-01
  • 2017-11-15
  • 2020-06-07
  • 2016-08-02
  • 1970-01-01
  • 2015-07-21
  • 1970-01-01
  • 1970-01-01
  • 2021-09-08
相关资源
最近更新 更多