Fix the sorting of the schema submited to schemastore (#10173)

This commit is contained in:
Micha Reiser 2024-02-29 19:21:54 +01:00 committed by GitHub
parent 40186a26ef
commit cea59b4425
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,9 +55,18 @@ def update_schemastore(schemastore: Path) -> None:
schema = json.loads(root.joinpath("ruff.schema.json").read_text())
schema["$id"] = "https://json.schemastore.org/ruff.json"
src.joinpath(ruff_json).write_text(
json.dumps(dict(sorted(schema.items())), indent=2, ensure_ascii=False),
json.dumps(dict(schema.items()), indent=2, ensure_ascii=False),
)
check_call(
[
"node_modules/.bin/prettier",
"--plugin",
"prettier-plugin-sort-json",
"--write",
ruff_json,
],
cwd=src,
)
check_call(["node_modules/.bin/prettier", "--write", ruff_json], cwd=src)
# Check if the schema has changed
# https://stackoverflow.com/a/9393642/3549270