I have a Wordpress project where Webpack and the StyleLint plugin are being used.
The problem is when compiling sass, it shows this error where it says it doesn't recognize the 'aspect-ratio' property that I'm using in my styles:
Unexpected unknown property "aspect-ratio" property-no-unknown
I tried adding 'ignoreProperties' to the config in the .stylelintrc.js file but it didn't work and it kept showing the error.
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',
],
},
],
},
};
How could I fix it? (I'm not very knowledgeable in StyleLint and this project was started by someone else.)
aspect-ratio
is a known property in the latest version of Stylelint. You should update your copy of Stylelint to the latest version using:
npm install -D stylelint@latest
Alternatively, you can use the ignoreProperties
secondary option, but you should use it on the property-no-unknown
rule rather than the at-rule-no-unknown
one as it's a property, not an at-rule:
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'
]
},
]
};