no_sequences

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoSequencesRule = rule.Rule{
	Name: "no-sequences",
	Run: func(ctx rule.RuleContext, rawOptions any) rule.RuleListeners {
		opts := parseOptions(rawOptions)

		return rule.RuleListeners{
			ast.KindBinaryExpression: func(node *ast.Node) {
				if !isCommaBinary(node) {
					return
				}

				parent, child, parenDepth := walkUpSkippingParens(node)

				if isCommaBinary(parent) {
					return
				}

				if isForInitOrUpdate(parent, child) {
					return
				}

				if opts.allowInParentheses {
					required := 1
					if isGrammarParenArrowBody(parent, child) {

						required = 2
					}
					if parenDepth >= required {
						return
					}
				}

				commaToken := firstCommaToken(node)
				if commaToken == nil {
					return
				}
				ctx.ReportRange(
					utils.TrimNodeTextRange(ctx.SourceFile, commaToken),
					rule.RuleMessage{
						Id:          "unexpectedCommaExpression",
						Description: "Unexpected use of comma operator.",
					},
				)
			},
		}
	},
}

https://eslint.org/docs/latest/rules/no-sequences

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL