bmatcuk/coc-stylelintplus

Autofix on safe and format does not work

nexusstar opened this issue · 6 comments

I have set in my cocConfig file

    "stylelintplus.autoFixOnSave": true,
    "stylelintplus.autoFixOnFormat": true,

But neither of them autofixes anything.
Can I debug this somehow?

Hi @nexusstar, sorry for the slow reply. I just tested locally and both options seem to be working for me. If you run :CocInfo, do you see that stylelintplus has started? Are there any errors?

I have the same problem, but do encounter an error while trying to save:

2021-01-14T09:48:54.258 ERROR (pid:60698) [language-client-client] - _h [Error]: Request textDocument/willSaveWaitUntil failed with message: No configuration provided for /Users/xxxx/Documents/projecten/brightbook/app/javascript/styles/tailwind.pcss
    at Ey (/Users/xxxx/.vim/plugged/coc.nvim/build/index.js:22:224)
    at In (/Users/xxxx/.vim/plugged/coc.nvim/build/index.js:21:12525)
    at Immediate.<anonymous> (/Users/xxxx/.vim/plugged/coc.nvim/build/index.js:21:12376)
    at processImmediate (internal/timers.js:456:21) {
  code: -32603,
  data: undefined
}

Hi @caifara - that error is coming from stylelint itself. Sounds like you either haven't created a configuration file, or stylelint can't find it. See this issue: stylelint/stylelint#3625

Seems like I have the same issue. If I run CocCommand stylelintplus.applyAutoFixes it works but not if I save or format.

Oh, I just found out why. Looks I had to remove scss from this array: "coc.preferences.formatOnSaveFiletypes". Might be a good README item 🤔

Oh, interesting... do you have coc-css installed? If so, do you have "scss.validate": false in your coc-settings.json?

Assuming you mean me, I do. I also have the following which are related to styles or formatting, in case it helps:

  "css.validate": false,
  "less.validate": false,
  "scss.validate": false,
  "wxss.validate": false,
  "stylelintplus.filetypes": [
    "scss"
  ],
  "stylelintplus.autoFixOnSave": true,
  "cssmodules.camelCase": true,
  "cssmodules.hintName": "cssmodule",
  "eslint.autoFixOnSave": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],
  "eslint.probe": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],
  "coc.preferences.formatOnSaveFiletypes": [
    "json",
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vimwiki",
    "markdown",
    "sass"
  ],
  "prettier.requireConfig": true,
  "prettier.onlyUseLocalVersion": true,