-
Notifications
You must be signed in to change notification settings - Fork 288
Apply codemods for Next.js 16 #6369
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
base: dependabot/npm_and_yarn/nextjs-a2457717e1
Are you sure you want to change the base?
Conversation
Bumps the nextjs group with 4 updates in the / directory: [@next/env](https://github.com/vercel/next.js/tree/HEAD/packages/next-env), [@next/third-parties](https://github.com/vercel/next.js/tree/HEAD/packages/third-parties), [next](https://github.com/vercel/next.js) and [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next). Updates `@next/env` from 16.0.8 to 16.0.10 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/commits/v16.0.10/packages/next-env) Updates `@next/third-parties` from 15.5.4 to 16.0.10 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/commits/v16.0.10/packages/third-parties) Updates `next` from 15.5.9 to 16.0.10 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](vercel/next.js@v15.5.9...v16.0.10) Updates `eslint-config-next` from 15.5.4 to 16.0.10 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/commits/v16.0.10/packages/eslint-config-next) --- updated-dependencies: - dependency-name: "@next/env" dependency-version: 16.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: nextjs - dependency-name: "@next/third-parties" dependency-version: 16.0.10 dependency-type: direct:production update-type: version-update:semver-major dependency-group: nextjs - dependency-name: next dependency-version: 16.0.10 dependency-type: direct:production update-type: version-update:semver-major dependency-group: nextjs - dependency-name: eslint-config-next dependency-version: 16.0.10 dependency-type: direct:development update-type: version-update:semver-major dependency-group: nextjs ... Signed-off-by: dependabot[bot] <[email protected]>
I think some of our manual config got integrated into Next.js's default config. This commit organises the config and removes redundancies, while keeping all existing config.
With the fixed ESLint config, it turned out we were breaking a number of rules.
| const hasExposures = breachesDataArray.length > 0; | ||
| const hasUnresolvedBreaches = tabSpecificExposures.length > 0; | ||
|
|
||
| const TabContentActionNeeded = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file defined three components (TabContentActionNeeded, TabContentFixed, and getZeroStateIndicator - the latter for some reason not a component) inside another component, leading to them getting recreated on every render. The linter pointed this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had an LLM figure out the "circular reference" error that ESLint threw, and it actually organised it quite neatly, grouping a few things together that belonged together but were separate. What I did was inspect the diff between the before and after, and check that everything that was removed from the before had a place in the after, and that all the additions also made sense.
| ...compat.config({ | ||
| extends: ["next"], | ||
| }), | ||
| const estlingConfig = defineConfig([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo here, eslintConfig is probably intended
| UserAnnouncementWithDetails[] | null | ||
| >(props.userAnnouncements); | ||
| useEffect(() => { | ||
| // TODO The `react-hooks` ESLint rules didn't apply correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write a ticket for this TODO so it doesn't get lost
kschelonka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've read up on next based on your comments and I think I understand why the workarounds are done. Someone with next experience should sign off though.
f4b1952 to
d3ad27d
Compare
See https://nextjs.org/blog/next-16 and https://nextjs.org/blog/next-16-1
Apart from the codemode, I had to fix our ESLint config, which now had some kind of circular references but had gotten fairly messy anyway. All the same config should still be there, although some of it moved into Next's own packages. However, some of them (most notably react-hooks) apparently didn't cover all our code, so I had to fix a bunch of errors, or at least add exceptions for them for now - I left a comment when I did.
I split the changes from the codemod and the changes I had to do for ESLint into separate commits, so that might help during reviewing.
Note that this merges into #6366, though maybe it should just target
main🤔