Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

233
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda