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

Lint is failing if ran on project init #6481

Closed
pcarillion opened this issue May 23, 2024 · 0 comments
Closed

Lint is failing if ran on project init #6481

pcarillion opened this issue May 23, 2024 · 0 comments

Comments

@pcarillion
Copy link

pcarillion commented May 23, 2024

Link to reproduction

No response

Payload Version

beta

Node Version

20.9

Next.js Version

15

Describe the Bug

No eslint plugin is installed on project init.

When installing eslint plugin, eslint config fails

It needs extra configuration to make linter work correctly

Reproduction Steps

npx create-payload-app@beta
project template: blank-3.0
yarn lint
expected result: ✔ No ESLint warnings or errors
observed result: ⨯ ESLint must be installed: yarn add --dev eslint

Try
yarn add --dev eslint
observed result
error memoizee@0.4.16: The engine "node" is incompatible with this module. Expected version ">=.0.12". Got "20.9.0"
error Found incompatible module.

Add eslint manually in package.json in devDependencies
"eslint": "^8.57.0"
Then install (yarn install)
Install is now successful
Run linter again (yarn lint)
Observed result:
⚠ The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basicfeatures/eslint#migrating-existing-config

./src/app/(payload)/admin/[[...segments]]/not-found.tsx
2:1 Error: Parsing error: The keyword 'import' is reserved

./src/app/(payload)/admin/[[...segments]]/page.tsx
2:1 Error: Parsing error: The keyword 'import' is reserved

./src/app/(payload)/api/[...slug]/route.ts
3:1 Error: Parsing error: The keyword 'import' is reserved

./src/app/(payload)/api/graphql/route.ts
3:1 Error: Parsing error: The keyword 'import' is reserved

./src/app/(payload)/api/graphql-playground/route.ts
3:1 Error: Parsing error: The keyword 'import' is reserved

./src/app/(payload)/layout.tsx
2:1 Error: Parsing error: The keyword 'import' is reserved

./src/app/my-route/route.ts
1:1 Error: Parsing error: The keyword 'import' is reserved

./src/collections/Users.ts
1:1 Error: Parsing error: The keyword 'import' is reserved

./src/payload.config.ts
1:1 Error: Parsing error: The keyword 'import' is reserved

info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
error Command failed with exit code 1.

To correct the issue, change lint config:

  • add to devDependencies: "eslint-config-next": "14.2.3"
  • remove .eslintrc.cjs
  • add .eslintrc.json
  • fill with this content
    {
    "extends": "next/core-web-vitals"
    }

Run yarn lint
should be working

Adapters and Plugins

No response

@pcarillion pcarillion added the v3 label May 23, 2024
@denolfe denolfe self-assigned this May 24, 2024
@denolfe denolfe added status: needs-triage Possible bug which hasn't been reproduced yet status: assigned and removed status: needs-triage Possible bug which hasn't been reproduced yet labels May 24, 2024
denolfe added a commit that referenced this issue May 24, 2024
Enables next linting on blank template

Closes #6481
@denolfe denolfe closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants