1

In VS Code editor the JSHint tells me that code below has an error.

const pageSubpartsComponents = {
    'page-header': PageHeader,
    'page-footer': PageFooter
};

const routes = [{
    path: '/',
    components: {
        default: DefaultLayout,
        ...pageSubpartsComponents
    }
}];

...pageSubpartsComponents has text correction. The error I get is:

[jshint] Expected '}' to match '{' from line 6 and instead saw 'pageSubpartsComponents'. (E020)

I have .jshintrc file and inside this code:

{
    "esversion": 6
}

I know that rest/spread operator is not part of the ES6 but it doesn't allows me to use higher version of ES.

  • VS Code v 1.25.0-insider
  • jshint v 0.10.19

What else should I use? Does anyone solve this already?

quarky
  • 710
  • 2
  • 13
  • 36
  • [`...` is not an operator!](https://stackoverflow.com/questions/37151966/what-is-spreadelement-in-ecmascript-documentation-is-it-the-same-as-spread-oper/37152508#37152508) – Felix Kling Jun 12 '18 at 00:13
  • Without seeing the full error and the code to trigger it, I'm not sure how you expect to get a helpful error. Please provide enough information for someone to reproduce the problem. Is it an object rest/spread that is failing? – loganfsmyth Jun 12 '18 at 00:58
  • 1
    I don't use _jshint_, however there remains an open [issue](https://github.com/jshint/jshint/issues/2991) in the projects repo for _spread_. As a workaround, maybe you'll need to add an [inline configuration](http://jshint.com/docs/) comment such as `// jshint ignore:line` (that's assuming it's not an actual code error per se) – RobC Jun 12 '18 at 08:11

0 Answers0