Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgerstmayr committed Nov 29, 2023
1 parent ba6ba36 commit 1a48dfb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 9 deletions.
1 change: 0 additions & 1 deletion .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- name: Install dependencies
run: |
sudo pip3 install black
sudo npm install -g prettier
- name: Build frontend
run: make build
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test: frontend/node_modules

.PHONY: format
format:
prettier -w frontend src/fava_dashboards/templates/*.css
cd frontend; npx --no-install -- prettier -w . ../src/fava_dashboards/templates/*.css
black src/fava_dashboards/__init__.py scripts/format_js_in_dashboard.py
./scripts/format_js_in_dashboard.py example/dashboards.yaml
find example -name '*.beancount' -exec bean-format -c 59 -o "{}" "{}" \;
24 changes: 23 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"jest": "^29.6.1",
"jest-image-snapshot": "^6.2.0",
"jest-puppeteer": "^9.0.0",
"jest-serializer-html": "^7.1.0"
"jest-serializer-html": "^7.1.0",
"prettier": "^3.1.0"
},
"dependencies": {
"d3": "^7.8.5",
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/sankey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export function render_d3sankey(elem, options) {
edgeColor === "none"
? "#aaa"
: edgeColor === "path"
? `url(#${d.uid})`
: edgeColor === "input"
? color(d.source)
: color(d.target),
? `url(#${d.uid})`
: edgeColor === "input"
? color(d.source)
: color(d.target),
)
.attr("stroke-width", (d) => Math.max(1, d.width!));

Expand Down
13 changes: 12 additions & 1 deletion scripts/format_js_in_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@

def run_prettier(code, indent):
p = subprocess.run(
["prettier", "--stdin-filepath", "script.js", "--tab-width", "2"],
[
"npx",
"--no-install",
"--",
"prettier",
"--stdin-filepath",
"script.js",
"--tab-width",
"2",
],
input=code.encode(),
capture_output=True,
check=True,
cwd="frontend",
)
formatted = p.stdout.decode()
return (
Expand Down

0 comments on commit 1a48dfb

Please sign in to comment.