SimenB / stylint

Improve your Stylus code with Stylint
https://simenb.github.io/stylint/
GNU General Public License v2.0
348 stars 62 forks source link

Trouble specifying the emplacement of a stylintrc config file #387

Open Gwenouille opened 7 years ago

Gwenouille commented 7 years ago

Hi there !

My name is Gwen Le Page. I am quite new to the world of coding, and I was playing with Stylus lately, to get a feeling of different pre-processos for CSS. I use Atom and have the Linter-Stylint installed.

Now, the linter works fine with the default config file, but I wanted to configure it a little bit, for example making colons mandatory. I want that setting to be available in all my projects, not having to bundle the .stylintrc file within the project folder every time.

So I added a "stylintrc" entry at the bottom of the package.json file, looking like that:

"stylintrc": ".stylintrc",

This doesn't work as such, but only if I place the .stylintrc file directly at my /users root folder (I am on win 10). But I would like it not to be so high in the hierarchy, preferably somewhere in the linter-stylint package…

I have tried things like: "stylintrc": "/.atom/packages/linter-stylint/.stylintrc", or "stylintrc": "c:\\Users\\Gwenael\\.atom\\packages\\linter-stylint\\.stylintrc", but to no avail… Atom keeps beeping that it can't find any stylintrc (I've checked the "Run stylint only if config is found" box)

I've had a look at the utils_setConfig.js.html and I thought that the script would work recursively to find a .stylintrc, starting at the package.json level, but that didn't help me. The only place where it can use my stylintrc file is the user root folder.

Maybe you can ?

SimenB commented 7 years ago

You should be able to specify this in the linter plugin's config:

image

Btw, @Arcanemagus why does the default path to the executable cut off?

Gwenouille commented 7 years ago

The default path to the executable is alright here, not cut-off…

About your suggestion: but it is meant to be a relative path isn't it ? Meaning that if I choose to create a project a step higher or lower in the hierarchy, I'll have to change it. I'd prefer a full path this time. But perhaps I am doing it the wrong way altogether !

I thought it would be more convenient to have this just like in the 3rd point of this link: https://www.npmjs.com/package/stylint#custom-configuration

Alas, as I mentioned in the first post, I just couldn't point to .stylintrc successfully, although I added a "stylintrc": ".stylintrc", in the package.json in the linter-stylint folder under .atom/packages/

Isn't that what is meant with this 3rd point ? Isn't that where I am supposed to point to the .stylintrc ?

Gwenouille commented 7 years ago

Hi there !

So, I finally changed my approach and decided to ship the .stylintrc file of my choice within the projects i am on. That puts an end to the struggling with this file.

In the meantime, I set up a small sort of pipeline using gulp in conjunction with several other tools like stylus, browser-sync,etc. The trouble is, everything collapses when stylus' pre-processing encounters a faultly indented file. I have to restart my gulp pipeline, which is not a big deal, but quite frustrating. I would have thought i was more robust and would have thrown a warning without bringing the whole thing down. •Do you know how to make Stylus more robust and throw a warning, while maintaining the pipeline alive ? It could for example just create a comment in the unchanged resulting css couldn't it ?

Another point now: in my atom.io, stylint doesn't refresh automatically like for instance styl_e_lint does. So the possible errors only appear on save, at the same time as the collapse…too late. •Is it possible to have stylint work as linter-htmlhint or linter-stylelint and automatically adapt to the changes ? Should be the case shouldn't it ? I mean it does work with the other linter modules (I have linter 1.11.18)

SimenB commented 7 years ago

Sorry, forgot about this.

I can't really help you with stylus itself, but it seems like a bad bug if it crashes... Although JS parsers crash on invalid syntax as well, so might be by design.

Trouble with the atom-linter should be reported here: https://github.com/AtomLinter/linter-stylint

That said, you should be able to specify a custom location for stylintrc, I'll give this a look when I get some more time on my hands.