Skip to content
Draft
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
1783bec
Enable staticcheck
jakebailey Mar 26, 2025
07cfcfb
Fix staticcheck issues
jakebailey Mar 26, 2025
b29938d
Just drop the param
jakebailey Mar 26, 2025
e499d77
fmt
jakebailey Mar 26, 2025
4fc24e9
Merge branch 'main' into jabaile/staticcheck
jakebailey Apr 9, 2025
c7f34e9
Fix
jakebailey Apr 9, 2025
08b608b
Merge branch 'main' into jabaile/staticcheck
jakebailey Apr 18, 2025
7ca8f4c
Restore comment
jakebailey Apr 18, 2025
4468f4c
Merge branch 'main' into jabaile/staticcheck
jakebailey Apr 21, 2025
6c612a5
Merge branch 'main' into jabaile/staticcheck
jakebailey May 23, 2025
9e36d0e
Merge branch 'main' into jabaile/staticcheck
jakebailey May 29, 2025
8cd9960
Fix new stuff
jakebailey May 29, 2025
a351984
Merge branch 'main' into jabaile/staticcheck
jakebailey Jun 19, 2025
4187f47
fmt
jakebailey Jun 19, 2025
bbeded5
Merge branch 'main' into jabaile/staticcheck
jakebailey Jun 24, 2025
34ec1c2
Merge branch 'main' into jabaile/staticcheck
jakebailey Jul 2, 2025
f1ec936
oops
jakebailey Jul 2, 2025
fe4db02
oops
jakebailey Jul 2, 2025
287e1ec
Merge branch 'main' into jabaile/staticcheck
jakebailey Jul 8, 2025
983ed07
Merge branch 'main' into jabaile/staticcheck
jakebailey Jul 24, 2025
2ed61c6
Fixesg
jakebailey Jul 25, 2025
d24e3e2
Merge branch 'main' into jabaile/staticcheck
jakebailey Aug 8, 2025
a9945c0
Fix
jakebailey Aug 8, 2025
410900e
Merge branch 'main' into jabaile/staticcheck
jakebailey Oct 2, 2025
ea5773a
fix
jakebailey Oct 2, 2025
37d43ba
more
jakebailey Oct 2, 2025
2f60a43
more
jakebailey Oct 2, 2025
07d57d8
more
jakebailey Oct 2, 2025
59c2035
more
jakebailey Oct 2, 2025
446148e
remove unused assignment
jakebailey Oct 2, 2025
9eb4b3d
fmt
jakebailey Oct 2, 2025
b4cd226
Merge branch 'main' into jabaile/staticcheck
jakebailey Oct 31, 2025
0fbcbd2
Auto fix
jakebailey Oct 31, 2025
af4b744
Silence
jakebailey Oct 31, 2025
d864ad3
Merge branch 'main' into jabaile/staticcheck
jakebailey Nov 12, 2025
73bdae2
Merge branch 'main' into jabaile/staticcheck
jakebailey Nov 12, 2025
6dd858a
Fix
jakebailey Nov 12, 2025
7e8a25d
Fix
jakebailey Nov 12, 2025
0a3b5ae
oops
jakebailey Nov 12, 2025
d7e7d7a
Merge branch 'main' into jabaile/staticcheck
jakebailey Dec 3, 2025
0ead3e2
fix
jakebailey Dec 3, 2025
52e5cd2
Remove bad nil check
jakebailey Dec 3, 2025
c096d54
Merge branch 'main' into jabaile/staticcheck
jakebailey Dec 9, 2025
5861922
Move funcg
jakebailey Dec 9, 2025
e764d44
Merge branch 'main' into jabaile/staticcheck
jakebailey Dec 17, 2025
8911737
Fix lint
jakebailey Dec 17, 2025
3ff027b
Merge branch 'main' into jabaile/staticcheck
jakebailey Dec 29, 2025
331f8a6
Document disabled rules
jakebailey Dec 29, 2025
57e11bb
all fixed
jakebailey Dec 29, 2025
ce0e7d0
Merge branch 'main' into jabaile/staticcheck
jakebailey Jan 12, 2026
238bb09
some fixes
jakebailey Jan 12, 2026
bba802b
some fixes
jakebailey Jan 12, 2026
a2f42d6
Merge branch 'main' into jabaile/staticcheck
jakebailey Jan 31, 2026
3a2ff27
fix
jakebailey Jan 31, 2026
f9754db
Merge branch 'main' into jabaile/staticcheck
jakebailey Feb 5, 2026
c109a51
Merge branch 'main' into jabaile/staticcheck
jakebailey Feb 19, 2026
7f49afb
Fix
jakebailey Feb 19, 2026
76ad05e
oops
jakebailey Feb 19, 2026
eeafc73
Merge branch 'main' into jabaile/staticcheck
jakebailey Feb 19, 2026
a2c4e35
fix
jakebailey Feb 19, 2026
b435107
Merge branch 'main' into jabaile/staticcheck
jakebailey Feb 27, 2026
32bcdba
Merge branch 'main' into jabaile/staticcheck
jakebailey Mar 5, 2026
2f94c7c
Merge branch 'main' into jabaile/staticcheck
jakebailey Mar 10, 2026
4ab816c
Merge branch 'main' into jabaile/staticcheck
jakebailey Mar 25, 2026
0250d37
fix
jakebailey Mar 25, 2026
260bee9
Merge branch 'main' into jabaile/staticcheck
jakebailey Mar 31, 2026
0ddf4f4
Fix
jakebailey Mar 31, 2026
96c87d3
Merge branch 'main' into jabaile/staticcheck
jakebailey Apr 9, 2026
f1a3c10
Merge branch 'main' into jabaile/staticcheck
jakebailey Apr 10, 2026
8e9c144
Merge branch 'main' into jabaile/staticcheck
jakebailey Jun 17, 2026
5cb7f05
Fix staticcheck lints after merge
jakebailey Jun 17, 2026
16bc763
Fix staticcheck lints on non-Linux platforms
jakebailey Jun 17, 2026
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
16 changes: 15 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ linters:
- perfsprint
- predeclared
- reassign
- staticcheck
- testableexamples
- tparallel
- unconvert
Expand All @@ -52,7 +53,6 @@ linters:
# - gocritic
# - gosec
# - revive
# - staticcheck
# - testifylint
# - unparam
# - unused
Expand All @@ -62,6 +62,20 @@ linters:
customlint:
type: module

staticcheck:
checks:
- all
- -QF1001
- -QF1003
- -SA6005
- -SA9003
- -ST1000
- -ST1003
- -ST1016
- -ST1020
- -ST1021
- -ST1022

exclusions:
presets:
- comments
Expand Down
10 changes: 5 additions & 5 deletions internal/astnav/tokens_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,23 +282,23 @@ func writeRangeDiff(output *strings.Builder, file *ast.SourceFile, diff tokenDif
output.WriteString("\n\n")
}

output.WriteString(fmt.Sprintf("〚Positions: [%d, %d]〛\n", rng.Pos(), rng.End()))
fmt.Fprintf(output, "〚Positions: [%d, %d]〛\n", rng.Pos(), rng.End())
if diff.tsToken != nil {
output.WriteString(fmt.Sprintf("【TS: %s [%d, %d)】\n", diff.tsToken.Kind, tsTokenPos, tsTokenEnd))
fmt.Fprintf(output, "【TS: %s [%d, %d)】\n", diff.tsToken.Kind, tsTokenPos, tsTokenEnd)
} else {
output.WriteString("【TS: nil】\n")
}
if diff.goToken != nil {
output.WriteString(fmt.Sprintf("《Go: %s [%d, %d)》\n", diff.goToken.Kind, goTokenPos, goTokenEnd))
fmt.Fprintf(output, "《Go: %s [%d, %d)》\n", diff.goToken.Kind, goTokenPos, goTokenEnd)
} else {
output.WriteString("《Go: nil》\n")
}
for line := contextStart; line <= contextEnd; line++ {
if truncate, skipTo := shouldTruncate(line); truncate {
output.WriteString(fmt.Sprintf("%s │........ %d lines omitted ........\n", strings.Repeat(" ", digits), skipTo-line+1))
fmt.Fprintf(output, "%s │........ %d lines omitted ........\n", strings.Repeat(" ", digits), skipTo-line+1)
line = skipTo
}
output.WriteString(fmt.Sprintf("%*d │", digits, line+1))
fmt.Fprintf(output, "%*d │", digits, line+1)
end := len(file.Text()) + 1
if line < len(lines)-1 {
end = int(lines[line+1])
Expand Down
6 changes: 3 additions & 3 deletions internal/binder/binder.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (b *Binder) declareSymbolEx(symbolTable ast.SymbolTable, parent *ast.Symbol
}
}
}
var declarationName *ast.Node = ast.GetNameOfDeclaration(node)
declarationName := ast.GetNameOfDeclaration(node)
if declarationName == nil {
declarationName = node
}
Expand All @@ -261,7 +261,7 @@ func (b *Binder) declareSymbolEx(symbolTable ast.SymbolTable, parent *ast.Symbol
diag.AddRelatedInfo(b.createDiagnosticForNode(node, diagnostics.Did_you_mean_0, "export type { "+node.AsTypeAliasDeclaration().Name().AsIdentifier().Text+" }"))
}
for index, declaration := range symbol.Declarations {
var decl *ast.Node = ast.GetNameOfDeclaration(declaration)
decl := ast.GetNameOfDeclaration(declaration)
if decl == nil {
decl = declaration
}
Expand Down Expand Up @@ -2099,7 +2099,7 @@ func (b *Binder) bindCaseBlock(node *ast.Node) {
switchStatement := node.Parent
clauses := node.AsCaseBlock().Clauses.Nodes
isNarrowingSwitch := switchStatement.Expression().Kind == ast.KindTrueKeyword || isNarrowingExpression(switchStatement.Expression())
var fallthroughFlow *ast.FlowNode = b.unreachableFlow
fallthroughFlow := b.unreachableFlow
for i := 0; i < len(clauses); i++ {
clauseStart := i
for len(clauses[i].AsCaseOrDefaultClause().Statements.Nodes) == 0 && i+1 < len(clauses) {
Expand Down
45 changes: 19 additions & 26 deletions internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1614,13 +1614,6 @@ func (c *Checker) getSuggestedLibForNonExistentName(name string) string {
return ""
}

func (c *Checker) getPrimitiveAliasSymbols() {
var symbols []*ast.Symbol
for _, name := range []string{"string", "number", "boolean", "object", "bigint", "symbol"} {
symbols = append(symbols, c.newSymbol(ast.SymbolFlagsTypeAlias, name))
}
}

func (c *Checker) getSuggestedSymbolForNonexistentSymbol(location *ast.Node, outerName string, meaning ast.SymbolFlags) *ast.Symbol {
return c.resolveNameForSymbolSuggestion(location, outerName, meaning, nil /*nameNotFoundMessage*/, false /*isUse*/, false /*excludeGlobals*/)
}
Expand Down Expand Up @@ -10275,10 +10268,10 @@ func (c *Checker) checkPrefixUnaryExpression(node *ast.Node) *Type {
case ast.KindExclamationToken:
c.checkTruthinessOfType(operandType, expr.Operand)
facts := c.getTypeFacts(operandType, TypeFactsTruthy|TypeFactsFalsy)
switch {
case facts == TypeFactsTruthy:
switch facts {
case TypeFactsTruthy:
return c.falseType
case facts == TypeFactsFalsy:
case TypeFactsFalsy:
return c.trueType
default:
return c.booleanType
Expand Down Expand Up @@ -12490,10 +12483,10 @@ func (c *Checker) checkObjectLiteral(node *ast.Node, checkMode CheckMode) *Type
}
if ast.IsPropertyAssignment(memberDecl) || ast.IsShorthandPropertyAssignment(memberDecl) || ast.IsObjectLiteralMethod(memberDecl) {
var t *Type
switch {
case memberDecl.Kind == ast.KindPropertyAssignment:
switch memberDecl.Kind {
case ast.KindPropertyAssignment:
t = c.checkPropertyAssignment(memberDecl, checkMode)
case memberDecl.Kind == ast.KindShorthandPropertyAssignment:
case ast.KindShorthandPropertyAssignment:
var expr *ast.Node
if !inDestructuringPattern {
expr = memberDecl.AsShorthandPropertyAssignment().ObjectAssignmentInitializer
Expand Down Expand Up @@ -15638,7 +15631,7 @@ func (c *Checker) getBaseConstructorTypeOfClass(t *Type) *Type {
err := c.error(baseTypeNode.Expression(), diagnostics.Type_0_is_not_a_constructor_function_type, c.TypeToString(baseConstructorType))
if baseConstructorType.flags&TypeFlagsTypeParameter != 0 {
constraint := c.getConstraintFromTypeParameter(baseConstructorType)
var ctorReturn *Type = c.unknownType
ctorReturn := c.unknownType
if constraint != nil {
ctorSigs := c.getSignaturesOfType(constraint, SignatureKindConstruct)
if len(ctorSigs) != 0 {
Expand Down Expand Up @@ -17187,12 +17180,12 @@ func (c *Checker) getOptionalType(t *Type, isProperty bool) *Type {
// Add undefined or null or both to a type if they are missing.
func (c *Checker) getNullableType(t *Type, flags TypeFlags) *Type {
missing := (flags & ^t.flags) & (TypeFlagsUndefined | TypeFlagsNull)
switch {
case missing == 0:
switch missing {
case 0:
return t
case missing == TypeFlagsUndefined:
case TypeFlagsUndefined:
return c.getUnionType([]*Type{t, c.undefinedType})
case missing == TypeFlagsNull:
case TypeFlagsNull:
return c.getUnionType([]*Type{t, c.nullType})
}
return c.getUnionType([]*Type{t, c.undefinedType, c.nullType})
Expand Down Expand Up @@ -18616,7 +18609,7 @@ func (c *Checker) getReturnTypeFromBody(fn *ast.Node, checkMode CheckMode) *Type
var returnType *Type
var yieldType *Type
var nextType *Type
var fallbackReturnType *Type = c.voidType
fallbackReturnType := c.voidType
switch {
case !ast.IsBlock(body):
returnType = c.checkExpressionCachedEx(body, checkMode & ^CheckModeSkipGenericFunctions)
Expand Down Expand Up @@ -19627,7 +19620,7 @@ func (c *Checker) getUnionSignatures(signatureLists [][]*Signature) []*Signature
// nature and having overloads in multiple constituents would necessitate making a power set of signatures from the type, whose
// ordering would be non-obvious)
masterList := signatureLists[indexWithLengthOverOne]
var results []*Signature = slices.Clone(masterList)
results := slices.Clone(masterList)
for _, signatures := range signatureLists {
if !core.Same(signatures, masterList) {
signature := signatures[0]
Expand Down Expand Up @@ -27645,10 +27638,10 @@ func (c *Checker) getContextualTypeForArgument(callTarget *ast.Node, arg *ast.No

func (c *Checker) getContextualTypeForArgumentAtIndex(callTarget *ast.Node, argIndex int) *Type {
if ast.IsImportCall(callTarget) {
switch {
case argIndex == 0:
switch argIndex {
case 0:
return c.stringType
case argIndex == 1:
case 1:
return c.getGlobalImportCallOptionsType()
default:
return c.anyType
Expand Down Expand Up @@ -29043,10 +29036,10 @@ func (c *Checker) getGlobalNonNullableTypeInstantiation(t *Type) *Type {
}

func (c *Checker) convertAutoToAny(t *Type) *Type {
switch {
case t == c.autoType:
switch t {
case c.autoType:
return c.anyType
case t == c.autoArrayType:
case c.autoArrayType:
return c.anyArrayType
}
return t
Expand Down
2 changes: 1 addition & 1 deletion internal/checker/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,7 @@ func (c *Checker) getSwitchClauseTypeOfWitnesses(node *ast.Node) []string {

// Return the combined not-equal type facts for all cases except those between the start and end indices.
func (c *Checker) getNotEqualFactsFromTypeofSwitch(start int, end int, witnesses []string) TypeFacts {
var facts TypeFacts = TypeFactsNone
facts := TypeFactsNone
for i, witness := range witnesses {
if (i < start || i >= end) && witness != "" {
f, ok := typeofNEFacts[witness]
Expand Down
12 changes: 6 additions & 6 deletions internal/checker/grammarchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ func (c *Checker) checkGrammarBreakOrContinueStatement(node *ast.Node) bool {
panic(fmt.Sprintf("Unexpected node kind %q", node.Kind))
}

var current *ast.Node = node
current := node
for current != nil {
if ast.IsFunctionLikeOrClassStaticBlockDeclaration(current) {
return c.grammarErrorOnNode(node, diagnostics.Jump_target_cannot_cross_function_boundary)
Expand Down Expand Up @@ -1796,14 +1796,14 @@ func (c *Checker) checkGrammarForDisallowedBlockScopedVariableStatement(node *as
blockScopeKind := c.getCombinedNodeFlagsCached(node.DeclarationList) & ast.NodeFlagsBlockScoped
if blockScopeKind != 0 {
var keyword string
switch {
case blockScopeKind == ast.NodeFlagsLet:
switch blockScopeKind {
case ast.NodeFlagsLet:
keyword = "let"
case blockScopeKind == ast.NodeFlagsConst:
case ast.NodeFlagsConst:
keyword = "const"
case blockScopeKind == ast.NodeFlagsUsing:
case ast.NodeFlagsUsing:
keyword = "using"
case blockScopeKind == ast.NodeFlagsAwaitUsing:
case ast.NodeFlagsAwaitUsing:
keyword = "await using"
default:
panic("Unknown BlockScope flag")
Expand Down
6 changes: 3 additions & 3 deletions internal/checker/inference.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ func (c *Checker) inferToTemplateLiteralType(n *InferenceState, source *Type, ta
case left.flags&TypeFlagsBoolean != 0:
return left
case right.flags&TypeFlagsBoolean != 0:
switch {
case str == "true":
switch str {
case "true":
return c.trueType
case str == "false":
case "false":
return c.falseType
default:
return c.booleanType
Expand Down
2 changes: 1 addition & 1 deletion internal/checker/jsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ func (c *Checker) createJsxAttributesTypeFromAttributesProperty(openingLikeEleme
}
// We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement
if parent != nil && parent.AsJsxElement().OpeningElement == openingLikeElement && len(getSemanticJsxChildren(parent.AsJsxElement().Children.Nodes)) != 0 {
var childTypes []*Type = c.checkJsxChildren(parent, checkMode)
childTypes := c.checkJsxChildren(parent, checkMode)
if !hasSpreadAnyType && jsxChildrenPropertyName != ast.InternalSymbolNameMissing && jsxChildrenPropertyName != "" {
// Error if there is a attribute named "children" explicitly specified and children element.
// This is because children element will overwrite the value from attributes.
Expand Down
6 changes: 3 additions & 3 deletions internal/checker/relater.go
Original file line number Diff line number Diff line change
Expand Up @@ -4453,10 +4453,10 @@ func (r *Relater) constructorVisibilitiesAreCompatible(sourceSignature *Signatur
// See signatureAssignableTo, compareSignaturesIdentical
func (r *Relater) signatureRelatedTo(source *Signature, target *Signature, erase bool, reportErrors bool, intersectionState IntersectionState) Ternary {
checkMode := SignatureCheckModeNone
switch {
case r.relation == r.c.subtypeRelation:
switch r.relation {
case r.c.subtypeRelation:
checkMode = SignatureCheckModeStrictTopSignature
case r.relation == r.c.strictSubtypeRelation:
case r.c.strictSubtypeRelation:
checkMode = SignatureCheckModeStrictTopSignature | SignatureCheckModeStrictArity
}
if erase {
Expand Down
1 change: 1 addition & 0 deletions internal/checker/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ func (c *Checker) GetRootSymbols(symbol *ast.Symbol) []*ast.Symbol {
for _, root := range roots {
result = append(result, c.GetRootSymbols(root)...)
}
return result
Comment thread
jakebailey marked this conversation as resolved.
Outdated
}
return []*ast.Symbol{symbol}
}
Expand Down
1 change: 1 addition & 0 deletions internal/ls/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ func getCompletionData(program *compiler.Program, typeChecker *checker.Checker,
symbols = append(symbols, filteredMembers...)

// Set sort texts.
//nolint:staticcheck
transformObjectLiteralMembers := ptrIsTrue(preferences.IncludeCompletionsWithObjectLiteralMethodSnippets) &&
objectLikeContainer.Kind == ast.KindObjectLiteralExpression
for _, member := range filteredMembers {
Expand Down
6 changes: 3 additions & 3 deletions internal/packagejson/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ type PackageJson struct {

func (p *PackageJson) GetVersionPaths(trace func(string)) VersionPaths {
p.once.Do(func() {
if p.Fields.TypesVersions.Type == JSONValueTypeNotPresent {
if p.TypesVersions.Type == JSONValueTypeNotPresent {
if trace != nil {
trace(diagnostics.X_package_json_does_not_have_a_0_field.Format("typesVersions"))
}
return
}
if p.Fields.TypesVersions.Type != JSONValueTypeObject {
if p.TypesVersions.Type != JSONValueTypeObject {
if trace != nil {
trace(diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2.Format("typesVersions", "object", p.Fields.TypesVersions.Type.String()))
trace(diagnostics.Expected_type_of_0_field_in_package_json_to_be_1_got_2.Format("typesVersions", "object", p.TypesVersions.Type.String()))
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/parser/jsdoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ func (p *Parser) parseOptionalJsdoc(t ast.Kind) bool {
}

func (p *Parser) parseJSDocEntityName() *ast.EntityName {
var entity *ast.EntityName = p.parseJSDocIdentifierName(nil)
entity := p.parseJSDocIdentifierName(nil)
if p.parseOptional(ast.KindOpenBracketToken) {
p.parseExpected(ast.KindCloseBracketToken)
// Note that y[] is accepted as an entity name, but the postfix brackets are not saved for checking.
Expand Down
2 changes: 1 addition & 1 deletion internal/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6607,7 +6607,7 @@ func (p *Parser) processPragmasIntoFields(context *ast.SourceFile) {
case "ts-check", "ts-nocheck":
// _last_ of either nocheck or check in a file is the "winner"
for _, directive := range context.Pragmas {
if context.CheckJsDirective == nil || directive.TextRange.Pos() > context.CheckJsDirective.Range.Pos() {
if context.CheckJsDirective == nil || directive.Pos() > context.CheckJsDirective.Range.Pos() {
context.CheckJsDirective = &ast.CheckJsDirective{
Enabled: directive.Name == "ts-check",
Range: directive.CommentRange,
Expand Down
4 changes: 1 addition & 3 deletions internal/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,7 @@ func (p *Project) getRootFileWatchGlobs() []string {
for dir, recursive := range globs {
result = append(result, fmt.Sprintf("%s/%s", dir, core.IfElse(recursive, recursiveFileGlobPattern, fileGlobPattern)))
}
for _, fileName := range p.parsedCommandLine.LiteralFileNames() {
result = append(result, fileName)
}
result = append(result, p.parsedCommandLine.LiteralFileNames()...)
return result
}
return nil
Expand Down
6 changes: 2 additions & 4 deletions internal/scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1375,10 +1375,8 @@ func (s *Scanner) ScanJSDocToken() ast.Kind {

if IsIdentifierStart(ch, s.languageVersion) {
char := ch
for {
if s.pos >= len(s.text) {
break
}
for s.pos < len(s.text) {

char, size = s.charAndSize()
if !IsIdentifierPart(char, s.languageVersion) && char != '-' {
break
Expand Down
4 changes: 2 additions & 2 deletions internal/testutil/harnessutil/sourcemap_recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type writerAggregator struct {
}

func (w *writerAggregator) WriteStringF(format string, args ...any) {
w.WriteString(fmt.Sprintf(format, args...))
fmt.Fprintf(w, format, args...)
}

func (w *writerAggregator) WriteLine(s string) {
Expand Down Expand Up @@ -58,7 +58,7 @@ func (d *sourceMapDecoder) decodeNextEncodedSourceMapSpan() *decodedMapping {
sourceMapSpan: d.mappings.State(),
}
if mapping.error == nil {
mapping.error = errors.New("No encoded entry found")
mapping.error = errors.New("no encoded entry found")
}
return mapping
}
Expand Down
2 changes: 1 addition & 1 deletion internal/testutil/tsbaseline/error_baseline.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func iterateErrorBaseline(t *testing.T, inputFiles []*harnessutil.TestFile, inpu
var errLines []string
for _, line := range strings.Split(removeTestPathPrefixes(message, false), "\n") {
line = strings.TrimSuffix(line, "\r")
if len(line) < 0 {
if len(line) == 0 {
continue
}
out := fmt.Sprintf("!!! %s TS%d: %s", diag.Category().Name(), diag.Code(), line)
Expand Down
3 changes: 1 addition & 2 deletions internal/testutil/tsbaseline/sourcemap_baseline.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ func createSourceMapPreviewLink(sourceMap *harnessutil.TestFile, result *harness
return ""
}

var sourceTDs []*harnessutil.TestFile
////if len(sourcemapJSON.Sources) == len(inputsAndOutputs.Inputs) {
//// sourceTDs = inputsAndOutputs.Inputs
////} else {
sourceTDs = core.Map(sourcemapJSON.Sources, func(s string) *harnessutil.TestFile {
sourceTDs := core.Map(sourcemapJSON.Sources, func(s string) *harnessutil.TestFile {
return core.Find(result.Inputs(), func(td *harnessutil.TestFile) bool {
return strings.HasSuffix(td.UnitName, s)
})
Expand Down
Loading