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

[Bug] prettier . --write does not run on .gjs/.gts files #113

Closed
simonihmig opened this issue Aug 24, 2023 · 9 comments
Closed

[Bug] prettier . --write does not run on .gjs/.gts files #113

simonihmig opened this issue Aug 24, 2023 · 9 comments

Comments

@simonihmig
Copy link

🐞 Describe the Bug

prettier . --write does not run on .gjs/.gts files

🔬 Minimal Reproduction

I run prettier . --write

😕 Actual Behavior

It reformats all files, except for .gjs/.gts files. CLI output list all kind of files, like .js/.cjs/.mjs, but no .gjs/.gts

🤔 Expected Behavior

Should reformat .gjs/.gts files.

🌍 Environment

  • prettier-plugin-ember-template-tag version: 1.0.2
  • ember-template-imports version: -

➕ Additional Context

When I run prettier path/to/component.gts --write then it does work! Also running prettier using VSCode does work correctly. So it seem only prettier . seems to ignore any .gjs/.gts files

simonihmig added a commit to simonihmig/polaris-starter that referenced this issue Aug 24, 2023
Any malformed .gjs/.gts file was not fixed by prettier. Can be reproduces in Stackblitz as well.
There is another issue, that running the `lint:prettier:fix` script does not touch any .gjs/.gts files, but that seems to be an upstream issue: ember-tooling/prettier-plugin-ember-template-tag#113
@fdeters
Copy link

fdeters commented Aug 29, 2023

I've reproduced this issue, and found that it does work when specifying a file, like npx prettier --write app/components/my-component.gjs, but doesn't work with directories, like npx prettier --write app/components.

@NullVoxPopuli
Copy link
Member

My prettier command is now:

prettier -c "**/*.{js,gjs,cjs,mjs,json,hbs,ts,cts,mts,gts}"

😅

My changes: NullVoxPopuli/limber@80433f7#diff-fcf5729f4474308f357cea6ec1123607ce116df8a7a60516595fac5f5327e01bR33

@gitKrystan
Copy link
Collaborator

Sorry for the annoying bug. :-(

Based on Prettier's documentation, prettier --write . should be working, but it seems like we actually need to do prettier --write --plugin prettier-plugin-ember-template-tag. I am finding other plugins using this hack too but no one seems to mention it's a hack?

I will update the documentation accordingly and open an issue on prettier.

@gitKrystan
Copy link
Collaborator

gitKrystan commented Sep 3, 2023

@gitKrystan
Copy link
Collaborator

gitKrystan commented Sep 4, 2023

Looks like this bug was introduced in prettier v3 and there is a fix in the works. More info at prettier/prettier#15079

In the meantime add the plugin flag as I mentioned above.

@gitKrystan
Copy link
Collaborator

gitKrystan commented Sep 27, 2023

Supposedly this is fixed by prettier/prettier#15433 but I haven't tried it yet. LMK if it works!

@NullVoxPopuli
Copy link
Member

NullVoxPopuli commented Oct 3, 2023

it does not, I still have this issue :(

ah, it's not released yet: prettier/prettier#15433 (comment)

@bartocc
Copy link
Contributor

bartocc commented Nov 13, 2023

Like @NullVoxPopuli commented on discord, [email protected] has been released this WE 🎉

@gitKrystan
Copy link
Collaborator

README updated. I will re-open this if it's still borked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants