Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoUndefRule = rule.Rule{ Name: "no-undef", RequiresTypeInfo: true, Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { opts := parseOptions(options) if ctx.TypeChecker == nil { return rule.RuleListeners{} } declaredGlobals := parseGlobalComments(ctx.SourceFile.Text()) return rule.RuleListeners{ ast.KindIdentifier: func(node *ast.Node) { if shouldSkip(node, opts.checkTypeof) { return } if node.Parent.Kind == ast.KindShorthandPropertyAssignment { valueSym := ctx.TypeChecker.GetShorthandAssignmentValueSymbol(node.Parent) if valueSym != nil { return } } else { sym := ctx.TypeChecker.GetSymbolAtLocation(node) if sym != nil { return } } name := node.Text() if declaredGlobals[name] { return } ctx.ReportNode(node, rule.RuleMessage{ Id: "undef", Description: fmt.Sprintf("'%s' is not defined.", name), }) }, } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.