stylelint-scss / stylelint-config-recommended-scss

The recommended shareable SCSS config for Stylelint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable function-no-unknown rule

rchl opened this issue · comments

The function-no-unknown rule will complain about scss functions like math.div and other.

Would it make sense to explicitly disable it in this config to cater for cases when extending a config that enables it?

Also see ota-meshi/stylelint-config-recommended-vue#26

Makes sense for SCSS indeed.

Hi there,

stylelint-scss@4.2.0 now has the scss/function-no-unknown rule, so enabling the new rule seems to make sense:

{
  "rules": {
    "function-no-unknown": null,
    "scss/function-no-unknown": true
  }
}

It might seem like it does but it's one of those rules that will easily trigger in various projects and would need manual adjustments so IMO it's not something that should be enabled by default.

For example it triggers on this line:

font-family: remove-where($fonts, meta.get-function("contains-helvetica"));

in this repo because the custom remove-where function is not whitelisted.

Surely. @rchl's idea seems to make sense to me. 👍🏼

Yeah, let's not enable the SCSS version as it would just trigger errors for any custom functions that the users are using.

I think this doesn't work for negative values

margin-left: -#{$value}  /*  Unexpected unknown function "-"  scss/function-no-unknown */
margin-left: -#{math.div($value, 2)}  /* Unexpected unknown function "-#{math.div"  scss/function-no-unknown */

@amk221 could you please open a new Github issue about the bug? :)

Sure, is there a way I can write a failing test? I'm not familiar with the project and I couldn't find any