errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.3k stars 144 forks source link

.vale.ini search process starts in execution directory, not file directory (doesn't work as documented) #843

Open jstirnaman opened 1 month ago

jstirnaman commented 1 month ago

Check for existing issues

Environment

macOS Used Yarn to install npm package @vvago/vale@npm:3.4.2

% ./bin/vale --version
vale version 3.4.2

Describe the bug / provide steps to reproduce it

Vale's search process doesn't seem to work as described in the documentation here (emphasis mine):

Vale expects its configuration to be in a file named .vale.ini or _vale.ini. It’ll start looking for this file in the same folder as the file that’s being linted. If it can’t find one, it’ll search up the file tree.

Instead, it starts looking in the directory where I run vale--for example:

I have a project root .vale.ini:

% ls .vale.ini
.vale.ini

In a child directory, I have a cloud-dedicated/.vale.ini that uses a custom "Cloud-Dedicated" custom vocabulary:

% ls ./content/influxdb/cloud-dedicated/.vale.ini
./content/influxdb/cloud-dedicated/.vale.ini

The following command uses my project root ./.vale.ini (and doesn't invoke my "Cloud-Dedicated" custom vocabulary):

% ./node_modules/@vvago/vale/bin/vale --minAlertLevel=error ./content/influxdb/cloud-dedicated/get-started/*.md 

Expectation:

According to the documentation, the search process should use ./content/influxdb/cloud-dedicated/.vale.ini, the config file nearest to the file being linted.

I want to apply a custom vocabulary per subdirectory without needing to change to the subdirectory or specify the config path location for the subdirectory. In other words, I want to run vale and rely on Vale's search process (not my scripting) to find the correct (nearest) config file to use.