diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..1395606 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,9 @@ +- id: usort + name: Sort imports with µsort + description: Safe, minimal import sorting + language: python + types_or: + - python + - pyi + entry: usort format + require_serial: true diff --git a/README.md b/README.md index eb1fff0..d703f49 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,20 @@ To just validate that files are formatted correctly, like during CI: $ usort check ``` -# License +### pre-commit + +µsort provides a [pre-commit](https://pre-commit.com/) hook. To enforce sorted +imports before every commit, add the following to your `.pre-commit-config.yaml` +file: + +```yaml +- repo: https://github.com/facebook/usort + rev: v1.0.7 + hooks: + - id: usort +``` + +## License μsort is MIT licensed, as found in the [LICENSE][] file.