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

How can I get rid of prettier completely? #1128

Closed
ackvf opened this issue Mar 22, 2022 · 5 comments
Closed

How can I get rid of prettier completely? #1128

ackvf opened this issue Mar 22, 2022 · 5 comments
Labels
kind: feature New feature or request kind: support Asking for support with something or a specific use case scope: dependencies Pull requests that update a dependency file solution: duplicate This issue or pull request already exists

Comments

@ackvf
Copy link

ackvf commented Mar 22, 2022

Current Behavior

Working with prettier is PITA. I don't like how it formats my code.

Desired Behavior

I would like to get rid of it completely. What can I do about it?

Suggested Solution

  • Expose tsdx config to allow to remove and uninstall prettier (or any other component). [RFC] Presets #634
  • Separate prettier from eslint tsdx lint to tsdx format.
  • Add option to remove prettier to install menu for tsdx.

Who does this impact? Who is this for?

It will only affect powerusers who like to control their configurations.

Describe alternatives you've considered

.prettierignore

Additional context

#917
#634

@agilgur5
Copy link
Collaborator

Unfortunately there is no way of getting rid of it completely at this time, due to TSDX's current highly coupled nature (it's incredibly problematic; I didn't design it -- c.f. one of my early PRs #407). Some of the issues you've linked were methods of slowly decoupling TSDX.

What might interest you is disabling the Prettier rules from ESLint, which you can do with one-line in your ESLint config per #498 (comment)
You can't fully remove it right now, but you can disable it.

@agilgur5 agilgur5 added solution: duplicate This issue or pull request already exists kind: feature New feature or request scope: dependencies Pull requests that update a dependency file kind: support Asking for support with something or a specific use case labels Apr 11, 2022
@ackvf
Copy link
Author

ackvf commented Apr 11, 2022

Interesting, what does this rule do? It disables prettier checking within eslint, or does it disable prettier itself, so prettier does NO formatting at all?

@agilgur5
Copy link
Collaborator

TSDX currently only has a tsdx lint command, so Prettier is only used within the context of ESLint (see the default config).

So disabling Prettier checks within ESLint means that tsdx lint will no longer report Prettier errors and tsdx lint --fix will no longer format with Prettier rules

@ackvf
Copy link
Author

ackvf commented Apr 11, 2022

It's been few years since I was setting that up, I may need to refresh my knowledge.

I thought that it's just extending prettier rules, so that you don't get errors in IDE for prettier related issues. I was under the impression that prettier fixes everything regardless of any errors displayed in IDE.

Anyway I was just going through this https://prettier.io/docs/en/integrating-with-linters.html, so tsdx uses something like eslint-plugin-prettier and runs prettier within eslint only after eslint finds an error? And then, if eslint finds an error, it doesn't send prettier the whole document, but just that part of code, so prettier effectively doesn't do anything?

That's awesome. But I assume this rule 'prettier/prettier': 'off' only works for this particular setup, right? In setups where both eslint and prettier run separately, it won't care what eslint lists in eslint config...

Thanks!

PS: I managed to disable prettier with .prettierignore by adding all *.

@agilgur5
Copy link
Collaborator

agilgur5 commented Apr 11, 2022

so tsdx uses something like eslint-plugin-prettier and runs prettier within eslint only

Yup exactly.

after eslint finds an error? And then, if eslint finds an error, it doesn't send prettier the whole document, but just that part of code, so prettier effectively doesn't do anything?

I don't totally know how eslint-plugin-prettier works under-the-hood, so can't answer that implementation detail question with confidence.
But suffice to say, that's not TSDX implementation, but eslint-plugin-prettier implementation.

But I assume this rule 'prettier/prettier': 'off' only works for this particular setup, right?

Yea, it's turning off the ruleset that's associated with eslint-plugin-prettier.
That works with TSDX because your config is (currently) merged with TSDX's. Normally your ESLint config would have to turn on the rules somewhere but because of how it's currently set-up it's done invisibly in a potentially unintuitive way. See also #634 , which you've already linked

PS: I managed to disable prettier with .prettierignore by adding all *.

That works too I suppose 👍

Closing this out as the symptoms have been resolved and the root cause already has a few issues open for it to decouple parts of TSDX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: feature New feature or request kind: support Asking for support with something or a specific use case scope: dependencies Pull requests that update a dependency file solution: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants