Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Move prettier to be a peer dependency #107

Merged
merged 1 commit into from
Jul 4, 2018
Merged

Move prettier to be a peer dependency #107

merged 1 commit into from
Jul 4, 2018

Conversation

BPScott
Copy link
Member

@BPScott BPScott commented Jul 3, 2018

Helping along with https://github.com/Shopify/sewing-kit/issues/737. We should strive to have a single prettier install underneath sewing-kit, rather than multiple dependencies potentially installing multiple prettier versions which leads to confusion around different formatting tools producing different results.

eslint-plugin-prettier expects prettier to be a peer dependency, so do the same here.

@BPScott
Copy link
Member Author

BPScott commented Jul 3, 2018

Currently running yarn why prettier in web returns:

info Reasons this module exists
   - "@shopify#sewing-kit" depends on it
   - Hoisted from "@shopify#sewing-kit#prettier"
   - Hoisted from "@shopify#sewing-kit#eslint-plugin-shopify#prettier"
   - Hoisted from "@shopify#sewing-kit#prettier-stylelint-formatter#prettier"
   - Hoisted from "@shopify#sewing-kit#stylelint-config-shopify#prettier-stylelint-formatter#prettier"

This should remove the Hoisted from "@shopify#sewing-kit#eslint-plugin-shopify#prettier" line. See the linked issue for PRs relating to removing the others

Copy link
Contributor

@ismail-syed ismail-syed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is the right call here.

We had discussion about this in the past. We had prettier set as an optional dependency because consumers may use eslint-plugin-shopify without the use of prettier.

However, docs on [optionalDependencies](https://docs.npmjs.com/files/package.json#optionaldependencies) seem to imply different behaviour.

The difference is that build failures do not cause installation to fail.

It doesn't seem to have much impact on how dependency resolution works with regards to devDependencies vs optionalDependencies. IIRC, when I first PR'd this, I had it set as a peerDep, then changed it to an optionalDep after PR feedback.

@ismail-syed
Copy link
Contributor

We should update the readme to let consumers know that prettier should be installed separately as a peerDep.

Copy link
Member

@GoodForOneFare GoodForOneFare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Needs a CHANGELOG entry, ideally highlighting that this is a breaking change.

@BPScott BPScott force-pushed the prettier-peerdep branch from 0921139 to 0290433 Compare July 4, 2018 17:38
CHANGELOG.md Outdated
@@ -7,6 +7,9 @@
* `shopify/jest/no-vague-titles` ([#93](https://github.com/Shopify/eslint-plugin-shopify/pull/93))
* `shopify/strict-component-boundaries` ([#98](https://github.com/Shopify/eslint-plugin-shopify/pull/98))

### Changed
* **Breaking** Moved prettier to be a peerDependency, this avoids the potential for having multiple versions of prettier in the dependency graph ([#107](https://github.com/Shopify/eslint-plugin-shopify/pull/107))
Copy link
Contributor

@ismail-syed ismail-syed Jul 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add a note here for consumers to install prettier themselves. Frequent visitors are more likely to read the changelog over readme history.

@BPScott BPScott force-pushed the prettier-peerdep branch from 0290433 to a52fd1e Compare July 4, 2018 18:10
@BPScott BPScott force-pushed the prettier-peerdep branch from a52fd1e to 4d2105f Compare July 4, 2018 18:11
@BPScott BPScott merged commit 17d5ed4 into master Jul 4, 2018
@BPScott BPScott deleted the prettier-peerdep branch July 4, 2018 18:12
@cartogram cartogram deployed to production July 16, 2018 08:03 Active
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants