stylelint: Can't load configuration file by css file's path

My project files

~/myproject/css/.stylelintrc.json
~/myproject/css/test.css
~/myproject/js/.eslintrc.json
~/myproject/js/test.js
cd ~/myproject/
eslint js/*
stylelint css/*

When I Change the current working directory to ~/myproject/, then executed eslint js/*, stylelint will throw a error: No configuration found.

In same case, ESLint is work fine. I hope that, when I didn’t set --config, stylelint can find configuration file by file path. Just like ESLint

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@gucong3000 Thanks for writing up the issue. I’m afraid I’m vacation for another week and a half. I just dropped in for a short time to check up on things. So I will have to give this more thought after I get back.

In the meantime, I can say that you accomplish what you want in a pretty straightforward way by adding .stylelintrc files in your sub-projects that extend the main .stylelintrc.

Once I get back I’ll think more about the possibility of starting the search for configuration from the file that is being linted.

@Arcanemagus: Seems like the most useful for linter-stylelint and related packages might be if cosmiconfig could have a watching mode … sounds interesting. I’ll look into it.