Separate prettier command eg. "tsdx format"
See original GitHub issueCurrent Behavior
Prettier is integrated into eslint and runs in one tsdx lint
command. This comes with couple of disadvantages described at https://prettier.io/docs/en/integrating-with-linters.html . It is also not possible to run prettier on non JS/TS files eg. json, css/less/scss, md, yml etc…
Desired Behavior / Suggested Solution
tsdx lint
runs only lint without prettier.
tsdx format
runs prettier and it’s possible to configure all file types we want to format. Default can be ts,tsx..
while the user can decide to also format yml, sass
etc.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
Separate prettier command eg. "tsdx format" #917 - GitHub
Current Behavior Prettier is integrated into eslint and runs in one tsdx lint command. This comes with couple of disadvantages described at ...
Read more >CLI - Prettier
This command formats all files supported by Prettier in the current directory and its subdirectories. It's recommended to always make sure that prettier...
Read more >TSDX: Introduction
TSDX is a zero-config CLI that helps you develop, test, and publish modern TypeScript packages with ease--so you can focus on your awesome...
Read more >TSdx - Best of JS
Below is a list of commands you will probably find useful: ... Aside from just bundling your module into different formats, TSDX comes...
Read more >Build your First Typescript Package in Under 10 Minutes
Let's bootstrap our TSDX project from the command line: ... To keep with React best practices, we'll make a separate file for our...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
TSDX does use
eslint-config-prettier
so the main disadvantage doesn’t apply.I’m not sure if this is actually correct, I feel like there should be a way of doing this and would also like to use that feature of Prettier.
That being said, it’s important to actually lint (not just format) the other types of files too, which might be outside the scope of TSDX and add bloat. I personally run a variety of linters in my IDE etc (and run Policy-as-Code and SAST in CI).
This proposal would be a breaking change in it’s current state.
To give an alternative that works today: Prettier is also very much usable in user-land too. Since it’s already in your dependency tree with TSDX, you can add some
package.json#scripts
like:eslint-plugin-prettier
is only a single dependency out of the gigantic amount of other deps. It can be impacted by majors, yes, but so willeslint-config-prettier
, which is necessary. So not a huge burden in that sense.Well
eslint --fix
and ESLint style rules existed well before Prettier or really “formatter tools” as a category existed – so it already does both and will continue to do both. I’ve personally been a long-time user of Standard, which is entirely built on ESLint. Also there’s a group of people that believe type-checking is a subset of linting too in #352 – there’s opinions on opposite ends of the spectrum here.But as I wrote there combining tools typically means for more bugs, nuances, and hacks and is well-evidenced in TSDX issues itself (some mentioned there too), so I’m much more inclined to separate them and am in fact planning to separate each command as a separate package and configs as separate presets (#634 ).