eslint: error Parsing error: The keyword 'const' is reserved

后端 未结 6 1156
余生分开走
余生分开走 2020-12-12 15:04

I am getting this error from ESLint:

error  Parsing error: The keyword \'const\' is reserved

from

6条回答
  •  醉梦人生
    2020-12-12 15:42

    I had this same problem with this part of my code:

    const newComment = {
        dishId: dishId,
        rating: rating,
        author: author,
        comment: comment
    };
    newComment.date = new Date().toISOString();
    

    Same error, const is a reserved word.

    The thing is, I made the .eslintrc.js from the link you gave in the update and still got the same error. Also, I get an parsing error in the .eslintrc.js: Unexpected token ':'.

    Right in this part:

    "env": {
    "browser": true,
    "node": true,
    "es6": true
    },
    
    ...
    

提交回复
热议问题