Stylelint不会忽略”custom-property-pattern”规则。

huangapple go评论49阅读模式
英文:

Stylelint will not ignore "custom-property-pattern" rule

问题

I am trying to run stylelint --fix as part of a Husky hook with npx lint-staged.

However, it keeps failing because we are using snake case for our in-house css variables. There are also some kebab case variables in our scss from Bootstrap and the like.

npx lint-staged
✔ Preparing lint-staged...
✔ Hiding unstaged changes to partially staged files...
❯ Running tasks for staged files...
  ❯ package.json — 9 files
    ❯ *.{scss, css} — 2 files
      ✖ stylelint --fix [FAILED]
    ✔ *.{js,ts,json,html,scss,css} — 6 files
↓ Skipped because of errors from tasks. [SKIPPED]
↓ Skipped because of errors from tasks. [SKIPPED]
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ stylelint --fix:

client/src/sass/designsystem/primeng/_image.scss
 2:25  ✖  Expected custom property name "--border_color" to be kebab-case  custom-property-pattern

1 problem (1 error, 0 warnings)

So I don't want this to flag as an error or have stylelint try to "fix" css variables: I want to ignore them. So I added this to my .stylelintrc:

"custom-property-pattern": null,

But it still persists. What am I missing here? I just want to ignore the custom properties.

英文:

I am trying to run stylelint --fix as part of a Husky hook with npx lint-staged.

However, it keeps failing because we are using snake case for our in-house css variables. There are also some kebab case variables in our scss from Bootstrap and the like.

npx lint-staged
✔ Preparing lint-staged...
✔ Hiding unstaged changes to partially staged files...
❯ Running tasks for staged files...
  ❯ package.json — 9 files
    ❯ *.{scss, css} — 2 files
      ✖ stylelint --fix [FAILED]
    ✔ *.{js,ts,json,html,scss,css} — 6 files
↓ Skipped because of errors from tasks. [SKIPPED]
↓ Skipped because of errors from tasks. [SKIPPED]
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ stylelint --fix:

client/src/sass/designsystem/primeng/_image.scss
 2:25  ✖  Expected custom property name "--border_color" to be kebab-case  custom-property-pattern

1 problem (1 error, 0 warnings)

So I don't want this to flag as an error or have stylelint try to "fix" css variables: I want to ignore them. So I added this to my .stylelintrc:

    "custom-property-pattern": null,

But it still persists. What am I missing here? I just want to ignore the custom properties.

答案1

得分: 0

Add this to your .stylelintrc file:

"selector-class-pattern": null
英文:

Add this to your .stylelintrc file:

"selector-class-pattern": null

huangapple
  • 本文由 发表于 2023年4月17日 23:00:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76036544.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定