Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
Prettier supports for Optional chaining (?.)

In my JavaScript React App I am using prettier for code formatting.

My current rules are working as expected. I saw that Prettier supports also Optional chaining, but when I run prettier --write that does not change for example user.info.name into user?.info?.name

Does someone have an idea what is the problem here?

Here is my .prettierrc:

module.exports = {
  trailingComma: "none",
  tabWidth: 2,
  semi: true,
  printWidth: 120,
  arrowParens: "avoid"
};

Version - "prettier": "2.1.2"

I am using Webstorm IDE

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prettier doesn't make make changes that would alter the behavior of your code. Adding in optional chaining everywhere you access object properties would change the behavior, and isn't even desirable, so they don't do that. When prettier says they support optional chaining, they just mean that prettier can parse code that uses optional chaining, instead of throwing exceptions that the syntax isn't recognized.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!