payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
23.64k stars 1.51k forks source link

Lint is failing if ran on project init #6481

Closed pcarillion closed 4 months ago

pcarillion commented 4 months ago

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:

Run yarn lint should be working

Adapters and Plugins

No response

github-actions[bot] commented 3 weeks ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.