Skip to content

Using eslint-plugin-next gives a SyntaxError (on Node 12) #38530

@morganwahl

Description

@morganwahl

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

    Operating System:
      Platform: linux
      Arch: x64
      Version: #202206141358~1655919116~22.04~1db9e34 SMP PREEMPT Wed Jun 22 19
    Binaries:
      Node: 12.22.9
      npm: 8.5.1
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 12.2.3-canary.0
      eslint-config-next: 12.2.1
      react: 17.0.2
      react-dom: 17.0.2

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

eslint fails with a SyntaxError when extening the next/core-web-vitals config.


Oops! Something went wrong! :(

ESLint: 8.16.0

/home/morgan/Development/addgene-datahub/frontend/node_modules/@next/eslint-plugin-next/lib/rules/no-img-element.js:25
        if (node.parent?.parent?.openingElement?.name?.name === 'picture') {
                        ^

SyntaxError: Unexpected token '.'
    at new Script (vm.js:88:7)
    at NativeCompileCache._moduleCompile (/home/morgan/.virtualenvs/datahub1/lib/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
    at Module._compile (/home/morgan/.virtualenvs/datahub1/lib/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (/home/morgan/.virtualenvs/datahub1/lib/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/morgan/Development/addgene-datahub/frontend/node_modules/@next/eslint-plugin-next/lib/index.js:15:23)
    at Module._compile (/home/morgan/.virtualenvs/datahub1/lib/node_modules/eslint/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)

Expected Behavior

eslint runs without a SyntaxError.

Link to reproduction

https://i.dont.have.time.to.make.a.repo.just.for.this/

To Reproduce

In an eslint configuration, extend next/core-web-vitals. Then run eslint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LintingRelated to `next lint` or ESLint with Next.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions