question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add expected prettier version in config

See original GitHub issue

Hi,

I think it would be nice to be able to define a version in .prettierrc.

The idea is that if you set version= "^1.6.1" in .prettierrc, running Prettier 1.5 on the project would fail.

This would prevent other team members with globally installed old versions of prettier to reformat the code in “the old way” when rules of prettier change across versions (see for example JSX formatting changes between 1.5 => 1.6)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
suchipicommented, Sep 12, 2017

@lydell

Did I misunderstand the package.json proposal here? I thought it was about adding code to Prettier that reads package.json and checks if “prettier”: “…” in there matches the version of Prettier that is running. So this shouldn’t be closed?

That was my understanding as well

1reaction
lydellcommented, Sep 12, 2017

I guess this could also be solved in a general way by using one of those automatic git hook installers adding a “run npm install/yarn if package.json or package-lock.json/yarn.lock has changed after git pull”. That would also protect against eslint --fix resulting in the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Options - Prettier
Ensure Prettier's endOfLine option is set to lf (this is a default value since v2.0.0) · Configure a pre-commit hook that will run...
Read more >
How to configure Prettier and VSCode
You can configure JavaScript code auto-formatting with Prettier to work per-project. This allows you to get a consistent formatting without ...
Read more >
How do you reenable esLint squiggly lines after adding ...
I was able to find an answer to my query. In short, the configuration works despite my console.log test appearing to fail.
Read more >
eslint-config-prettier-standard
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >
Prettier, ESLint and Typescript
At the time of this writing, Prettier is in version 2.4.1, ... Add the configuration file to the root of your project (you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found