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

BREAKING CHANGE: Feat/move tools to peer deps #62

Merged

Conversation

marcusrbrown
Copy link
Contributor

NOTE: This is waiting on #61 so has been raised as a draft while that one is reviewed. Once that PR is updated, I'll rebase against main.

Description

Make all optional dependencies optional peer dependencies. After this change, to use amex/test you will need to install required peer dependencies:

npm install --save-dev typescript eslint eslint-plugin-jest eslint-plugin-jest-dom eslint-config-amex

To use amex/prettier/test you will need to use:

npm install --save-dev prettier typescript eslint eslint-plugin-jest eslint-plugin-jest-dom eslint-plugin-prettier eslint-config-amex

Please make sure that the PR fulfills these requirements

  • I checked that there aren't other open Pull Requests for the same update/change.
  • My code follows the code style of this project.
  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • Rule changes includes a comment to describe the reasoning behind the change.
  • PR contains a single rule change.

Motivation and Context

This package provides a main ESLint configuration and a few optional ones. The optional ones are specified as dependencies. In particular Prettier and TypeScript have highly opinionated setups so we should not impose a tool or version on consumers. This is in line with eslint-config-airbnb and other ESLint config bundles that provide optional configurations.

How Has This Been Tested?

The existing tests are used. Do we need tests for the new optional peer dependencies?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update

Jest:

```bash
npm install --save-dev typescript eslint-plugin-jest eslint-plugin-jest-dom
Copy link

Choose a reason for hiding this comment

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

I might be out of the loop here, but why is typescript needed for jest support?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eslint-plugin-jest has a direct dependency on a package called @typescript-eslint/experimental-utils which eventually pulls in a package that depends on tsutils, which requires typescript:

jest-community/eslint-plugin-jest#339

I think that their removal of typescript from dependencies of that package was a mistake, as the plugin cannot function without it and the warning is buried under a transient dependency. I'll probably raise a PR over there but I'd rather eslint-config-amex not bring TypeScript along with it in the default configurations.

@marcusrbrown marcusrbrown marked this pull request as ready for review December 17, 2020 22:52
@marcusrbrown marcusrbrown requested a review from a team as a code owner December 17, 2020 22:52
@marcusrbrown marcusrbrown changed the base branch from main to 14.x December 17, 2020 22:53
BREAKING CHANGE: Moved TypeScript and Prettier dependencies to peer
dependencies and made them optional. Consumers of this package must
install them separately. Moved ESLint plugins required by `amex/test`
and `amex/prettier/*` to become optional peer dependencies.

BREAKING CHANGE:
- Several ESLint plugins received major updates.
- ESLint versions below v7.15.0 are no longer supported.
@marcusrbrown marcusrbrown merged commit ad8b14e into americanexpress:14.x Dec 17, 2020
@marcusrbrown marcusrbrown deleted the feat/move-tools-to-peerDeps branch December 18, 2020 00:01
@marcusrbrown marcusrbrown mentioned this pull request Mar 3, 2021
Merged
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant