JavaScript Async/Await .eslintrc.js

Published on:

The new Async/Await is nice.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function

Here's an ESlint configuration file that supports it. Key bits are

  • plugins: ['async-await']
  • ecmaVersion: 2017

.eslintrc.js

module.exports = {
  plugins: ['async-await'],
  env: {
    es6: true,
    node: true
  },
  extends: 'eslint:recommended',
  parserOptions: {
    sourceType: 'module',
    ecmaVersion: 2017,
  },
  rules: {
    'comma-dangle': ['error', {
      arrays: 'never',
      objects: 'never',
      imports: 'never',
      exports: 'never',
      functions: 'ignore'
    }],
    'no-console': 0,
    indent: [
      'error',
      2
    ],
    'linebreak-style': [
      'error',
      'unix'
    ],
    quotes: [
      'error',
      'single'
    ],
    semi: [
      'error',
      'always'
    ]
  }
};