proselint icon indicating copy to clipboard operation
proselint copied to clipboard

[feature-proposal] improve config - switch to toml & more

Open orgua opened this issue 5 months ago • 2 comments

advantages of toml:

  • default in common modern projects
  • easier to read and modify than json

per project config allows more control over lint-process. Projects like codespell or ruff demonstrate good usability:

  • (sub)directories to ignore
  • checks to disable (per file, dir or in general)
  • words or expressions to ignore
  • general check-classes to enable (see #1362)
  • other config like natural language or file-types to lint

update:

  • also nice feature: (auto) fix to safely remove words or replace them
  • allow sub-configs, individually per project. look for them when entering a sub-directory

orgua avatar Jan 23 '24 09:01 orgua

I would approve switching from JSON to TOML, especially since the standard library for Python 3.11 upwards includes tomllib, which means we're already guaranteed future support. Should we use toml from PyPI for earlier versions?

Nytelife26 avatar Feb 05 '24 22:02 Nytelife26

I would approve switching from JSON to TOML, especially since the standard library for Python 3.11 upwards includes tomllib, which means we're already guaranteed future support. Should we use toml from PyPI for earlier versions?

As a follow-on to this, I found out that tomli now maintains a backport of tomllib, so they should have the same interface. Additionally, poetry (although we're not planning to keep using it for long) does support Python-dependent versions, which is convenient.

Then, we'll just be able to do this in the code:

import sys

if sys.version_info >= (3, 11):
    import tomllib
else:
    import tomli as tomllib

I suppose the new filename should be .proselint.toml. I'm not sure why we kept it as proselintrc in the first place, honestly, given that it isn't a command file.

Nytelife26 avatar Feb 18 '24 12:02 Nytelife26