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

stylint only lints a single folder when multiple are provided #381

Closed karl-run closed 10 months ago

karl-run commented 7 years ago

When stylint is executed with multiple paths provided, e.g. stylint folder-one/ folder-two/ it will only lint one of them, usually not the first one (haven't found any pattern to which it will pick).

Steps to reproduce

  1. Pull https://github.com/hermith/stylint-repro-karlos
  2. run npm i
  3. run npm run lint-dank
  4. run npm run lint-cool
  5. Notice the errors in the two previous steps
  6. run npm run lint (which is stylint dank-styles/ cool-styles)
  7. Notice only one of the two folders have been linted.

The expected behaviour is of course that it lints all provided folders.

Alternatively, add more folders and see that it doesn't always pick the first or last folder provided.

SimenB commented 7 years ago

Will get to this tonight

SimenB commented 7 years ago

Digging into this, I think the problem is that we try to recurse through dirs, and start linting files as we find them. This means this.state.file etc gets overwritten all over the place.

The solution I think is to get a list of every file we should lint, before we loop through and actually parse them. And if that doesn't solve the problem, it'd at least make things easier to debug. I have a working implementation of this locally, but it imports the glob-util of eslint. I've thrown together a repo deleting most everything we don't need here: https://github.com/SimenB/eslint-glob-util That works, but it needs cleaning up. It'd also be great if eslint maintained it themselves, I have an open issue for that

SimenB commented 10 months ago

🪦