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

Allow for different configuration files #39

Closed jo-sm closed 7 years ago

jo-sm commented 7 years ago

I'm having trouble getting this plugin to work due to the config file location being specifically set in linter.py. I'm currently configuring my setup to use stylelint.config.js rather than .stylelintrc since I need to use JS object syntax rather than JSON. However, in linter.py, the config file is specifically set to .stylelintrc, which means it doesn't work for my setup. Ideally it would be nice to move to NodeLinter, since this is handled automatically, but I saw #19 which explained the reasoning for keeping the current plugin architecture, using stylelint_wrapper.js, but it's pretty inflexible and doesn't allow for the varied configuration files that the CLI allows for.

Can you update the stylelint_wrapper.js to not pass a specific config file and let it search relative to the CWD of the file being linted when using the CLI, or can you switch to NodeLinter?

chrishoage commented 7 years ago

Having to hardcode a path to a config file is huge bummer.

I think you're on to something with using linter.py to figure out the working directory and passing that to stylelint_wrapper.js

Or better yet just kill stylelint_wrapper.js

jo-sm commented 7 years ago

@chrishoage There is a reason they keep stylelint_wrapper.js, which is that stylelint used to not have a CLI before some version about 9-10 months ago and the newer versions change configuration, so moving to a newer version is not as simple as upgrading, it seems.

chrishoage commented 7 years ago

Yeah I saw that. Which is why killing it wasn't my first suggestion!

In a perfect world they would allow SublimeLinter-contrib-stylelint to have an excellent installation experience (which right now it is not) and release a SublimeLinter-contrib-stylelint2.0 or something that had the hacks in place for old stylelint.

Crippling the most common use case to support old versions is lame.

jo-sm commented 7 years ago

Yeah I agree -- although ideally it would be as simple as seeing if they have the CLI, and if they do, just use NodeLinter, otherwise, run the old wrapper. I may fork this and write my own version of this that also supports a running node process (Node startup on my computer is sloooooow...), see SublimeLinter-contrib-eslint_d for an example of what I'm talking about. Even for a simple file, on my computer, it can take around 1 second for the linting to complete...

jo-sm commented 7 years ago

@chrishoage see https://github.com/SublimeLinter/SublimeLinter3/issues/483. I made an issue for stylelint_d, which is long-running process for stylelint that I made for Sublime, which also accepts non .stylelintrc configs.

jo-sm commented 7 years ago

Closing because I made SublimeLinter-contrib-stylelint_d, which is waiting to be put in PackageControl, see https://github.com/SublimeLinter/SublimeLinter3/issues/483.