gitstylelinthuskylint-staged

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.


Solution

  • Add this to your .stylelintrc file:

    "selector-class-pattern": null