Skip to content

Commit ac5569f

Browse files
feat: Use biomejs for formatting & linting (#42)
1 parent 6025291 commit ac5569f

17 files changed

Lines changed: 1095 additions & 1000 deletions

.devcontainer/devcontainer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
3+
{
4+
"name": "Node.js & TypeScript",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
7+
"features": {
8+
"ghcr.io/devcontainers-contrib/features/deno:1": {}
9+
},
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"biomejs.biome",
14+
"denoland.vscode-deno"
15+
]
16+
}
17+
}
18+
19+
// Features to add to the dev container. More info: https://containers.dev/features.
20+
// "features": {},
21+
22+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
23+
// "forwardPorts": [],
24+
25+
// Use 'postCreateCommand' to run commands after the container is created.
26+
// "postCreateCommand": "yarn install",
27+
28+
// Configure tool-specific properties.
29+
// "customizations": {},
30+
31+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
32+
// "remoteUser": "root"
33+
}

.github/workflows/lint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: test
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v3
17+
- uses: denoland/setup-deno@v1
18+
with:
19+
deno-version: 1.x
20+
- name: Lint Package with Biome
21+
run: deno task lint

.vscode/extensions.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
"recommendations": [
3-
"denoland.vscode-deno"
4-
]
2+
"recommendations": ["denoland.vscode-deno", "biomejs.biome"]
53
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"deno.enable": true,
3-
"deno.lint": true
2+
"deno.enable": true,
3+
"deno.lint": false
44
}

biome.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true
10+
}
11+
},
12+
"files": {
13+
"ignore": [".devcontainer/*", "npm/*", "deno.lock"]
14+
}
15+
}

deno.jsonc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"tasks": {
3-
"npm": "deno run -A scripts/build_npm.ts"
3+
"npm": "deno run -A scripts/build_npm.ts",
4+
"format": "deno run -A npm:@biomejs/biome format . --write",
5+
"lint": "deno run -A npm:@biomejs/biome lint ."
46
},
57
"exclude": ["npm"]
68
}

deno.lock

Lines changed: 43 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps_dev.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export {
2-
assertEquals,
3-
assertExists,
4-
assertRejects,
2+
assertEquals,
3+
assertExists,
4+
assertRejects,
55
} from "https://deno.land/std@0.201.0/assert/mod.ts";

scripts/build_npm.ts

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,52 @@ if (!Deno.args[0]) throw new Error("No version specified");
66
await emptyDir("./npm");
77

88
await build({
9-
entryPoints: [{
10-
name: ".",
11-
path: "./mod.ts",
12-
}, {
13-
name: "./types",
14-
path: "./src/types.ts",
15-
}],
16-
outDir: "./npm",
17-
importMap: "./deno.jsonc",
18-
shims: {
19-
deno: true,
20-
},
21-
packageManager: "pnpm",
22-
compilerOptions: {
23-
lib: ["DOM", "ESNext"],
24-
},
25-
typeCheck: "both",
26-
package: {
27-
name: "classcharts-api",
28-
version: String(Deno.args[0]).replace("v", ""),
29-
author: {
30-
name: "James Cook",
31-
email: "james@jaminit.co.uk",
32-
},
33-
description:
34-
"A Typescript wrapper for getting information from the ClassCharts API",
35-
license: "ISC",
36-
keywords: ["node", "typescript", "classcharts", "class charts"],
37-
bugs: {
38-
url: "https://github.com/classchartsapi/classcharts-api-js/issues",
39-
},
40-
repository: {
41-
type: "git",
42-
url: "https://github.com/classchartsapi/classcharts-api-js.git",
43-
},
44-
homepage: "https://classchartsapi.github.io/classcharts-api-js/",
45-
engines: {
46-
node: ">=18",
47-
},
48-
sideEffects: false,
49-
},
50-
postBuild() {
51-
Deno.copyFileSync("LICENSE", "npm/LICENSE");
52-
Deno.copyFileSync("README.md", "npm/README.md");
53-
},
9+
entryPoints: [
10+
{
11+
name: ".",
12+
path: "./mod.ts",
13+
},
14+
{
15+
name: "./types",
16+
path: "./src/types.ts",
17+
},
18+
],
19+
outDir: "./npm",
20+
importMap: "./deno.jsonc",
21+
shims: {
22+
deno: true,
23+
},
24+
packageManager: "pnpm",
25+
compilerOptions: {
26+
lib: ["DOM", "ESNext"],
27+
},
28+
typeCheck: "both",
29+
package: {
30+
name: "classcharts-api",
31+
version: String(Deno.args[0]).replace("v", ""),
32+
author: {
33+
name: "James Cook",
34+
email: "james@jaminit.co.uk",
35+
},
36+
description:
37+
"A Typescript wrapper for getting information from the ClassCharts API",
38+
license: "ISC",
39+
keywords: ["node", "typescript", "classcharts", "class charts"],
40+
bugs: {
41+
url: "https://github.com/classchartsapi/classcharts-api-js/issues",
42+
},
43+
repository: {
44+
type: "git",
45+
url: "https://github.com/classchartsapi/classcharts-api-js.git",
46+
},
47+
homepage: "https://classchartsapi.github.io/classcharts-api-js/",
48+
engines: {
49+
node: ">=18",
50+
},
51+
sideEffects: false,
52+
},
53+
postBuild() {
54+
Deno.copyFileSync("LICENSE", "npm/LICENSE");
55+
Deno.copyFileSync("README.md", "npm/README.md");
56+
},
5457
});

0 commit comments

Comments
 (0)