-
Notifications
You must be signed in to change notification settings - Fork 362
Description
I have ESLint extension 1.0.7 with VSCode 1.6.0 in win10 x64
and ESLint 3.7.1 globally installed.
First of all, please note that since ESLint 2.9.0:
when you use the --fix option, ESLint will make multiple passes over your code in an attempt to fix as many issues as possible.
Let's say I have the following .eslintrc.js in C:\Users\Kostas:
module.exports = {
"env": {
"browser": true,
"es6": true,
"greasemonkey": true,
"jquery": true
},
"extends": "eslint:recommended",
"rules": {
"indent": ["error","tab"],
}
};
Now, I have this Javascript file:
var localTimezone;
function convertDates(f) {
if (f === 'f1') {
format = 'DD.MM.YYYY HH:mm';
} else {
format = 'MMMM DD, YYYY';
}
}
If I do eslint --fix myfile.js via CLI (a single time) it will be fixed into:
var localTimezone;
function convertDates(f) {
if (f === 'f1') {
format = 'DD.MM.YYYY HH:mm';
} else {
format = 'MMMM DD, YYYY';
}
}
But, in VSCode the ``Eslint: Fix all auto-fixable problems` command doesn't fix all indentation at once:
executing it the first time will only fix indentation on line 3,
a second time fixes lines 4 + 9,
and finally a 3rd time fixes lines 5-8,
i.e. it requires multiple (3) executions.
For reference, in Atom with linter 1.11.18 and linter-eslint 8.0.0 using my global ESLint installation as well,
with the relevant command (Linter eslint: Fix File) all indentation is fixed with a single execution.