jscs-dev/node-jscs

validateIndentation ignores disallowMixedSpacesAndTabs setting

JonathanGawrych opened this issue · 1 comments

Take for example the following config:

{
    "validateIndentation": "\t",
    "disallowMixedSpacesAndTabs": false
}

(or if disallowMixedSpacesAndTabs is "smart")

And the following test file:

if (true) {
\t  console.log(true &&
\t  ············false);
}

where \t`` `` is a tab, and· is a space, validateIndentation ignores disallowMixedSpacesAndTabs and throws an error "Invalid indentation character:". Turning on disallowMixedSpacesAndTabs throws 2 errors (one for each).

Correct me if I'm wrong, but isn't validateIndentation throwing false positives? Prior to d0c70f1 (which looks like a complete rewrite of validateIndentation) it wouldn't. Removing validate-indentation.js#L500-L506 seems to fix these problems and passes a npm test (however those mixed tab-spaces lines are not validated for indentation anymore, I believe). Thanks

false is indented, but with spaces, when you want tabs. There is and there were many issues with indentation rules, but this is not one of them