kungfusheep / SublimeLinter-contrib-stylelint

this repo is no longer maintained - please see https://github.com/SublimeLinter/SublimeLinter-stylelint
MIT License
116 stars 19 forks source link

Stylelint doesn't work on Sublime Text 3 #42

Closed wellyshen closed 6 years ago

wellyshen commented 7 years ago

Hi I use the stylelint 7.4.2, but it doesn't work and I receive the following error on the console log of Sublime Text 3 debug mode:

SublimeLinter: stylelint output: Error: No configuration provided for /var/folders/31/6tnw20657rb5znbqj567_9xm0000gn/T/SublimeLinter3-Welly/Home.scss at exports.default (/Users/Welly/Desktop/react-cool-starter/node_modules/stylelint/dist/utils/configurationError.js:8:13) at /Users/Welly/Desktop/react-cool-starter/node_modules/stylelint/dist/getConfigForFile.js:28:43

Here's my .stylelintrc:

{
  "extends": "stylelint-config-standard",
  "rules": {
    "string-quotes": "single",
    "selector-pseudo-class-no-unknown": [
      true,
      {
        "ignorePseudoClasses": [
          "global",
          "local"
        ]
      }
    ]
  }
}
msnow345 commented 7 years ago

Don't suppose you got any further with this? Getting the same error and can't seem to fix.

bbodien commented 7 years ago

Same here - I'm not sure if it's just not finding the .stylelintrc file or what.

msnow345 commented 7 years ago

Not a fix by any stretch but have added:

stylelint._options.configFile = '/Users/msnow345/Documents/Sites/Site-name/.stylelintrc' to line 25 of getConfigForFile.js in the stylelint module in my node_modules just to monkey patch it so it works for me for now until I can look at it further.

A quick check suggests the config is found by contrib-stylelint, but that it never finds it's way to the stylelint module as it is processed, all of the options it expects to receive are undefined. I'l take a proper look at it later tonight and hopefully sort an actual fix.

aziz commented 7 years ago

There's #41 pull request that does not have this issue and fixes more bugs but we're still waiting for it to be merged

wellyshen commented 7 years ago

@aziz Good job !

andreyjamer commented 7 years ago

I have the same problem. I suppose that the reason is the value of @ argument in command for linter. If turn on the debug mode the command to lint is:

['/usr/bin/node', 'HOME_DIRECTORY/.config/sublime-text-3/Packages/SublimeLinter-contrib-stylelint/stylelint_wrapper.js', '@', '--config', 'PROJECT_DIRECTORY/.stylelintrc']

HOME_DIRECTORY and PROJECT_DIRECTORY are paths When using stylelint v 7.1.0 the value of @ argument is relative to PROJECT_DIRECTORY, ex. ../../../../../tmp/SublimeLinter3-USER/test.css

But in stylelint v 7.4.2 the value of @ is absolute - /tmp/SublimeLinter3-USER/test.css

So there is no .stylelintrc in /tmp folder and linter is not able to process file.

esseb commented 7 years ago

@msnow345 thanks, the temporary workaround works for me!

WesSouza commented 7 years ago

@andreyjamer seems stylelint@7.5.0 fixed this 😃

Akurganow commented 7 years ago

For temporary fix add this to SublimeLinter.sublime-settings

{
  "user": {
    "linters": {
      "stylelint": {
        "@disable": false,
        "args": ["--config", "/Users/username/path/to/.stylelintrc"],
        "chdir": "${project}",
        "excludes": []
      }
    }
  }
}
andreyjamer commented 7 years ago

@WesleydeSouza Yes, bug is fixed.

hirschferkel commented 3 years ago

I still get this message on my OS X installation and do not know how to fix it?

SublimeLinter: WARNING: stylelint output:
Error: No configuration provided for ...