question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

object-property-newline has problems with the experimental object rest spread feature

See original GitHub issue

What version of ESLint are you using? 2.10.2 What parser (default, Babel-ESLint, etc.) are you using? default, Babel-ESLint - both don’t work Please show your full configuration:

parserOptions: {
  ecmaVersion: 6,
  ecmaFeatures: {
    experimentalObjectRestSpread: true
  }
}

What did you do? Please include the actual source code causing the issue.

var obj = { k1: 'val1', k2: 'val2', ...{} };

What did you expect to happen? No errors. What actually happened? Please include the actual, raw output from ESLint.

TypeError: Cannot read property 'range' of undefined
      at SourceCode.api.getFirstToken (D:\Projects\eslint\lib\token-store.js:9:3834)
      at EventEmitter.ObjectExpression (D:\Projects\eslint\lib\rules\object-property-newline.js:9:2164)
      at NodeEventGenerator.enterNode (D:\Projects\eslint\lib\util\node-event-generator.js:9:359)
      at CodePathAnalyzer.enterNode (D:\Projects\eslint\lib\code-path-analysis\code-path-analyzer.js:9:23334)
      at CommentEventGenerator.enterNode (D:\Projects\eslint\lib\util\comment-event-generator.js:9:2024)
      at Controller.traverser.traverse.enter (D:\Projects\eslint\lib\eslint.js:9:32865)
      at Controller.__execute (D:\Projects\eslint\node_modules\estraverse\estraverse.js:397:31)
      at Controller.traverse (D:\Projects\eslint\node_modules\estraverse\estraverse.js:501:28)
      at Controller.Traverser.controller.traverse (D:\Projects\eslint\lib\util\traverser.js:9:626)
      at EventEmitter.module.exports.api.verify (D:\Projects\eslint\lib\eslint.js:9:32670)
      at runRuleForItem (D:\Projects\eslint\lib\testers\rule-tester.js:9:9027)
      at testValidTemplate (D:\Projects\eslint\lib\testers\rule-tester.js:9:9669)
      at Context.<anonymous> (D:\Projects\eslint\lib\testers\rule-tester.js:9:14513)
      at callFn (D:\Projects\eslint\node_modules\mocha\lib\runnable.js:315:21)
      at Test.Runnable.run (D:\Projects\eslint\node_modules\mocha\lib\runnable.js:308:7)
      at Runner.runTest (D:\Projects\eslint\node_modules\mocha\lib\runner.js:422:10)
      at D:\Projects\eslint\node_modules\mocha\lib\runner.js:533:12
      at next (D:\Projects\eslint\node_modules\mocha\lib\runner.js:342:14)
      at D:\Projects\eslint\node_modules\mocha\lib\runner.js:352:7
      at next (D:\Projects\eslint\node_modules\mocha\lib\runner.js:284:14)
      at Immediate._onImmediate (D:\Projects\eslint\node_modules\mocha\lib\runner.js:320:5)

I’d like to try and fix this, if that’s ok. I’ve already started setting up some tests and reading the code.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
markelogcommented, May 20, 2016

I definitely do

1reaction
markelogcommented, May 18, 2016

@vitorbal oh sorry confused disallow and require rules, yeah it doesn’t

Read more comments on GitHub >

github_iconTop Results From Across the Web

object-property-newline - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Spread operator and EsLint - javascript - Stack Overflow
Try adding "experimentalObjectRestSpread": true to "ecmaFeatures" . – ideaboxer. Jul 15, 2017 at 17:16. Add a comment ...
Read more >
@babel/plugin-proposal-object-rest-spread - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
Read more >
ESLint 1.0.0-rc-3 released - ESLint中文文档
As special note about object rest/spread: We added this as a result of feedback that ... Keep in mind that this feature is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found