Gary Sieling

Visual Studio Code: Fixing ESLint says “Parsing error: The keyword ‘let’ is reserved.”

If you install the esline plugin in Visual Studio Code, you get weird errors:

ESLint says "Parsing error: The keyword 'let' is reserved."

To fix this, you need to set up a config file in the root of your project.

You can do this by running:

eslint --init

Here is an example file you can also use:

module.exports = {
    "env": {
        "es6": true
    },
    "extends": "eslint:recommended",
    "parserOptions": {
        "ecmaFeatures": {
            "experimentalObjectRestSpread": true,
            "jsx": true
        },
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
        "indent": [2, 2],
        "linebreak-style": [
            "error",
            "windows"
        ],
        "quotes": [
            "error",
            "double"
        ],
        "semi": [
            "error",
            "always"
        ]
    }
};
Exit mobile version