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

fix change code with ignoring comment #504

Open
mykola-shkut opened this issue Dec 7, 2020 · 2 comments
Open

fix change code with ignoring comment #504

mykola-shkut opened this issue Dec 7, 2020 · 2 comments

Comments

@mykola-shkut
Copy link

I have scss code

/* stylelint-disable */
/* prettier-ignore */
$spacers: (
    "0": 0,
    // "1px": 1px,
    "0d5": ($spacer * .125),//2px
    "1": ($spacer * .25), //4px
    "2": ($spacer * .5), //8px
    "3": $spacer, //16px
    "4": ($spacer * 1.5), //24px
    "5": ($spacer * 2), //32px
    "6": ($spacer * 2.5), //40px
    "7": ($spacer * 3.5), //56px
    "8": ($spacer * 4), //64px
    "9": ($spacer * 5), //80px
);
/* stylelint-enable */

config

module.exports = { extends: "stylelint-config-standard", plugins: ["stylelint-scss"], rules: { "at-rule-no-unknown": [ true, { ignoreAtRules: [ "include", "for", "each", "mixin", "if", "else", "content", "return", "warn", "error", "function" ] } ], indentation: 4, "scss/at-import-no-partial-leading-underscore": true, "no-descending-specificity": null, "scss/dollar-variable-no-missing-interpolation": true, "scss/media-feature-value-dollar-variable": "always", "scss/selector-no-redundant-nesting-selector": true, "at-rule-empty-line-before": [ "always", { ignoreAtRules: ["else"], ignore: ["blockless-after-same-name-blockless", "inside-block"] } ], "block-closing-brace-newline-after": ["always", { ignoreAtRules: ["if", "else"] }], "string-quotes": ["double", { avoidEscape: false }] } };

when I run just lint with
const data = await stylelint.lint({ config, files, formatter});
I dont receive any errors
but if I use
fix = true;
const data = await stylelint.lint({ config, files, formatter, fix });

my code become

/* stylelint-disable */

/* prettier-ignore */
$spacers: (
    "0": 0,
    
    "0d5": ($spacer * 0.125),
    "1": ($spacer * 0.25), 
    "2": ($spacer * 0.5), 
    "3": $spacer, 
    "4": ($spacer * 1.5), 
    "5": ($spacer * 2), 
    "6": ($spacer * 2.5), 
    "7": ($spacer * 3.5), 
    "8": ($spacer * 4), 
    "9": ($spacer * 5), 
);
/* stylelint-enable */
@kristerkari
Copy link
Collaborator

Thanks! I can have a look at why that happens.

@stof
Copy link
Contributor

stof commented Nov 23, 2021

This is an issue relying to the way autofixing works in stylelint itself. See stylelint/stylelint#2643 (comment) for the discussion about it (my link goes directly to the part discussing a potential solution for a new API, which has not been implemented yet)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants