Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Lint

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

permissions:
contents: read
Expand All @@ -14,12 +14,19 @@ jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: script/vendor-onnxruntime
- run: source script/env
- uses: golangci/golangci-lint-action@v9
with:
version: v2.9.0
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: script/vendor-onnxruntime
- run: source script/env
- uses: golangci/golangci-lint-action@v9
with:
version: v2.9.0
biome:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: biomejs/setup-biome@v2
with:
version: v2.3.15
35 changes: 35 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.15/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"includes": ["./web/static/css/*.css", "./web/static/js/*.js"]
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}
13 changes: 4 additions & 9 deletions script/lint
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#!/bin/sh

REPO_ROOT="$(git rev-parse --show-toplevel)"
source "${REPO_ROOT}/script/env"

BINDIR="${REPO_ROOT}/bin"
BINARY=$BINDIR/golangci-lint
GOLANGCI_LINT_VERSION=v2.9.0
echo "linting go code..."
"${REPO_ROOT}/script/lint-go"

if [ ! -f "$BINARY" ]; then
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "$GOLANGCI_LINT_VERSION"
fi

$BINARY run
echo "linting web code..."
"${REPO_ROOT}/script/lint-web"
15 changes: 15 additions & 0 deletions script/lint-go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

REPO_ROOT="$(git rev-parse --show-toplevel)"
source "${REPO_ROOT}/script/env"

BINDIR="${REPO_ROOT}/bin"

GOLANGCI_LINT_BINARY=$BINDIR/golangci-lint
GOLANGCI_LINT_VERSION=v2.9.0

if [ ! -f "$GOLANGCI_LINT_BINARY" ]; then
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "$GOLANGCI_LINT_VERSION"
fi

$GOLANGCI_LINT_BINARY run
22 changes: 22 additions & 0 deletions script/lint-web
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

REPO_ROOT="$(git rev-parse --show-toplevel)"

BINDIR="${REPO_ROOT}/bin"

BIOME_BINARY=$BINDIR/biome
BIOME_VERSION="@biomejs/biome@2.3.15"

if [ ! -f "$BIOME_BINARY" ]; then
case "$(uname -s)-$(uname -m)" in
Darwin-arm64) BIOME_TARGET="biome-darwin-arm64" ;;
Darwin-x86_64) BIOME_TARGET="biome-darwin-x64" ;;
Linux-x86_64) BIOME_TARGET="biome-linux-x64" ;;
Linux-aarch64) BIOME_TARGET="biome-linux-arm64" ;;
*) echo "Unsupported platform: $(uname -s)-$(uname -m)"; exit 1 ;;
esac
curl -sSfL "https://github.com/biomejs/biome/releases/download/${BIOME_VERSION}/${BIOME_TARGET}" -o "$BIOME_BINARY"
chmod +x "$BIOME_BINARY"
fi

$BIOME_BINARY check
56 changes: 28 additions & 28 deletions web/static/css/code.css
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
.code {
margin: 1.5rem 1rem;
margin: 1.5rem 1rem;
}

.code .chroma .line {
display: flex;
line-height: 1.5rem;
display: flex;
line-height: 1.5rem;
}

.code .chroma .hl {
background-color: unset;
background-color: unset;
}

.code .chroma .ln:target {
background-color: unset;
background-color: unset;
}

.code .chroma .hl .cl {
position: relative;
flex: 1;
position: relative;
flex: 1;
}

.code .chroma .ln {
margin-right: 0.4rem;
padding: 0 0.4rem 0 0.8rem;
margin-right: 0.4rem;
padding: 0 0.4rem 0 0.8rem;
}

.code .chroma .ln + .cl {
padding-left: 0.75rem;
padding-left: 0.75rem;
}

.code .chroma .hl .cl:before {
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
width: 2px;
height: 100%;
background-color: var(--color-primary);
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
width: 2px;
height: 100%;
background-color: var(--color-primary);
}

.code .chroma .hl .cl:after {
content: "";
display: block;
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
background-color: var(--color-primary);
opacity: 0.05;
content: "";
display: block;
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
background-color: var(--color-primary);
opacity: 0.05;
}

.code .chroma .hl .lnlinks {
color: var(--color-primary);
color: var(--color-primary);
}
Loading
Loading