no_ex_assign

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoExAssignRule = rule.Rule{
	Name: "no-ex-assign",
	Run: func(ctx rule.RuleContext, options any) rule.RuleListeners {
		return rule.RuleListeners{
			ast.KindCatchClause: func(node *ast.Node) {
				if node.AsCatchClause().VariableDeclaration == nil {
					return
				}

				varDecl := node.AsCatchClause().VariableDeclaration.AsVariableDeclaration()
				if varDecl == nil || varDecl.Name() == nil {
					return
				}

				block := node.AsCatchClause().Block
				if block == nil {
					return
				}

				names, symbols := collectCatchBindingNamesAndSymbols(varDecl.Name(), ctx)
				checkReassignments(block, names, symbols, ctx)
			},
		}
	},
}

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