Inter 🌐 Media

  • Home
  • Blog
  • Portfolio
  • Services
  • Contact

Inter 🌐 Media

  • Home
  • Blog
  • Portfolio
  • Services
  • Contact

How to enable async await in a Node.js/Express application with ESLint

November 27th, 2020

2 minute read 📗
  • Link to How to enable async await in a Node.js/Express application with ESLint

I was going through the final project for the course I am teaching at CityTech called Dynamic Web 1 which includes covering Modern Javascript and introduces Node.js, environment variables, .dotenv, ESLint rules, APIs, API keys, and how to protect them, the creation of local scripts in package.json, the EJS templating engine for Express.js, and async/await.

As I was writing the documentation for building the application, I noticed that there was an ESLint error regarding a couple of arrow functions I was using. I couldn’t understand at first how that could be the case, but after further investigation, I realized it was not the arrow function that was causing the error, but implementation of async/await itself.

async/await was introduced to JavaScript in ES2017. Since I did not include that in my ESLint config, the use of async/await using ESLint threw&& an **error.

I had to add the following property to the "parserOptions" object within in my eslintrc.json file in order to make that error go away:

"parserOptions": {
    "ecmaVersion": 2017,
    "sourceType": "script"
},

And that was it!

I will be embedding this episode of Plugging in The Holes along with a transcript in the form of a post on interglobalmedianetwork.com for your hearing and reading pleasure. Bye for now!

Related Resources

  • need a correct eslintrc for async/await - using 7.6+ nodejs
Tagged in: linters eslint async-await nodejs expressjs
Categorized under: linters
Discuss On Twitter
  • Twitter
  • Linkedin
Maria D. Campbell

Created by Maria D. Campbell who lives and works in New York City building useful things. You should follow her on Twitter. She also has a developer blog mariadcampbell.com you may want to check out!

  • ← Newer
  • Older →
  • Business Hours
  • Monday: 9:00am - 5:00pm
  • Tuesday: 9:00am - 5:00pm
  • Wednesday: 9:00am - 5:00pm
  • Thursday: 9:00am - 5:00pm
  • Friday: 9:00am - 5:00pm
  • Saturday: Closed
  • Sunday: Closed
  • And By Appointment
  • Podast
  • Plugging In The Holes
  • Login
  • Admin Login
  • follow us on Github
  • follow us on Twitter
  • connect with us on Instagram
  • connect with us on Linkedin
ContactSitemapRSS
© 2020 Inter-Global Media Network, Inc.