Skip to content
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

Bug: ObjectRestSpread throws error in key-spacing rule #4763

Closed
zaygraveyard opened this Issue Dec 21, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@zaygraveyard
Copy link
Contributor

zaygraveyard commented Dec 21, 2015

What version are you using?
eslint@1.10.3

What did you do?

echo "({...x})" | eslint --stdin

.eslintrc

{
  "ecmaFeatures": {
    "experimentalObjectRestSpread": true
  },
  "env": {
    "es6": true
  },
  "rules": {
    "key-spacing": [2, { "align": "colon" }]
  }
}

What happened?

/tmp/test/node_modules/eslint/lib/rules/key-spacing.js:176
        return endToken.range[1] - startToken.range[0];
                       ^

TypeError: Cannot read property 'range' of undefined
    at getKeyWidth (/tmp/test/node_modules/eslint/lib/rules/key-spacing.js:176:24)
    at Array.map (native)
    at verifyGroupAlignment (/tmp/test/node_modules/eslint/lib/rules/key-spacing.js:228:33)
    at /tmp/test/node_modules/eslint/lib/rules/key-spacing.js:262:13
    at Array.forEach (native)
    at verifyAlignment (/tmp/test/node_modules/eslint/lib/rules/key-spacing.js:261:28)
    at EventEmitter.ObjectExpression (/tmp/test/node_modules/eslint/lib/rules/key-spacing.js:303:21)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:169:7)
    at NodeEventGenerator.enterNode (/tmp/test/node_modules/eslint/lib/util/node-event-generator.js:42:22)

What did you expect to happen?

No errors

Note

I have already written a fix (will send PR after this issue gets accepted).
But since support for object rest spread is still "experimental", you might consider its too early for it.
So let me know if should propose it at https://github.com/babel/eslint-plugin-babel

@eslintbot

This comment has been minimized.

Copy link

eslintbot commented Dec 21, 2015

@zaygraveyard Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

@eslintbot eslintbot added the triage label Dec 21, 2015

zaygraveyard added a commit to zaygraveyard/eslint that referenced this issue Dec 21, 2015

Merge branch 'issue4763'
* issue4763:
  Fix: ObjectRestSpread throws error in key-spacing rule (fixing eslint#4763)
  Docs: Typo in no-unexpected-multiline (fixes eslint#4756)

@ilyavolodin ilyavolodin added bug rule accepted and removed triage labels Dec 21, 2015

zaygraveyard added a commit to zaygraveyard/eslint that referenced this issue Dec 22, 2015

Merge branch 'issue4763'
* issue4763:
  Fix: ObjectRestSpread throws error in key-spacing rule (fixes eslint#4763)

@btmills btmills closed this in b1ffffe Dec 23, 2015

btmills added a commit that referenced this issue Dec 23, 2015

Merge pull request #4770 from zaygraveyard/issue4763
Fix: ObjectRestSpread throws error in key-spacing rule (fixes #4763)

@eslint eslint bot locked and limited conversation to collaborators Feb 6, 2018

@eslint eslint bot added the archived due to age label Feb 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.