Avoid Unintended Global Variables

< 1 min read

Impact Area

Manageability

Severity

High

Affected Element

Lightning

Rule ID #

SF-0057

Impact #

Omitting the var keyword from a variable definition within a method creates the variable in the global scope, which clutter up the global namespace and make the code slower.

Time to fix #

45 min

Remediation #

Always use the var keyword to declare local variables.

References #

See the PMD documentation article: GlobalVariable.

Updated on March 21, 2025
Was it helpful ?