1

I have this piece of code:

sendMessage(message) {
    let data = {
        message
    };
    this.socket.send('message', data);
}

I'm using eslint and set the object-shorthand rule.

    "object-shorthand": [
        2,
        "always"
    ],

And get this error:

  ---
  message: 'Unexpected token }'
  severity: error
  data:
    line: 39
    column: 14
    ruleId: ''
  ...

But why? Any other way to find what rule is being violated?

If I do this:

sendMessage(message) {
    let data = {
        message: message
    };
    this.socket.send('message', data);
}

I get this:

  ---
  message: Expected property shorthand.
  severity: error
  data:
    line: 38
    column: 17
    ruleId: object-shorthand
  ...

It's clear what's wrong. Great.

So, how can I find what's going on? eslint is asking for object shorthands (as I told it to) but it is not accepting them... For some other reason?

Having these errors showing up all the time is distracting.

Any help is highly appreciated.

(I'm using the latest gulp-eslint: 1.0.0)

slacktracer
  • 6,262
  • 6
  • 28
  • 33

1 Answers1

1

My guess is that the fact that eslint says ruleId: '' points to a bug in eslint, not in your code. You should

  1. search in eslint's open issues (I have tried, but found nothing)
  2. if this bug is not reported, produce a minimal code displaying the bug (sorry, I don't have the time to setup things to do so myself)
  3. if successful, open a new issue
Walter Tross
  • 12,237
  • 2
  • 40
  • 64