/cursor-tutorials

How to make Cursor use modern JavaScript syntax

Learn how to make Cursor adopt modern JavaScript syntax with simple steps that boost code clarity, efficiency, and compatibility in your projects.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to make Cursor use modern JavaScript syntax

To make Cursor use modern JavaScript syntax, you don’t actually “enable” it inside Cursor itself. Cursor uses whatever JavaScript version your project is configured for. So the real work is making sure your local environment, your Node version, and your project configs (like package.json, .babelrc, or tsconfig.json if using TypeScript) tell the editor and language server that you want modern JS. Once those are set, Cursor automatically understands and suggests modern syntax because it reads the project config just like VS Code does.

 

Why Cursor Sometimes Suggests Older Syntax

 

Cursor doesn’t decide the JS version on its own. It looks at:

  • Your installed Node.js version
  • Your project’s package.json “type” field
  • Your Babel config if you're using Babel
  • Your ESLint config if you're using ESLint

If these indicate older syntax, Cursor plays it safe and sticks to older patterns. If they indicate modern syntax (ES Modules, async/await, arrow functions, optional chaining…), Cursor follows that modern style.

 

Step-by-Step: Make Cursor Use Modern JavaScript Syntax

 

Below is the actual, real way to force Cursor to behave like a modern JS project.

  • Use a modern Node.js version locally
    Cursor relies on your local tools. Check your Node version:
node -v
  • If it's old (like Node 12/14), update to Node 18 or 20. Cursor recognizes modern language features only if your environment supports them.
  • Tell Node you’re using modern ES Modules
    Add this to your package.json:
{
  "type": "module"
}
  • This enables modern import/export syntax without Babel.
  • Enable modern syntax rules in ESLint (optional but helpful)
    If you’re using ESLint, confirm your config allows ES2020+ features:
{
  "env": {
    "es2021": true,
    "node": true
  }
}
  • Cursor’s autocomplete reads this and becomes more confident about using async/await, classes, arrow functions, and optional chaining.
  • If using Babel, set your preset to @babel/preset-env
    A basic working .babelrc that enables modern syntax:
{
  "presets": ["@babel/preset-env"]
}
  • This tells Cursor you’re not restricted to old ES5 code.
  • Make sure your files use .js or .mjs extensions
    .mjs automatically signals ES Modules to Node.
  • Provide examples inside the project
    Cursor learns from your project. If you use modern syntax in some files, Cursor starts suggesting it everywhere.

 

Examples of Modern JavaScript Syntax Cursor Will Then Suggest

 

import express from "express" // modern ESM import

const app = express()

app.get("/api", async (req, res) => {
  const data = await fetch("https://example.com").then(r => r.json()) // async/await
  res.send({ message: data?.title }) // optional chaining
})

 

The Core Idea

 

Cursor is not the gatekeeper — your project configuration is. Once your environment and config files tell the language server “Yes, this project uses modern JS,” Cursor fully switches to suggesting and generating modern syntax automatically.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022