我有一个Wordpress项目,Webpack和StyleLint插件正在使用。
问题是在编译sass时,它显示了这个错误,它说它不识别我在我的样式中使用的‘纵横比’属性:
Unexpected unknown property "aspect-ratio" property-no-unknown
我尝试将'ignoreProperties‘添加到.stylelintrc.js文件中的配置中,但是它没有工作,并且一直显示错误。
module.exports = {
'extends': 'stylelint-config-standard',
'rules': {
'no-empty-source': null,
'string-quotes': 'double',
'at-rule-no-unknown': [
true,
{
'ignoreProperties': [
'aspect-ratio'
]
},
{
'ignoreAtRules': [
'extend',
'at-root',
],
},
],
},
};我怎么才能修好它?(我对StyleLint不太了解,这个项目是由其他人发起的。)
发布于 2022-08-23 20:06:37
aspect-ratio是Stylelint最新版本中的一个已知属性。您应该使用以下方法将Stylelint的副本更新为最新版本:
npm install -D stylelint@latest或者,您可以使用ignoreProperties次要选项,但是您应该在property-no-unknown规则上使用它,而不是at-rule-no-unknown规则,因为它是一个属性,而不是at-规则:
module.exports = {
'extends': 'stylelint-config-standard',
'rules': {
'no-empty-source': null,
'string-quotes': 'double',
'at-rule-no-unknown': [
true,
{
'ignoreAtRules': [
'extend',
'at-root',
],
},
],
},
'property-no-unknown': [
true,
{
'ignoreProperties': [
'aspect-ratio'
]
},
]
};https://stackoverflow.com/questions/73451117
复制相似问题