Skip to content

Commit 4612dca

Browse files
authored
Merge pull request #1000 from plugwise/jsonauto
Auto-sorting core style
2 parents 8666153 + b7bb796 commit 4612dca

File tree

10 files changed

+716
-673
lines changed

10 files changed

+716
-673
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ jobs:
5252
- name: Fetch HA pyproject
5353
id: core-version
5454
run: wget -O ha_pyproject.toml "https://raw.githubusercontent.com/home-assistant/core/refs/heads/dev/pyproject.toml"
55+
- name: Core dependencies
56+
id: core-dependencies-1
57+
run: sudo apt-get update
58+
- name: Core dependencies
59+
id: core-dependencies-2
60+
run: sudo apt-get install python3-pip python3-dev python3-venv autoconf libssl-dev libxml2-dev libxslt1-dev libjpeg-dev libffi-dev libudev-dev zlib1g-dev pkg-config libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev ffmpeg libgammu-dev build-essential
5561
- name: Compute cache key
5662
id: set-key
5763
run: echo "cache-key=${{ runner.os }}--${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml', 'requirements_test.txt', '.pre-commit-config.yaml', 'ha_pyproject.toml') }}" >> "$GITHUB_OUTPUT"

.pre-commit-config.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,22 @@ repos:
5252
- id: yamllint
5353
name: "Linting yaml"
5454
- repo: https://github.com/shellcheck-py/shellcheck-py
55-
rev: v0.10.0.1
55+
rev: v0.11.0.1
5656
hooks:
5757
- id: shellcheck
5858
name: "Shell checking"
5959
args:
6060
- --external-sources
61+
- repo: https://github.com/rbubley/mirrors-prettier
62+
rev: v3.7.4
63+
hooks:
64+
- id: prettier
65+
additional_dependencies:
66+
67+
68+
name: "Prettier (JSON sorting)"
6169
- repo: https://github.com/biomejs/pre-commit
62-
rev: v2.3.11
70+
rev: v2.3.10
6371
hooks:
6472
- id: biome-lint
6573
additional_dependencies: ["@biomejs/[email protected]"]

.prettierignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
custom_components/plugwise/manifest.json
1+
*.md
2+
*.yaml
3+
tests
4+
.github
5+
.prettierrc.js

.prettierrc.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/** @type {import("prettier").Config} */
2+
module.exports = {
3+
overrides: [
4+
{
5+
files: "./custom_components/**/*.json",
6+
options: {
7+
plugins: [require.resolve("prettier-plugin-sort-json")],
8+
jsonRecursiveSort: true,
9+
jsonSortOrder: JSON.stringify({ [/.*/]: "numeric" }),
10+
},
11+
},
12+
{
13+
files: ["manifest.json", "./**/brands/*.json"],
14+
options: {
15+
// domain and name should stay at the top
16+
jsonSortOrder: JSON.stringify({
17+
domain: null,
18+
name: null,
19+
[/.*/]: "numeric",
20+
}),
21+
},
22+
},
23+
],
24+
};

custom_components/plugwise/icons.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@
6666
"dhw_mode": {
6767
"default": "mdi:shower",
6868
"state": {
69+
"auto": "mdi:auto-mode",
70+
"boost": "mdi:rocket-launch",
6971
"comfort": "mdi:sofa",
7072
"eco": "mdi:leaf",
71-
"off": "mdi:circle-off-outline",
72-
"boost": "mdi:rocket-launch",
73-
"auto": "mdi:auto-mode"
73+
"off": "mdi:circle-off-outline"
7474
}
7575
},
7676
"gateway_mode": {
@@ -84,11 +84,11 @@
8484
"regulation_mode": {
8585
"default": "mdi:hvac",
8686
"state": {
87-
"bleeding_hot": "mdi:fire-circle",
8887
"bleeding_cold": "mdi:water-circle",
89-
"off": "mdi:circle-off-outline",
88+
"bleeding_hot": "mdi:fire-circle",
89+
"cooling": "mdi:snowflake",
9090
"heating": "mdi:radiator",
91-
"cooling": "mdi:snowflake"
91+
"off": "mdi:circle-off-outline"
9292
}
9393
},
9494
"select_schedule": {

0 commit comments

Comments
 (0)