-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy path.golangci.yml
More file actions
142 lines (133 loc) · 5.08 KB
/
Copy path.golangci.yml
File metadata and controls
142 lines (133 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json
version: '2'
run:
allow-parallel-runners: true
linters:
default: none
enable:
# Enabled
- asasalint
- bidichk
- bodyclose
- canonicalheader
- copyloopvar
- depguard
- durationcheck
- errchkjson
- errname
- errorlint
- fatcontext
- forbidigo
- forcetypeassert
- gocheckcompilerdirectives
- goprintffuncname
- govet
- grouper
- inamedparam
- ineffassign
- intrange
- makezero
- mirror
- misspell
- musttag
- nakedret
- nilerr
- nilnesserr
- nilnil
# - nolintlint
- perfsprint
- predeclared
- reassign
- testableexamples
- tparallel
- unconvert
- usestdlibvars
- usetesting
# Need to add headers
# - goheader
# Check
# - exhaustive
# - gocritic
# - gosec
# - revive
- staticcheck
# - testifylint
# - unparam
- unused
settings:
govet:
enable:
- nilness
forbidigo:
forbid:
- pattern: '^strings\.ToLower$'
msg: 'A string a rule lowercases is lowercased the way JavaScript lowercases it. Use ecmascript.StringToLowerCase, which is the same answer for ASCII and the right one past it.'
- pattern: '^strings\.ToUpper$'
msg: 'A string a rule uppercases is uppercased the way JavaScript uppercases it. Use ecmascript.StringToUpperCase, which grows the string where JavaScript grows it.'
- pattern: '^strings\.TrimSpace$'
msg: 'The whitespace a rule trims is what JavaScript trims: ECMAScript WhiteSpace plus LineTerminator. Use ecmascript.StringTrim.'
- pattern: '^strings\.EqualFold$'
msg: 'Two strings a rule compares without regard to case are compared the way whatever it is ported from compares them: use ecmascript.EqualsWhenUppercased where upstream writes toUpperCase (jsx-ast-utils looks a prop up that way) and ecmascript.EqualsWhenLowercased where it writes toLowerCase. strings.EqualFold is neither: it folds U+017F ſ onto `s` in both directions, and never folds U+0131 ı onto `i` although uppercasing does.'
- pattern: '^unicode\.To(Upper|Lower|Title)?$'
msg: 'Use ecmascript.StringToUpperCase or ecmascript.StringToLowerCase instead.'
- pattern: '^unicode\.SimpleFold$'
msg: 'Use esregexp.Canonicalize or esregexp.CaseEquivalents instead.'
- pattern: '^unicode\.IsSpace$'
msg: 'Use ecmascript.IsWhiteSpaceOrLineTerminator instead.'
depguard:
rules:
config-rule-boundary:
# Configuration evaluates rule descriptors supplied by callers. It
# must not assemble or import concrete rule implementations.
list-mode: lax
files:
- '**/internal/config/**'
- '!**/internal/config/**_test.go'
deny:
- pkg: 'github.com/web-infra-dev/rslint/internal/plugins'
desc: 'Configuration depends on internal/rule abstractions; concrete Go rule aggregation belongs to internal/rules.'
- pkg: 'github.com/web-infra-dev/rslint/internal/rules'
desc: 'Configuration depends on internal/rule abstractions; concrete Go rule aggregation belongs to internal/rules.'
js-semantics:
# Lax so that only the listed dependencies are denied.
list-mode: lax
files:
- '**/internal/rules/**'
- '**/internal/plugins/**'
# Helpers used by rules follow the same boundaries. The ports
# themselves may use lower-level packages to implement them.
- '**/internal/utils/**'
- '!**/internal/utils/ecmascript/**'
- '!**/internal/utils/minimatch3/**'
deny:
- pkg: 'github.com/dlclark/regexp2'
desc: 'A pattern a rule is handed was written as a JavaScript regexp. Use "github.com/web-infra-dev/rslint/internal/utils/ecmascript/regexp" instead.'
- pkg: 'github.com/bmatcuk/doublestar'
desc: 'A glob a rule is handed is read the way minimatch 3 reads one. Use "github.com/web-infra-dev/rslint/internal/utils/minimatch3" instead.'
exclusions:
rules:
- path: '_test\.go$'
linters:
- forcetypeassert
# A rule reproduces JavaScript, as does a helper it calls; everything
# else here is a linter written in Go, answering Go's questions with Go's
# standard library.
- path-except: '^internal/(rules|plugins|utils)/'
linters:
- forbidigo
# The ports are where a JavaScript answer is assembled out of Go's, so
# they are the one place the standard library's calls belong.
- path: '^internal/utils/(ecmascript|minimatch3)/'
linters:
- forbidigo
# Test scaffolding builds its own strings rather than reading a source
# file, so it is not asking the question the rule asks.
- path: '_test\.go$'
linters:
- forbidigo
presets:
- comments
- std-error-handling
issues:
max-issues-per-linter: 0
max-same-issues: 0