Skip to content

Commit 6fc3755

Browse files
authored
refactor(config)!: remove deprecated .proselintrc (amperser#1471)
- Remove deprecation warning and read system for old configuration files - Remove references to legacy configuration in `README` BREAKING CHANGE: Bare .proselintrc files are no longer read. Relocate your configuration accordingly.
1 parent 36ed58e commit 6fc3755

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,7 @@ This will return a list of suggestions:
200200

201201
You can disable any of the checks by modifying
202202
`$XDG_CONFIG_HOME/proselint/config.json`. If `$XDG_CONFIG_HOME` is not set or
203-
empty, `~/.config/proselint/config.json` will be used. Additionally, for
204-
compatibility reasons, the legacy configurations `~/.proselintrc` and
205-
`$XDG_CONFIG_HOME/proselint/config` will be checked if
206-
`$XDG_CONFIG_HOME/proselint/config.json` does not exist. Check selection is
203+
empty, `~/.config/proselint/config.json` will be used. Check selection is
207204
granular at any level, illustrated in the following example:
208205

209206
```json

proselint/config/__init__.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from itertools import chain
77
from pathlib import Path
88
from typing import TypeAlias, TypedDict, TypeVar, cast
9-
from warnings import showwarning as warn
109

1110
from proselint import config
1211
from proselint.config import paths
@@ -81,19 +80,11 @@ def load_from(config_path: Path | None = None) -> Config:
8180
result = DEFAULT
8281
config_paths = paths.config_paths + ([config_path] if config_path else [])
8382

84-
for path in config_paths:
85-
if path.is_file():
86-
result = _deepmerge_dicts(
87-
cast("dict[str, object]", result),
88-
json.loads(path.read_text()), # pyright: ignore[reportAny]
89-
)
90-
if path.suffix == ".json" and (old := path.with_suffix("")).is_file():
91-
warn(
92-
f"{old} was found instead of a JSON file. Rename to {path}.",
93-
DeprecationWarning,
94-
"",
95-
0,
96-
)
83+
for path in filter(Path.is_file, config_paths):
84+
result = _deepmerge_dicts(
85+
cast("dict[str, object]", result),
86+
json.loads(path.read_text()), # pyright: ignore[reportAny]
87+
)
9788

9889
result = cast("Config", result)
9990

0 commit comments

Comments
 (0)