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

[Bug]: loading project config whet used 'Format document' or auto fix on save #431

Open
1 task done
walkadaw opened this issue Nov 25, 2022 · 2 comments
Open
1 task done
Labels
type: bug a problem with a feature or rule

Comments

@walkadaw
Copy link

walkadaw commented Nov 25, 2022

How did you encounter this bug?

Any project which use stylelint config
right click Format Document with style lint

Link to Minimal Reproducible Example

https://github.com/Tinkoff/taiga-ui

Code Snippet

No response

Stylelint Configuration

No response

Extension Configuration

{
  "css.validate": false,
  "scss.validate": false,
  "stylelint.enable": true,
  "stylelint.validate": ["css", "scss"],
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  },
}

Actual Behaviour

Not formatting with project config

Expected Behaviour

When press button in vscode Format Document or format on save file
Should fix file with project stylelint config.

const linterOptions = {
config: {
rules: formattingOptionsToRules(options),
},
};
this.#logger?.debug('Formatting document', { uri, linterOptions });
const fixes = this.#context.getFixes(document, linterOptions);

Sets the rules, and because the rules are defined, does not load the rules from the project config file.
https://github.com/stylelint/stylelint/blob/f226f54435c26ecb7dd8b2b69d63d79ee174b7af/lib/getConfigForFile.js#L29-L50

Logs

config : { rules: { indentation: [ 4 ] } }
C:\git\jb-design-system\build\variables.scss: When linting something other than CSS, you should install an appropriate syntax, e.g. "postcss-scss", and use the "customSyntax" option

Stylelint Version

v14.15.0

vscode-stylelint Version

v1.2.3

Node.js Version

v16.17.0

Operating System

Window 10

Windows Subsystem for Linux

No response

Code of Conduct

  • I agree to follow vscode-stylelint's Code of Conduct
@walkadaw walkadaw added the type: bug a problem with a feature or rule label Nov 25, 2022
@walkadaw walkadaw changed the title [Bug]: fix when format document run or auto fix when save [Bug]: loading project config whet used 'Format document' or auto fix on save Nov 25, 2022
@jrson83
Copy link

jrson83 commented May 15, 2023

I have the same issue.

@Yueyanc
Copy link

Yueyanc commented Dec 7, 2023

#485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a problem with a feature or rule
Projects
None yet
Development

No branches or pull requests

3 participants