Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve double quotes in JSX with deno fmt #26782

Open
AliReza99 opened this issue Nov 8, 2024 · 3 comments
Open

Preserve double quotes in JSX with deno fmt #26782

AliReza99 opened this issue Nov 8, 2024 · 3 comments
Labels
deno fmt Related to the "deno fmt" subcommand or dprint suggestion suggestions for new features (yet to be agreed)

Comments

@AliReza99
Copy link

Description:

When formatting code with deno fmt, it currently converts double quotes to single quotes in JSX (HTML in JS) components. This behavior differs from Prettier, which preserves double quotes in JSX if the singleQuotes option is set to true.

Example:

In Prettier, with singleQuotes: true, double quotes are preserved in JSX, as shown below:

import React from 'react';

const SimpleComponent = () => {
  return (
    <div className="app">
      Hello, React!
    </div>
  );
};

However, deno fmt changes the quotes in JSX attributes to single quotes:

import React from 'react';

const SimpleComponent = () => {
  return (
    <div className='app'>
      Hello, React!
    </div>
  );
};

Feature Request:

Could Deno provide an option to preserve or enforce double quotes specifically in JSX, similar to how Prettier handles this with singleQuotes: true?

This feature would help users maintain consistency with double quotes in JSX without affecting other parts of the code where single quotes might be preferred.

@littledivy

This comment was marked as off-topic.

@littledivy littledivy reopened this Nov 8, 2024
@littledivy
Copy link
Member

littledivy commented Nov 8, 2024

Oh nevermind my last comment, Deno's singleQuotes option does not preserve JSX unlike prettier.

@littledivy littledivy added suggestion suggestions for new features (yet to be agreed) deno fmt Related to the "deno fmt" subcommand or dprint labels Nov 8, 2024
@dsherret
Copy link
Member

dsherret commented Nov 8, 2024

There is a "quoteProps" option in dprint similar to prettier that Deno would just need to expose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno fmt Related to the "deno fmt" subcommand or dprint suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

3 participants