DEV Community

Sathish
Sathish

Posted on • Edited on

3 1

How to set ecmaScript version in .eslintrc.yml?

Top comments (2)

Collapse
 
rhymes profile image
rhymes • Edited

Something like this?

This is for ES6

{
  "extends": "airbnb-base",
  "parserOptions": {
    "ecmaVersion": 6,
    "ecmaFeatures": {
      "impliedStrict": true
    }
  },
  "env": {
    "browser": true,
    "es6": true
  }
}

This is for ES5

{
  "extends": "eslint:recommended",
  "parserOptions": {
    "ecmaVersion": 5,
    "ecmaFeatures": {
      "impliedStrict": true
    }
  },
  "env": {
    "browser": true
  }
}

I have an old project with mixed ES5 and ES6 files and they are linted by different .eslintrc.json, with something like this:

eslint --fix --color --config .eslintrc.es5.json
Collapse
 
sathish profile image
Sathish

The main problem is that the eslint config file is a yml file which is autocreated by yeoman. I couldn't use async await with that config.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay