TimKam / atomic-vale

a vale linter plugin for Atom
MIT License
6 stars 2 forks source link

Set `cwd` to the directory of the active file #9

Closed jdkato closed 7 years ago

jdkato commented 7 years ago

Vale has the ability to support multiple configuration files in a single project. For example,

docs/
├── blog/
│   ├── .vale
│   ├── B.md
├── .vale
├── A.md

Here, A.md and B.md are associated with different .vale files. By setting cwd to the parent directory of the active file, Vale should just do the "right thing." If a configuration file can't be found, Vale should also automatically fall back to its default settings. The algorithm is essentially the same as JSHint:

In case of .jshintrc, JSHint will start looking for this file in the same directory as the file that's being linted. If not found, it will move one level up the directory tree all the way up to the filesystem root.

Except, for performance reasons, Vale only looks 6 levels up (although this may be increased) before falling back to the defaults.

This should also mean that user's don't need to specify the location of their configuration file, which is nice for people who use Atom to work on multiple projects.