Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoUnsafeUnaryMinusRule = rule.CreateRule(rule.Rule{ Name: "no-unsafe-unary-minus", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { return rule.RuleListeners{ ast.KindPrefixUnaryExpression: func(node *ast.Node) { expr := node.AsPrefixUnaryExpression() if expr.Operator != ast.KindMinusToken { return } argType := utils.GetConstrainedTypeAtLocation(ctx.TypeChecker, expr.Operand) for _, t := range utils.UnionTypeParts(argType) { if !utils.IsTypeFlagSet(t, checker.TypeFlagsAny|checker.TypeFlagsNever|checker.TypeFlagsBigIntLike|checker.TypeFlagsNumberLike) { ctx.ReportNode(node, buildUnaryMinusMessage(ctx.TypeChecker.TypeToString(t))) break } } }, } }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.