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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Bootstrapping from create-cloudflare-cli with next-on-pages eslint plugin installs incorrect version of eslint #747

Open
1 task done
razin99 opened this issue Apr 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@razin99
Copy link

razin99 commented Apr 19, 2024

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

  1. Run pnpm create cloudflare@latest
  2. Setup a next.js project with eslint plugin next-on-pages
  3. Run pnpm run lint, will show something like Error 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?

  • Would you like to help fixing this bug?
@razin99 razin99 added the bug Something isn't working label Apr 19, 2024
@dario-piotrowicz
Copy link
Member

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? 馃檹

@razin99
Copy link
Author

razin99 commented Apr 24, 2024

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

@razin99
Copy link
Author

razin99 commented Apr 24, 2024

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.

@razin99
Copy link
Author

razin99 commented Apr 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants