Eslint, how to accept const and arrow function in Javascript?

后端 未结 1 1080
天涯浪人
天涯浪人 2021-01-22 20:55

This is probably somewhere around, but I simply can not find the answer.

Below is my eslint config file, but it doesn\'t accept const and arrow functions. How to change

相关标签:
1条回答
  • 2021-01-22 21:40

    From eslint docs:

    To address: If you are using any ECMAScript 6 feature flags in ecmaFeatures, you’ll need to use ecmaVersion: 6 instead. The ECMAScript 6 feature flags are:

    arrowFunctions - enable arrow functions

    binaryLiterals - enable binary literals

    blockBindings - enable let and const (aka block bindings)

    // In your .eslintrc
    {
        env: {
            es6: true
        }
    }
    
    // Or in a configuration comment
    /*eslint-env es6*/
    

    esLint there are a lot of examples

    Hope it will help you

    0 讨论(0)
提交回复
热议问题