feat: setup stricter linting
This commit is contained in:
41
.golangci.yml
Normal file
41
.golangci.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
run:
|
||||
timeout: 5m
|
||||
|
||||
output:
|
||||
sort-results: true
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- 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
|
||||
|
||||
issues:
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
@@ -2,27 +2,38 @@ import tseslint from '@typescript-eslint/eslint-plugin';
|
||||
import tsParser from '@typescript-eslint/parser';
|
||||
import prettier from 'eslint-plugin-prettier';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const tsconfigRootDir = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export default [
|
||||
{
|
||||
ignores: ['dist/**', 'node_modules/**', 'server', '*.js'],
|
||||
},
|
||||
{
|
||||
files: ['**/*.ts'],
|
||||
files: ['static/**/*.ts'],
|
||||
plugins: {
|
||||
'@typescript-eslint': tseslint,
|
||||
prettier,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
...eslintConfigPrettier.rules,
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
...tseslint.configs.recommended.rules,
|
||||
...tseslint.configs.stylistic.rules,
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'warn',
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
||||
],
|
||||
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
|
||||
'prettier/prettier': 'error',
|
||||
},
|
||||
},
|
||||
|
||||
8
justfile
8
justfile
@@ -7,7 +7,13 @@ fmt:
|
||||
go fmt ./...
|
||||
|
||||
lint:
|
||||
go fmt ./... && go vet ./...
|
||||
golangci-lint run
|
||||
|
||||
lint-ts:
|
||||
bun run lint:ts
|
||||
|
||||
lint-go:
|
||||
bun run lint:go
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
'commands':
|
||||
{
|
||||
'go-fmt': { 'run': 'go fmt ./...' },
|
||||
'go-vet': { 'run': 'go vet ./...' },
|
||||
'go-lint': { 'run': 'golangci-lint run' },
|
||||
'go-test': { 'run': 'go test ./...' },
|
||||
'ts-typecheck': { 'run': 'bunx tsc -p tsconfig.json --noEmit' },
|
||||
'build-assets': { 'run': 'bun run build:assets' },
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
"typecheck": "bunx tsc -p tsconfig.json --noEmit",
|
||||
"build:assets": "bun run build:css && bun run build:ts",
|
||||
"format": "bunx prettier . --write",
|
||||
"lint": "bunx eslint . --fix"
|
||||
"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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/cli": "^4.2.4",
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
"removeComments": false,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["static/*.ts"]
|
||||
"include": ["eslint.config.ts", "static/**/*.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user