Skip to content

Trying to use nextjs eslint extension throws error #26475

@robertwt7

Description

@robertwt7

What version of Next.js are you using?

11

What version of Node.js are you using?

12.20.0

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying your application?

Not deploying

Describe the Bug

Using nextjs eslint extension gave me this:

(node:38828) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 120)
(node:38828) UnhandledPromiseRejectionWarning: Error: Plugin "import" was conflicted between "--config" and "--config » eslint-config-next/core-web-vitals » E:\Development\React\nextjs-boilerplate\node_modules\eslint-config-next\index.js".

Not sure why, I tried to remove import and every single extensions and rules in my eslint but still throws me the same error.

Expected Behavior

I expect it should work with my current eslint setup:

module.exports = {
  env: {
    browser: true,
    es6: true,
    node: true,
  },
  parser: "babel-eslint",
  extends: [
    "next",
    "next/core-web-vitals",
    "react-app",
    "plugin:react/recommended",
    "airbnb",
    "plugin:prettier/recommended",
  ],
  globals: {
    Atomics: "readonly",
    SharedArrayBuffer: "readonly",
  },
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2018,
    sourceType: "module",
  },
  plugins: ["react", "jsx-a11y", "import", "prettier"],
  rules: {
    "prettier/prettier": ["warn", { endOfLine: "auto" }],
    "react/jsx-filename-extension": ["warn", { extensions: [".js", ".jsx"] }],
    "no-console": "off",
    "no-use-before-define": "off",
    "react/destructuring-assignment": "off",
    "react/jsx-props-no-spreading": "off",
    "react/no-danger": "off",
    "react/require-default-props": "off",
    "react/default-props-match-prop-types": "off",
    "react/no-unused-prop-types": "off",
    "import/prefer-default-export": "off",
    "react/jsx-uses-react": "off",
    "react/react-in-jsx-scope": "off",
  },
};

To Reproduce

Create new nextjs app, then use the .eslintrc.js above

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions