Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoBitwiseRule = rule.Rule{ Name: "no-bitwise", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { opts := parseOptions(options) report := func(node *ast.Node, opKind ast.Kind, rightOperand *ast.Node) { if !bitwiseOperatorKinds[opKind] { return } op := scanner.TokenToString(opKind) if opts.allow[op] { return } if opts.int32Hint && opKind == ast.KindBarToken && isZeroNumericLiteral(rightOperand) { return } ctx.ReportNode(node, buildUnexpectedMessage(op)) } return rule.RuleListeners{ ast.KindBinaryExpression: func(node *ast.Node) { binary := node.AsBinaryExpression() if binary == nil || binary.OperatorToken == nil { return } report(node, binary.OperatorToken.Kind, binary.Right) }, ast.KindPrefixUnaryExpression: func(node *ast.Node) { prefix := node.AsPrefixUnaryExpression() if prefix == nil { return } report(node, prefix.Operator, nil) }, } }, }
NoBitwiseRule disallows bitwise operators. https://eslint.org/docs/latest/rules/no-bitwise
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.