Skip to content

Commit d05a73c

Browse files
authored
fix: skip everything if there's no rule (#271)
1 parent 0604338 commit d05a73c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/linter/linter.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,17 @@ func RunLinterInProgram(program *compiler.Program, allowFiles []string, skipFile
5252
}
5353
}
5454
lintedFileCount++
55-
comments := make([]*ast.CommentRange, 0)
56-
utils.ForEachComment(&file.Node, func(comment *ast.CommentRange) { comments = append(comments, comment) }, file)
5755

5856
registeredListeners := make(map[ast.Kind][](func(node *ast.Node)), 20)
5957
{
6058
rules := getRulesForFile(file)
59+
if len(rules) == 0 {
60+
continue
61+
}
62+
63+
comments := make([]*ast.CommentRange, 0)
64+
utils.ForEachComment(&file.Node, func(comment *ast.CommentRange) { comments = append(comments, comment) }, file)
65+
6166
// Create disable manager for this file
6267
disableManager := rule.NewDisableManager(file, comments)
6368

0 commit comments

Comments
 (0)