Autofix JS var usage to favor let

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • DevProd Correctness
    • Fully Compatible
    • Correctness 2025-09-08
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Follow up to DEVPROD-17279.

      Enforce “no-var” rule using “let” and “const” (ES2015) instead of “var”.

      The “var” keyword is known to be a major source of confusion in JS development due to its subtle scoping and “hoisting” mechanics, and can have tricky consequences during troubleshooting and debugging. New code typically tends to use "let", although there is still broad usages of "var" before ES2015 was more accepted.

      This ticket is to apply all mechanical auto-fixes of that rule. There will be manual changes necessary before it can be enforced.

      Toggling the "no-var" rule, "npx eslint src/mongo jstests" finds:

      ✖ 9777 problems (9777 errors, 0 warnings)
        8754 errors and 0 warnings potentially fixable with the `--fix` option. 

            Assignee:
            Steve McClure
            Reporter:
            Steve McClure
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: