Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function-no-unknown reported in SCSS #26

Closed
rchl opened this issue Feb 17, 2022 · 3 comments · Fixed by #29
Closed

function-no-unknown reported in SCSS #26

rchl opened this issue Feb 17, 2022 · 3 comments · Fixed by #29

Comments

@rchl
Copy link

rchl commented Feb 17, 2022

After updating to latest version, I've noticed that the SCSS blocks like:

<style lang="scss" scoped>
@use 'sass:math';

.foo {
    .bar {
        color: #bbb;
        padding-right: math.div(4, 2)
    }
}
</style>

now report an function-no-unknown error for math.div.

Probably because of this added code:

...(semver.gte(stylelintVersion, "14.5.0")
? {
"function-no-unknown": [true, { ignoreFunctions: ["v-bind"] }],
}

My config looks like this (+ some extra custom rules):

    extends: [
        'stylelint-config-standard',
        'stylelint-config-recommended-scss',
        'stylelint-config-recommended-vue/scss',
    ],
@ota-meshi
Copy link
Owner

Thank you for posting this issue!

Hmmm... In the first place, I think that using stylelint-config-standard (stylelint-config-recommended) will report math.div.
https://github.com/stylelint/stylelint-config-recommended/blob/0a507c3bb0371725f83470fe52c87619b1e04dde/index.js#L22
stylelint-config-recommended-vue overrides this and allows v-bind.

It looks like stylelint-config-recommended-scss hasn't been modified to allow math.div.
https://github.com/stylelint-scss/stylelint-config-recommended-scss/blob/master/index.js

Maybe you need to open an issue in stylelint-config-recommended-scss as well.
This package should follow the changes in stylelint-config-recommended-scss.

@rchl
Copy link
Author

rchl commented Feb 17, 2022

Yeah, sounds reasonable that stylelint-config-recommended-scss should override that.
I would think that it should just disable function-no-unknown though, because whitelisting all functions that scss supports would probably not be very practical.

@ota-meshi
Copy link
Owner

If stylelint-config-recommended-scss turns it off, I think stylelint-config-recommended-vue/scss should follow it 👍

arm-band added a commit to arm-band/kiribi_ususama that referenced this issue Jul 16, 2022
- stylelint のエラーを修正
    - `math.div` が `function-no-unknown` となってしまう → `math.(.+)` を無視するようにルールを追加
        - 参考: [`function-no-unknown` reported in SCSS · Issue \#26 · ota-meshi\/stylelint-config-recommended-vue · GitHub](ota-meshi/stylelint-config-recommended-vue#26)
    - コメントの前に空行を追加
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants