From 05e963151c0a15f3a14229e4e30110ad00e9aa9d Mon Sep 17 00:00:00 2001 From: mkelvers Date: Sun, 24 May 2026 22:45:51 +0200 Subject: [PATCH] chore: configure strict golangci-lint --- .golangci.yml | 67 ++++++++++++++++++++++++++++++--------------------- justfile | 2 +- lefthook.yml | 2 +- package.json | 2 +- 4 files changed, 43 insertions(+), 30 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 0d01c47..aff4418 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,41 +1,54 @@ -run: - timeout: 5m - -output: - sort-results: true +version: '2' linters: - disable-all: true + default: none enable: + - copyloopvar - errcheck - - exportloopref - govet - ineffassign - revive - staticcheck - - typecheck - unconvert - unused - -linters-settings: - revive: - rules: - - name: blank-imports - - name: context-as-argument - - name: context-keys-type - - name: early-return - - name: error-naming - - name: error-return - - name: exported - - name: if-return - - name: increment-decrement - - name: range - - name: receiver-naming - - name: time-naming - - name: unexported-return - - name: unnecessary-stmt - - name: var-declaration + settings: + revive: + enable-all-rules: false + rules: + - name: blank-imports + - name: context-as-argument + - name: context-keys-type + - name: early-return + - name: error-naming + - name: error-return + - name: if-return + - name: increment-decrement + - name: range + - name: receiver-naming + - name: time-naming + - name: unnecessary-stmt + - name: var-declaration + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ + - node_modules$ issues: max-issues-per-linter: 0 max-same-issues: 0 + +formatters: + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/justfile b/justfile index a91001f..2c5f0d6 100644 --- a/justfile +++ b/justfile @@ -7,7 +7,7 @@ fmt: go fmt ./... lint: - golangci-lint run + bun run lint:go lint-ts: bun run lint:ts diff --git a/lefthook.yml b/lefthook.yml index 1ffd72e..ce16878 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -13,7 +13,7 @@ 'commands': { 'go-fmt': { 'run': 'go fmt ./...' }, - 'go-lint': { 'run': 'golangci-lint run' }, + 'go-lint': { 'run': 'bun run lint:go' }, 'go-test': { 'run': 'go test ./...' }, 'ts-typecheck': { 'run': 'bunx tsc -p tsconfig.json --noEmit' }, 'build-assets': { 'run': 'bun run build:assets' }, diff --git a/package.json b/package.json index ae277b9..a925f1f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint": "bun run lint:ts && bun run lint:go", "lint:ts": "bunx eslint . --max-warnings 0", "lint:ts:fix": "bunx eslint . --fix", - "lint:go": "golangci-lint run" + "lint:go": "mkdir -p .cache/golangci-lint .cache/go-build && GOCACHE=$(pwd)/.cache/go-build GOLANGCI_LINT_CACHE=$(pwd)/.cache/golangci-lint golangci-lint run ./cmd/... && GOCACHE=$(pwd)/.cache/go-build GOLANGCI_LINT_CACHE=$(pwd)/.cache/golangci-lint golangci-lint run ./internal/... && GOCACHE=$(pwd)/.cache/go-build GOLANGCI_LINT_CACHE=$(pwd)/.cache/golangci-lint golangci-lint run ./pkg/... && GOCACHE=$(pwd)/.cache/go-build GOLANGCI_LINT_CACHE=$(pwd)/.cache/golangci-lint golangci-lint run ./integrations/..." }, "devDependencies": { "@tailwindcss/cli": "^4.2.4",