Skip to content

Commit e04b160

Browse files
committed
prettier, ruff, mypy linting, formatting, type annotations inc. stubs for pyscript
1 parent 9a17f39 commit e04b160

15 files changed

Lines changed: 981 additions & 79 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ repos:
99
- id: check-merge-conflict
1010
- id: check-symlinks
1111
- id: check-toml
12+
- id: check-json
1213
- id: check-yaml
1314
- id: debug-statements
1415
- id: detect-private-key

.prettierignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Ignore artifacts
2+
node_modules/
3+
.dist/
4+
.DS_Store
5+
.git/
6+
7+
# Ignore Python virtual env and caches
8+
.venv/
9+
__pycache__/
10+
.mypy_cache/
11+
.ruff_cache/
12+
13+
# Editor and build outputs
14+
public/build/
15+
public/*.min.js
16+
public/*.py
17+
18+
# Lockfiles handled by package manager
19+
pnpm-lock.yaml
20+
21+
# Optional IDE files
22+
.vscode/
23+
.idea/

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugins": ["prettier-plugin-astro"],
3+
"overrides": [
4+
{
5+
"files": "*.astro",
6+
"options": {
7+
"parser": "astro"
8+
}
9+
}
10+
]
11+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Pyscript Coding Challenge
2+
23
This Demos how to set up a python coding challenge that runs locally in the browser (no server-side untrusted code execution). Only one challenge is provided, but the configuration is stored as a dictionary in `challenge.py`, demonstrating how this can be adapted to support many challenges (in a database) readily.

astro.config.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// @ts-check
2-
import { defineConfig } from 'astro/config';
2+
import { defineConfig } from "astro/config";
33

4-
import icon from 'astro-icon';
4+
import icon from "astro-icon";
55

66
// https://astro.build/config
77
export default defineConfig({
8-
site: 'https://jacklowrie.github.io',
9-
base: '/pyscript-coding-challenge',
10-
integrations: [icon()]
11-
});
8+
site: "https://jacklowrie.github.io",
9+
base: "/pyscript-coding-challenge",
10+
integrations: [icon()],
11+
});

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@
77
"dev": "astro dev",
88
"build": "astro build",
99
"preview": "astro preview",
10-
"astro": "astro"
10+
"astro": "astro",
11+
"format": "prettier --write .",
12+
"format:check": "prettier --check ."
1113
},
1214
"dependencies": {
15+
"@astrojs/check": "^0.9.6",
1316
"@iconify-json/fa7-brands": "^1.2.1",
1417
"ace-builds": "^1.43.5",
1518
"astro": "^5.16.6",
1619
"astro-icon": "^1.1.5",
17-
"bulma": "^1.0.4"
20+
"bulma": "^1.0.4",
21+
"typescript": "^5.9.3"
1822
},
1923
"volta": {
2024
"node": "24.12.0",
2125
"pnpm": "10.26.0"
2226
},
2327
"devDependencies": {
24-
"@types/ace": "^0.0.52"
28+
"@types/ace": "^0.0.52",
29+
"prettier": "3.7.4",
30+
"prettier-plugin-astro": "0.14.1"
2531
}
2632
}

0 commit comments

Comments
 (0)