Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 rome format ignores command line options #3175

Closed
1 task done
MichaReiser opened this issue Sep 7, 2022 · 4 comments · Fixed by #3176 or #3189
Closed
1 task done

🐛 rome format ignores command line options #3175

MichaReiser opened this issue Sep 7, 2022 · 4 comments · Fixed by #3176 or #3189
Assignees
Labels
A-CLI Area: CLI S-Bug: confirmed Status: report has been confirmed as a valid bug

Comments

@MichaReiser
Copy link
Contributor

Environment information

Version: `main`

What happened?

Run rome with quote-style="single"

cargo run --bin rome --release format ~/Desktop/jquery.min.js --quote-style=single

Rome formats the string literals in jquery.min.js with double quotes.

Expected result

The command line arguments take precedence over the configuration and Rome formats the string literals in jquery.min.js with single quotes

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@MichaReiser MichaReiser added S-To triage Status: user report of a possible bug that needs to be triaged A-CLI Area: CLI and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Sep 7, 2022
@MichaReiser
Copy link
Contributor Author

The problem seems to be in the CLI/Workspace as @leops pointed out in #3167 (comment)

I verified that quickly by adding a dbg!(&options) to format_node in rome_js_formatter and can confirm that the options use QuoteStyle::Double instead of single

@MichaReiser MichaReiser added the S-Bug: confirmed Status: report has been confirmed as a valid bug label Sep 7, 2022
@MichaReiser MichaReiser modified the milestone: 0.9.0 Sep 7, 2022
@ematipico ematipico self-assigned this Sep 7, 2022
@jfeltesse-mdsol
Copy link

jfeltesse-mdsol commented Sep 9, 2022

I might be missing something but here it stills insists on using double quotes

rome -v
Rome CLI v0.9.1-next
cat rome.json
{
  "formatter": {
    "indentStyle": "space",
    "indentSize": 2,
    "lineWidth": 120
  },
  "linter": {
    "rules": {
      "ts": {
        "recommended": true
      }
    }
  }
}
rome format --quote-style single

# diffs like
# 0  | - import React from 'react';
#  0 | + import React from "react";

note: I'm trying to format .tsx files.

@hustcer
Copy link

hustcer commented Sep 9, 2022

I have met the same issue: rome v0.9.1 format with single quote does not work, maybe we should reopen this

@ematipico ematipico reopened this Sep 9, 2022
@ematipico
Copy link
Contributor

I was able to replicate the issue. I am going to re-open the issue and fix it

@ematipico ematipico reopened this Sep 9, 2022
ematipico added a commit that referenced this issue Sep 9, 2022
ematipico added a commit that referenced this issue Sep 9, 2022
ematipico added a commit that referenced this issue Sep 9, 2022
ematipico added a commit that referenced this issue Sep 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-CLI Area: CLI S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants