Skip to content

Commit 2351097

Browse files
authored
chore(lint): Add Linting workflow to CI (#1270)
1 parent 048c034 commit 2351097

3 files changed

Lines changed: 117 additions & 1 deletion

File tree

.github/workflows/lint.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
NODE_VERSION: "22.18.0"
8+
9+
jobs:
10+
web:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Node
20+
uses: actions/setup-node@v6
21+
with:
22+
node-version: ${{ env.NODE_VERSION }}
23+
24+
- name: Set up pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: latest
28+
29+
- name: Install frontend dependencies
30+
working-directory: web
31+
run: pnpm install
32+
33+
- name: Lint frontend
34+
working-directory: web
35+
run: |
36+
webfiles=$({ git diff --name-only --diff-filter=d "origin/${{ github.base_ref }}"...HEAD -- 'web/'; } | sort -u | sed 's|^web/||' | grep -E '\.(ts|tsx|js|jsx)$' || true)
37+
if [ -n "$webfiles" ]; then echo "$webfiles" | xargs pnpm eslint; else echo "No frontend files to lint."; fi
38+
39+
backend:
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v6
45+
46+
- name: Set up Go
47+
uses: actions/setup-go@v6
48+
with:
49+
go-version-file: "go.mod"
50+
cache: true
51+
52+
- name: Lint backend
53+
uses: golangci/golangci-lint-action@v9
54+
with:
55+
version: v2.6
56+
only-new-issues: true

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ dist/
4343
.run/
4444
.dev/
4545
tmp/
46-
.golangci.yml
4746
web/eslint-sarif-report.sarif
4847
test/mockindexer/feeds/*
4948
test/mockindexer/files/*

.golangci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
version: "2"
2+
3+
issues:
4+
max-same-issues: 0
5+
6+
formatters:
7+
enable:
8+
- goimports
9+
- gofmt
10+
11+
settings:
12+
goimports:
13+
local-prefixes:
14+
- github.com/autobrr/qui
15+
16+
linters:
17+
enable:
18+
- containedctx
19+
- copyloopvar
20+
- errname
21+
- errorlint
22+
- exhaustive
23+
- fatcontext
24+
- ginkgolinter
25+
- gocritic
26+
- gosec
27+
- loggercheck
28+
- mirror
29+
- misspell
30+
- noctx
31+
- perfsprint
32+
- prealloc
33+
- revive
34+
- rowserrcheck
35+
- spancheck
36+
- testifylint
37+
- unconvert
38+
- whitespace
39+
- modernize
40+
41+
settings:
42+
exhaustive:
43+
default-signifies-exhaustive: false
44+
45+
misspell:
46+
ignore-rules:
47+
- alltime # Already used in metrics
48+
- hardlink
49+
- hardlinked
50+
51+
gosec:
52+
excludes:
53+
- G115
54+
55+
exclusions:
56+
generated: lax
57+
presets:
58+
- comments
59+
- common-false-positives
60+
- legacy
61+
- std-error-handling

0 commit comments

Comments
 (0)