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

Update node dependencies #1596

Merged
merged 16 commits into from
Jan 15, 2024
Merged

Update node dependencies #1596

merged 16 commits into from
Jan 15, 2024

Conversation

ahangarha
Copy link
Contributor

@ahangarha ahangarha commented Jan 10, 2024

We drop support for Node v14 and v17 because of bumping @typescript-eslint/parser version to 6+ and js-dom to v22

Remaining upgrades:

  • Bump React to version 18
  • Bump Eslint-related dependencies and fix missing peer dependency issues for eslint-config-shakacode

Can we do these upgrades in another PR?


This change is Reviewable

@ahangarha ahangarha changed the base branch from master to update-dependencies January 10, 2024 15:33
@ahangarha ahangarha force-pushed the update-node-dependencies branch from 7223023 to 326033c Compare January 10, 2024 16:50
Base automatically changed from update-dependencies to master January 10, 2024 21:58
@justin808
Copy link
Member

please rebase and update

@ahangarha
Copy link
Contributor Author

@justin808
This PR still needs more work for

  • updating React to v18
  • Eslint

@ahangarha ahangarha force-pushed the update-node-dependencies branch from c9958f1 to f9e76fd Compare January 12, 2024 18:29
Comment on lines +4 to +5
/* eslint-disable @typescript-eslint/no-explicit-any */

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This part needs to be improved. I couldn't find a way other than ignoring the linter rule.

Copy link
Contributor

Choose a reason for hiding this comment

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

Some times there's no better way to do things than to ignore linter rules.

That's because some linter rules are just for identifying possible code smells.

const actual = ReactOnRails.render('R1', {}, 'root')._reactInternalFiber.type;
const actual = ReactOnRails.render('R1', {}, 'root')._reactInternals.type;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is internal logic in React, and there is no documentation about it. But in React 17, ReactOnRails.render('R1', {}, 'root') only has ._reactInternals In React 18, this is changed again.

@ahangarha ahangarha force-pushed the update-node-dependencies branch from 0da8f1c to 29d6053 Compare January 13, 2024 15:34
@ahangarha ahangarha force-pushed the update-node-dependencies branch from 248abdf to 060165f Compare January 13, 2024 16:16
@ahangarha ahangarha requested a review from Judahmeek January 13, 2024 16:48
@ahangarha ahangarha changed the title WIP - Update node dependencies Update node dependencies Jan 13, 2024
@ahangarha ahangarha marked this pull request as ready for review January 13, 2024 17:31
@@ -51,7 +51,7 @@ const configLoader = (configPath) => {
// Some test environments might not have the NODE_ENV set, so we'll have fallbacks.
const configEnv = env.NODE_ENV || env.RAILS_ENV || 'development';
const ymlConfigPath = join(configPath, 'webpacker.yml');
const settings = safeLoad(readFileSync(ymlConfigPath, 'utf8'))[configEnv];
const settings = load(readFileSync(ymlConfigPath, 'utf8'))[configEnv];
Copy link
Contributor

Choose a reason for hiding this comment

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

@ahangarha can you explain why we had to stop using safeLoad?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. That is because of the new changes in js-yaml v4.0.0.

Breaking: removed safe* functions. Use load, loadAll, dump instead which are all now safe by default.

They are all safe by this version.

Copy link
Member

Choose a reason for hiding this comment

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

Figure out why we still have this file and if we can delete this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justin808 @Judahmeek

We don't use this file anymore, but I am not sure if no other project uses this as config loader. It is very unlikely but still...

It is included in out npm package and removing it is a breaking change.

What about putting this file in the queue for removal in the next major release and for now, we show a deprecation message for using it?

@justin808 justin808 merged commit b356271 into master Jan 15, 2024
19 checks passed
@justin808 justin808 deleted the update-node-dependencies branch January 15, 2024 07:58
Comment on lines +54 to +55
"react": ">= 17",
"react-dom": ">= 17"
Copy link
Member

Choose a reason for hiding this comment

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

@Judahmeek @ahangarha can we under the bump of React?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, no logic has changed in the codebase regarding React API (except in tests, which is not our concern here).

I think we can keep the minimum version of React to 16.

@ahangarha ahangarha mentioned this pull request Jan 22, 2024
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.

3 participants