New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to indent rule for empty blocks in eslint@1 #3279

Closed
pdehaan opened this Issue Aug 5, 2015 · 2 comments

Comments

Projects
None yet
4 participants
@pdehaan
Contributor

pdehaan commented Aug 5, 2015

Previously we had code similar to this dummy code below and it looks and linted fine in eslint@0.24.x. Since moving to eslint@1 (awesome work, btw!) it seems like we're getting a few rogue errors like:

"Expected indentation of 4 characters but found 6"


dummy.js

/*eslint-env node */

var p = {};

var obj = {
  foo: function () {
    return new p()
      .then(function (ok) {
        return ok;
      }, function () {
        // ignore things
      });
  }
};
console.log(obj);

.eslintrc

{
  "extends": "eslint:recommended",
  "rules": {
    "handle-callback-err": 0,
    "no-console": 0,
    "strict": [2, "never"],
    "indent": [2, 2]
  }
}

Output:

➜  fxa-esl1 git:(devdeps44) ✗ npm run lint

> fxa-content-server@0.43.0 lint /Users/pdehaan/dev/tmp/del/fxa-esl1
> eslint dummy.js


dummy.js
  12:8  error  Expected indentation of 4 characters but found 6  indent

✖ 1 problem (1 error, 0 warnings)

Workaround:

If I'm understanding this correctly, this seems to be because my "ignore things" function is an empty block and doesn't have any statements. If I change that to return; then the eslint dummy.js succeeds.

@gyandeeps

This comment has been minimized.

Show comment
Hide comment
@gyandeeps

gyandeeps Aug 5, 2015

Member

Multiline is a known issue.
Kinda related #1801

Member

gyandeeps commented Aug 5, 2015

Multiline is a known issue.
Kinda related #1801

@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Aug 5, 2015

Member

@gyandeeps so is this a new bug? Or is it covered by another issue?

Member

nzakas commented Aug 5, 2015

@gyandeeps so is this a new bug? Or is it covered by another issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.