awmottaz / prettier-plugin-void-html

Use the void tag syntax
https://www.npmjs.com/package/@awmottaz/prettier-plugin-void-html
MIT License
54 stars 5 forks source link

Prettier version restriction prevents patch version updates #7

Closed rpatterson closed 10 months ago

rpatterson commented 10 months ago

The following version restriction from this package is too restrictive and prevents updating prettier to new patch versions:

    "node_modules/@awmottaz/prettier-plugin-void-html": {
      "version": "1.1.0",
      "resolved": "https://registry.npmjs.org/@awmottaz/prettier-plugin-void-html/-/prettier-plugin-void-html-1.1.0.tgz",
      "integrity": "sha512-C9fovrnX1hNPLujIDFZc8F72HxO5CzhZ5JvR14M+PkU0MLUBs/4TSwGkTpJh8pzoPF2hda+IC1/v2toPo1qODw==",
      "dev": true,
      "engines": {
        "node": "20.x"
      },
      "peerDependencies": {
        "prettier": "3.0.0 - 3.1.0"
      }
    },

With the following in ./package.json:

  "devDependencies": {
    "@awmottaz/prettier-plugin-void-html": ">=1.1.0",
    "prettier": ">=2.8.8"
  },

Nothing is changed when running $ npm update but the following fails:

$ npm outdated
Package   Current  Wanted  Latest  Location               Depended by
prettier    3.1.0   3.1.0   3.1.1  node_modules/prettier  project-structure
rpatterson commented 10 months ago

In case it helps others, I'm working around this with this in ./package.json:

  "overrides": {
    "@awmottaz/prettier-plugin-void-html": {
      "prettier": ">=2.8.8"
    }
  }
awmottaz commented 10 months ago

@rpatterson with respect, npm outdated showing that there is a difference between what is "latest" and what is "wanted" is not a failure — at least, not with respect to this package. npm seems to be resolving dependency versions correctly based on the version specifiers in peerDependencies.

I take great care to test for compatibility with each released version of Prettier, and I only publish explicit compatibility ranges for versions that are tested. This does mean there will be a bit of a lag between releases of Prettier and releases of this package.

I'm happy to review PRs that update the tests and peerDependencies version compatibility specifier. Otherwise, overrides is the way to, well, override what is configured by this package.

Also, please note that Prettier's installation instructions specify that you should use --save-exact.

Install an exact version of Prettier locally in your project. This makes sure that everyone in the project gets the exact same version of Prettier. Even a patch release of Prettier can result in slightly different formatting, so you wouldn’t want different team members using different versions and formatting each other’s changes back and forth.

It's for this reason that I use such strict dependency ranges.