Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoNewObjectRule = rule.Rule{ Name: "no-new-object", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { return rule.RuleListeners{ ast.KindNewExpression: func(node *ast.Node) { callee := node.Expression() if callee == nil { return } unwrapped := ast.SkipOuterExpressions(callee, ast.OEKParentheses|ast.OEKAssertions) if unwrapped.Kind != ast.KindIdentifier || unwrapped.Text() != "Object" { return } if utils.IsShadowed(unwrapped, "Object") { return } ctx.ReportNode(node, rule.RuleMessage{ Id: "preferLiteral", Description: "The object literal notation {} is preferable.", }) }, } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.