我看了stylelint的文档,只看到了一种禁用stylelint的方法,以针对特定文件/目录运行,但是我真正想要的是一种针对特定文件/目录的禁用特定规则的方法。有办法实现吗?我不想stylelint-disable
在文件中使用。
将来,您将可以使用overrides
configuration属性。同时,您可以通过使用extend
配置属性并两次运行stylelint来解决此缺少的功能。
创建第二个配置,以扩展受限制的主配置并启用其他规则:
.extended-stylelintrc.json
:
{
extends: "./.stylelintrc.json",
rules: {
"unit-whitelist": ["px"]
}
};
或者,您可以创建第二个配置,以扩展完整的主配置并关闭规则:
.limited-stylelintrc.json
:
{
extends: "./.stylelintrc.json",
rules: {
"property-no-unknown": null
}
};
但是,它将需要两个npm任务来运行它:
stylelint "**/*.css"
stylelint "special/**/*.css" --config .extended-stylelintrc.js
或者可以将其合并为一个:
stylelint "**/*.css" && stylelint "special/**/*.css" --config .extended-stylelintrc.js
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句