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

Ft/upgrade next to 15 #1001

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Ft/upgrade next to 15 #1001

wants to merge 24 commits into from

Conversation

koechkevin
Copy link
Contributor

@koechkevin koechkevin commented Nov 14, 2024

Description

This PR upgrades the Next.js framework from the current version to v15.0.3 to leverage on the latest features, performance improvements, and bug fixes introduced in this release.

Key Changes

  • Upgrade Next.js Version to 15.0.3.
  • Upgrade Eslint to v9 since next js 15 added support for eslint 9.
  • Updated codebase's eslint configuration to flatConfigs.
  • Removed .eslintignore and .eslintrc since with flatConfigs all can be defined in eslint.config.js.

You may notice many changed files in component files, but this is due to a change in how to disable a rule in a file with flat configs.

  • We do not need to replicate // eslint-disable-next-line testing-library/render-result-naming-convention inside the test file since this disable command has been specified in common eslint config "testing-library/render-result-naming-convention": "off",.
  • // eslint-disable-next-line react-hooks/exhaustive-deps occurrences have now been replaced with /* eslint react-hooks/exhaustive-deps: "off" */

Review of this PR should be around */**/eslint.config.js and packages/eslint-config-commons-ui

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Screenshots

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

@koechkevin koechkevin marked this pull request as draft November 14, 2024 10:51
@koechkevin koechkevin self-assigned this Nov 14, 2024
@koechkevin koechkevin requested a review from a team November 27, 2024 10:56
@koechkevin koechkevin marked this pull request as ready for review November 27, 2024 10:56
Copy link
Member

@kilemensi kilemensi left a comment

Choose a reason for hiding this comment

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

👍🏽


Still going through it but quick feedback on issues that kind of stood out to me.

const flatCompat = new FlatCompat();

module.exports = [
...fixupConfigRules(flatCompat.extends("plugin:@next/next/core-web-vitals")),
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this? Aren't we going all in Eslint 9?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kilemensi I came across this issue and the only workaround I had was to use eslint compatibility utilities to fix up things.

packages/hurumap-next/eslint.config.js Outdated Show resolved Hide resolved
apps/vpnmanager/src/middleware.ts Outdated Show resolved Hide resolved
@koechkevin koechkevin requested a review from kilemensi December 2, 2024 12:46
Copy link
Member

@kilemensi kilemensi left a comment

Choose a reason for hiding this comment

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

👍🏽


Based on this comment, should we be using the experimental file configuration?

apps/charterafrica/src/components/Articles/Articles.js Outdated Show resolved Hide resolved
apps/vpnmanager/package.json Outdated Show resolved Hide resolved
apps/vpnmanager/src/lib/outline.ts Outdated Show resolved Hide resolved
@koechkevin
Copy link
Contributor Author

👍🏽

Based on this comment, should we be using the experimental file configuration?

@kilemensi this seems to work for js apps if we put eslint configs at root but since ts apps configurations have some differences, we may have to retain them as is.

@kilemensi
Copy link
Member

kilemensi commented Dec 4, 2024

@kilemensi this seems to work for js apps if we put eslint configs at root but since ts apps configurations have some differences, we may have to retain them as is.

There is a slight chance I've misread it @koechkevin so please read the docs again but my understanding is as follow:
Given the following directory tree:

  <root>
  ├── eslint.config.js
  ├── apps
  │   ├── centralcms
  │   ├── charterafrica
  │   │   ├── src
  │   │   ├── eslint.config.json
  │   ├── civicsignalblog
  ├── packages
  │   ├── commons-ui-core
  │   ├── commons-ui-next
  │   ├── commons-ui-payload

Without the flag, eslint looks for config from current directory moving up. That is, if you run the command at <root>, if there is a eslint.config.js at root, that config will be used regardless of any other config at apps level. If it doesn't find one at <root>, then it will travel <root> -> apps -> charterafrica and use the first found eslint.config.js along that path.

With the flag on, the process is actually reversed. eslint starts looking at the file being linted regardless of where the command was executed. So if we're linting a file in apps/charterafrica/src, eslint will traverse backwards and find eslint.config.json in charterafrica first, or along the path charterafrica -> apps -> <root> until it finds one.

In a monorepo, the second approach sounds like the right approach to me.

@kilemensi
Copy link
Member

I just saw

chore: Remove obsolete ESLint configuration files across multiple app

fly by my screen @koechkevin. Are we changing the approach?

@koechkevin
Copy link
Contributor Author

I just saw

chore: Remove obsolete ESLint configuration files across multiple app

fly by my screen @koechkevin. Are we changing the approach?

@kilemensi been playing around with this and it looks like even without a flag 🤔 eslint traverses backwards. So I just removed eslint configurations in apps and retained one in the root. I had to push it just to be sure that things aren't cached on my end.

@koechkevin
Copy link
Contributor Author

@kelvinkipruto @m453h spare some time here

@kelvinkipruto
Copy link
Contributor

@koechkevin Just tested it on ClimateMapped, and it works fantastic. Perhaps we can now use use cache to improve its speed😅.
Let me still review the other apps

Copy link
Contributor

@m453h m453h left a comment

Choose a reason for hiding this comment

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

🚀

I have tested CivicSignalBlog, ClimateMapped and VPNManager and they have worked , I'll need to test the remaining apps as well.


Just a thought I had as I was reading through this discussion... would it make sense to have a root-level eslint.config.js and extend it per specific app's needs ? Or would that lead to unnecessary complexity?

apps/promisetracker/eslint.config.js Outdated Show resolved Hide resolved
@koechkevin
Copy link
Contributor Author

🚀

I have tested CivicSignalBlog, ClimateMapped and VPNManager and they have worked , I'll need to test the remaining apps as well.

Just a thought I had as I was reading through this discussion... would it make sense to have a root-level eslint.config.js and extend it per specific app's needs ? Or would that lead to unnecessary complexity?

@m453h The configs for all apps are similar, would it make sense to have as many eslint configs when only 1 at the root can work?

@m453h
Copy link
Contributor

m453h commented Dec 10, 2024

🚀
I have tested CivicSignalBlog, ClimateMapped and VPNManager and they have worked , I'll need to test the remaining apps as well.
Just a thought I had as I was reading through this discussion... would it make sense to have a root-level eslint.config.js and extend it per specific app's needs ? Or would that lead to unnecessary complexity?

@m453h The configs for all apps are similar, would it make sense to have as many eslint configs when only 1 at the root can work?

Yes, I was thinking that just one eslint.config.js file at the root level would make more sense, though I had seen we still had separate files for some apps like civicsignalblog, vpnmanager, techlab, uibook, pesayetu, promisetracker

@koechkevin
Copy link
Contributor Author

🚀
I have tested CivicSignalBlog, ClimateMapped and VPNManager and they have worked , I'll need to test the remaining apps as well.
Just a thought I had as I was reading through this discussion... would it make sense to have a root-level eslint.config.js and extend it per specific app's needs ? Or would that lead to unnecessary complexity?

@m453h The configs for all apps are similar, would it make sense to have as many eslint configs when only 1 at the root can work?

Yes, I was thinking that just one eslint.config.js file at the root level would make more sense, though I had seen we still had separate files for some apps like civicsignalblog, vpnmanager, techlab, uibook, pesayetu, promisetracker

@m453h typescript apps' configurations are slightly different from those for JS apps so we'd have to retain app-level configurations for the TS apps.

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.

4 participants