Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

eslint-plugin-one-variable-per-var

0.0.3 • Public • Published

Build Status

eslint-plugin-one-variable-per-var

ESLint rule for enforcing one variable per var statement

Why Use It

You like consistency

Here are 3 consistent lines

var a = 1;
var b = 2;
var c = 3;

Here are 3 inconsistent lines

var a = 1,
    b = 2,
    c = 3;

The first line has a var and ends with a comma, the second line has no var and ends with a comma, the 3rd line has no var and ends with a semicolon. That's not consistent.

Further, copying, cutting, pasting in other variables requires more editing in the inconsistent case and requires having to deal with lines other than the ones you're editing. If I add d as a var I should not have to care about the line c is on. In the consistent case each line has no dependecnes. In inconsistent case each line is dependent on 1 or more other lines.

Further Reading

Install

npm i eslint-plugin-one-variable-per-var

DownloadsWeekly Downloads

176

Version

0.0.3

License

MIT

Last publish

Collaborators

  • avatar