[🐛 Bug]: Bootstrapping from create-cloudflare-cli with next-on-pages eslint plugin installs incorrect version of eslint
next-on-pages environment related information
System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:43 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6000
CPU: (10) arm64 Apple M1 Pro
Memory: 16 GB
Shell: /bin/zsh
Package Manager Used: npm (10.2.4)
Relevant Packages:
@cloudflare/next-on-pages: 1.11.0
vercel: 34.0.0
next: 14.1.0
Description
In package.json installed version of eslint is ^8, but the rule that uses context.filename returns undefined.
Installing eslint ^8.43.0 resolved the issue, used the same version as specified in package.json of the eslint plugin repository.
Reproduction
- Run
pnpm create cloudflare@latest - Setup a next.js project with eslint plugin
next-on-pages - Run
pnpm run lint, will show something likeError while loading rule 'next-on-pages/no-unsupported-configs': Cannot read properties of undefined (reading 'match')
Pages Deployment Method
None
Pages Deployment ID
No response
Additional Information
No response
Would you like to help?
- [X] Would you like to help fixing this bug?
Hi @razin99 🙂👋
Thanks for the issue 🙂
Unfortunately I could not reproduce this on my end, neither with npm (npm create cloudflare + npm run lint) nor pnpm (pnpm create cloudflare + pnpm run lint)...
I have seen issues like Cannot read properties of undefined (reading 'match') when trying to use a project with a package manager different from the one used to install dependencies.... could have you accidentally fallen into that scenario?
Interestingly your info command does say Package Manager Used: npm (10.2.4) although you're referring to pnpm commands in the PR's description 🤔
Could you try again from zero and making sure to use the exact same package manager for both installation and running the lint script? could you try this with both npm and pnpm? 🙏
Will try running script from zero again and update here; but the command I used was npx instead of pnpm dlx,
Version of pnpm output when I ran pnpm dlx @cloudflare/next-on-pages is 8.5.1
It worked with npm, eslint version installed is v8.57.0
But with pnpm, eslint version is v8.0.0
Looks like pnpm resolves semver ^8.0.0 to lowest available version.
Oof, its a skill issue on my end. Dependencies installed are correct or as expected on latest pnpm version.
I bootstraped a cloudflare next.js project again with pnpm version 9.0.6 and ran pnpm run lint it worked nicely :)
Will create a PR to add some documentation for people who wants to use pnpm
@razin99 I'm glad you solved the issue :smiley:
Hopefully things should be all good here, so I'll be closing this issue
Please feel free to reopen it if you disagree and think that there's still something to do here regarding this :slightly_smiling_face: