简体   繁体   English

得到 scss 错误。 我该如何解决?

[英]getting scss errors. how can i solve it?

Having these kinds of errors while running the react app.运行 react 应用程序时出现此类错误。 在此处输入图像描述

package.json file:-> package.json 文件:->

"lint-staged": {
"linters": {
  "src/**/*.{js,jsx}": [
    "eslint --fix",
    "git add"
  ],
  "src/**/*.scss": [
    "stylelint --fix",
    "git add"
  ]
},
"ignore": [
  "**/dist/*.min.js"
]

} }

how can we avoid these errors?我们怎样才能避免这些错误? Do I need to do any changes?我需要做任何改变吗?

That's the expected behaviour.这是预期的行为。 Stylelint is flagging violations where your SCSS deviates from the rules defined in your configuration object. Stylelint 会标记 SCSS 偏离配置 object 中定义的规则的违规行为。

As these are mostly stylistic violations, stylelint can automatically fix the majority of them for you using:由于这些大多是风格违规,stylelint 可以使用以下方法自动为您修复其中的大部分:

npx stylelint "src/**/*.scss" --fix

The 'Unexpected unit "em" for property "padding"' violation is not stylistic.违反属性“填充”的“意外单位“em”不是风格。 You'll need to look at the options for the declaration-property-unit-whitelist rule in your configuration object to see what units are allowed for the padding property.您需要查看配置 object 中的声明属性单元白名单规则的选项,以查看填充属性允许使用哪些单位。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM