aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-11 11:14:30 +0000
committerFuwn <[email protected]>2026-02-11 11:14:30 +0000
commit2d0a6ba5fc5fcdd8a9fcf4e7121ed62072fbc4f9 (patch)
treefe277ba5475480fd38e44a6866bb1c2c70cb633d
parentfeat: Support JSON configuration file (diff)
downloadiku-2d0a6ba5fc5fcdd8a9fcf4e7121ed62072fbc4f9.tar.xz
iku-2d0a6ba5fc5fcdd8a9fcf4e7121ed62072fbc4f9.zip
style: Fix lint warnings
-rw-r--r--adapter_ecmascript.go9
-rw-r--r--engine/engine.go6
2 files changed, 5 insertions, 10 deletions
diff --git a/adapter_ecmascript.go b/adapter_ecmascript.go
index 29f99b7..78117ea 100644
--- a/adapter_ecmascript.go
+++ b/adapter_ecmascript.go
@@ -127,13 +127,8 @@ func classifyEcmaScriptStatement(trimmedLine string) (string, bool, bool) {
classified = classified[7:]
}
- if strings.HasPrefix(classified, "async ") {
- classified = classified[6:]
- }
-
- if strings.HasPrefix(classified, "declare ") {
- classified = classified[8:]
- }
+ classified = strings.TrimPrefix(classified, "async ")
+ classified = strings.TrimPrefix(classified, "declare ")
switch {
case ecmaScriptStatementHasPrefix(classified, "function"):
diff --git a/engine/engine.go b/engine/engine.go
index 6f7b7a0..fc574a5 100644
--- a/engine/engine.go
+++ b/engine/engine.go
@@ -54,17 +54,17 @@ func (e *Engine) format(events []LineEvent, resultBuilder *strings.Builder) {
if hasWrittenContent && !previousWasOpenBrace && !event.IsClosingBrace && !event.IsCaseLabel && !event.IsContinuation {
if currentIsTopLevel && previousWasTopLevel && currentStatementType != previousStatementType {
- if !(e.CommentMode == CommentsFollow && previousWasComment) {
+ if e.CommentMode != CommentsFollow || !previousWasComment {
needsBlankLine = true
}
} else if event.HasASTInfo && (currentIsScoped || previousWasScoped) {
if e.GroupSingleLineScopes && currentIsSingleLineScope && previousWasSingleLineScope && currentStatementType == previousStatementType {
needsBlankLine = false
- } else if !(e.CommentMode == CommentsFollow && previousWasComment) {
+ } else if e.CommentMode != CommentsFollow || !previousWasComment {
needsBlankLine = true
}
} else if currentStatementType != "" && previousStatementType != "" && currentStatementType != previousStatementType {
- if !(e.CommentMode == CommentsFollow && previousWasComment) {
+ if e.CommentMode != CommentsFollow || !previousWasComment {
needsBlankLine = true
}
}