Skip to content
This repository has been archived by the owner on Jun 12, 2022. It is now read-only.

Upgrade prettier and fix prettier and lint issues #25

Closed
wants to merge 6 commits into from
Closed

Upgrade prettier and fix prettier and lint issues #25

wants to merge 6 commits into from

Conversation

HappyNinja2
Copy link
Contributor

I was trying to use optional chaining for a PR, then realized that the prettier version is old. In this pull request I have:

  • Upgraded prettier in package.json

  • Change the following line in the package.json (otherwise yarn fix lint wouldn't work):

"lint": "eslint \"**/*.{js,ts,tsx}\""

  • Ran yarn lint --fix

It seems that yarn lint --fix wasn't correctly running before so a lot correction has been made to the files.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 25193 lines exceeds the maximum allowed for the inline comments feature.

@rrebase
Copy link
Owner

rrebase commented Jul 29, 2020

Thank you for the contribution! Noticed that you commited package-lock.json, but we're using yarn and thus have yarn.lock, otherwise the PR looks good. 🙂

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 5045 lines exceeds the maximum allowed for the inline comments feature.

Upgrade prettier

Change
 "lint": "eslint \"**/*.{js,ts,tsx}\""

Run  yarn lint --fix
Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 5053 lines exceeds the maximum allowed for the inline comments feature.

@codeclimate
Copy link

codeclimate bot commented Jul 29, 2020

Code Climate has analyzed commit 8469c8d and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (90% is the threshold).

This pull request will bring the total coverage in the repository to 96.2% (0.0% change).

View more on Code Climate.

@rrebase
Copy link
Owner

rrebase commented Jul 29, 2020

It seems that CI is failing because of multiple Cypress versions.

Setting a specific version of Cypress with resolutions key in package.json might help https://classic.yarnpkg.com/en/docs/selective-version-resolutions/

This seems relevant: cypress-io/cypress#4595

@HappyNinja2
Copy link
Contributor Author

HappyNinja2 commented Jul 30, 2020

@rrebase I could get this far from last night.
Just to recap, I wanted to create a PR for filtering the assignees, but it seemed the project wouldn't build because it didn't support optional chaining. From yesterday I am trying to upgrade the dependencies but I have faced some issues:

  1. It seems that yarn upgrade doesn't change the package.json file.
    To resolve this I found some help at the following links:
    yarn upgrade does not update package.json yarnpkg/yarn#2042
    yarn upgrade does not update package.json yarnpkg/yarn#2042 (comment)

and ended up running these commands

yarn global add syncyarnlock // install syncyarnlock globally
yarn upgrade --latest // update dependencies, updates yarn.lock
syncyarnlock -s -k // updates package.json with versions installed from yarn.lock
yarn install // updates yarn.lock with current version constraint from package.json

After that I ran yarn lint --fix and tried to remove some of the issues.

  1. After upgrading the depencies I was getting an error, because react-app script wouldn't support the latest version of eslint. So I had to remove eslint
    Project dependency tree issue with react-scripts eslint version wesbos/eslint-config-wesbos#17 (comment)
    yarn remove eslint

  2. The build had some errors because there were some renamings (mostly formContext to FormProvider) in react-hooks
    V6 react-hook-form/react-hook-form#1471

  3. In CreateTaskDialog, line 255 was commented (Couldn't fix it)

@HappyNinja2
Copy link
Contributor Author

HappyNinja2 commented Jul 30, 2020

It seems that CI is failing because of multiple Cypress versions.

Setting a specific version of Cypress with resolutions key in package.json might help https://classic.yarnpkg.com/en/docs/selective-version-resolutions/

This seems relevant: cypress-io/cypress#4595

The latest CI details indicate that Cypress is dependent on package-lock.json, @rrebase could you help to resolve these issues and upgrade the packages, please?

  echo "The Cypress orb uses 'npm ci' to install 'node_modules', which requires a 'package-lock.json'."
  echo "A 'package-lock.json' file was not found. Please run 'npm install' in your project,"

@rrebase
Copy link
Owner

rrebase commented Jul 30, 2020

@arvandf I'll take a look and try to fix these issues.

@rrebase
Copy link
Owner

rrebase commented Jul 30, 2020

@arvandf Upgrading npm packages can be quite a chore due to dependency hell. Thanks for writing out the issues you faced 👏.

I initially continued from your latest commit and fixed the issues you mention above,
but then something made one of the CI steps hang. Not sure what's causing it since there are so many package upgrades.

My thoughts:

  • Instead of yarn upgrade It's usually better to go through the packages one-by-one. I like to use the VSCode extension Version Lens, which shows the latest versions in package.json and allows you to easily bump the version & check the changelogs.
  • It seems that a lot is currently dependant on react-scripts dependency versions. Can't even bump everything to latest. The 4.0 alpha is coming soon, so I'd wait for that and currently stick to just prettier related package upgrades - got a passing build based on your last commit with passing build Upgrade prettier & fix lint #27. That should have everything required optional chaining. Tell me if I missed anything.
  • You also added .vscode/settings.json to the root folder. There's currently one at frontend/.vscode/settings.json as I open my project inside the frontend folder. Should it be moved up? Also those settings could actually be quite important as the prettier is run through eslint-plugin-prettier, which gets rid of conflicting formatting with eslint.

I'll close this PR and merge #27 if it makes sense to you & will wait for your filtering assignees PR 🙂

@HappyNinja2
Copy link
Contributor Author

@rrebase Thanks for fixing it so quickly 😄. It also makes total sense to close this PR.

  • I didn't know about Version Lens, it seems very useful. 👏

  • .vscode/settings.json got added automatically because I opened both projects in one VS code. I'll open the projects separately from now on.

@rrebase rrebase closed this Jul 31, 2020
@HappyNinja2 HappyNinja2 deleted the fix-pretter-lint branch July 31, 2020 00:45
@HappyNinja2 HappyNinja2 restored the fix-pretter-lint branch July 31, 2020 00:45
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.

None yet

3 participants