Having scss-lint ignore a particular line

删除回忆录丶 提交于 2019-12-04 16:40:57

问题


How do you tell scss-lint to ignore a particular line in a .scss file?

i.e. can you do something like this:

.example {
  display: block !important;  // sass-lint: ignore
}

回答1:


Yep, see the docs on disabling linters via source

// scss-lint:disable ImportantRule
.example {
  display: block !important;
}
// scss-lint:enable ImportantRule



回答2:


Just adding to steveax's great answer:

If it's just for the one line, you can directly add the comment there and it will only affect that very line.

For instance, consider the following piece of code:

.example {
  display: block !important; // scss-lint:disable ImportantRule
  color: #BADA55 !important;
}

Your linter will issue a warning for the color line (not complying with ImportantRule) but correctly ignore your dirty work with the display property.


I usually feel it's much clearer to be as specific as possible about the scope of the rule-bending exceptions and always try not to widen these to an entire block of code -- unless it indeed makes sense.



来源:https://stackoverflow.com/questions/32833542/having-scss-lint-ignore-a-particular-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!