Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RequireAtomicUpdatesRule = rule.Rule{ Name: "require-atomic-updates", RequiresTypeInfo: true, Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { allowProperties := false optsMap := utils.GetOptionsMap(options) if optsMap != nil { if v, ok := optsMap["allowProperties"]; ok { if b, ok := v.(bool); ok { allowProperties = b } } } enterFunction := func(node *ast.Node) { flags := ast.GetFunctionFlags(node) if flags&(ast.FunctionFlagsAsync|ast.FunctionFlagsGenerator) == 0 { return } a := newAnalyzer(ctx, node, allowProperties) a.run() } return rule.RuleListeners{ ast.KindFunctionDeclaration: enterFunction, ast.KindFunctionExpression: enterFunction, ast.KindArrowFunction: enterFunction, ast.KindMethodDeclaration: enterFunction, ast.KindGetAccessor: enterFunction, ast.KindSetAccessor: enterFunction, } }, }
RequireAtomicUpdatesRule disallows assignments that can lead to race conditions due to usage of `await` or `yield`.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.