Skip to content

eslint/sort-vars Pedantic

🚧 An auto-fix is still under development.

What it does

When declaring multiple variables within the same block, sorting variable names make it easier to find necessary variable easier at a later time.

Why is this bad?

Unsorted variable declarations can make the code harder to read and maintain.

Examples

Examples of incorrect code for this rule:

js
var b, a;
var a, B, c;

Examples of correct code for this rule:

js
var a, b, c, d;
var B, a, c;

References

Released under the MIT License.