Skip to content

Commit e7a90eb

Browse files
committed
docs: add notice for configuration behaviour
1 parent 22328a1 commit e7a90eb

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ The following plugins are also available, but they are archived or unmaintained:
100100
- [Sublime Text](https://github.com/amperser/proselint/tree/main/plugins/sublime/SublimeLinter-contrib-proselint)
101101
- [Visual Studio Code](https://github.com/ppeszko/vscode-proselint) (thanks to [Patryk Peszko](https://github.com/ppeszko))
102102

103-
### Usage
103+
## Usage
104+
105+
### From the command line
104106

105107
Suppose you have a document `text.md` with the following text:
106108

@@ -154,6 +156,8 @@ following our [stable wire schema].
154156
}
155157
```
156158

159+
### As a library
160+
157161
To run the linter as part of another Python program, you can use the `LintFile`
158162
class in `proselint.tools`. This requires `CheckRegistry` to be populated.
159163

@@ -182,15 +186,24 @@ This will return a list of suggestions:
182186

183187
[stable wire schema]: https://github.com/amperser/proselint/blob/main/docs/wire-schema.md
184188

185-
### Checks
186-
187-
You can disable any of the checks by modifying
188-
`$XDG_CONFIG_HOME/proselint/config.json`. If `$XDG_CONFIG_HOME` is not set or
189-
empty, `~/.config/proselint/config.json` will be used. Additionally, for
190-
compatibility reasons, the legacy configurations `~/.proselintrc` and
191-
`$XDG_CONFIG_HOME/proselint/config` will be checked if
192-
`$XDG_CONFIG_HOME/proselint/config.json` does not exist. Check selection is
193-
granular at any level, illustrated in the following example:
189+
### Configuration
190+
191+
> [!WARNING]
192+
> Currently, configuration files are implicitly merged together, starting from
193+
> the default configuration as a base. This may cause surprising behaviour if
194+
> you have multiple configuration files in different locations.
195+
>
196+
> This occurs in the following order, merging any found files:
197+
>
198+
> 1. `/etc/proselintrc`
199+
> 2. `~/.proselintrc.json`
200+
> 3. `$XDG_CONFIG_HOME/proselint/config.json` (defaulting to
201+
> `~/.config/proselint/config.json` if `XDG_CONFIG_HOME` is not set)
202+
> 4. All paths walking down from the root (`/.proselintrc.json`) to your current
203+
> working directory (`./.proselintrc.json`) for per-project configuration
204+
> 5. Any configuration given by the flag `--config`
205+
206+
Check selection is granular at any level, illustrated in the following example:
194207

195208
```json
196209
{
@@ -208,7 +221,9 @@ This configuration would enable all checks in the `typography` module, excluding
208221
preserving `typography.symbols.curly_quotes`. Using this system allows you to
209222
concisely and precisely select checks at an individual level.
210223

211-
| ID | Description |
224+
## Checks
225+
226+
| ID | Description |
212227
| ----- | --------------- |
213228
| `annotations` | Catch annotations left in the text |
214229
| `archaism` | Avoid archaic forms |

0 commit comments

Comments
 (0)