mongkuen / gatsby-plugin-eslint

Gatsby plugin to add support for ESLint
MIT License
13 stars 14 forks source link

Parsing error: require() of ES Module #39

Open nbayramberdiyev opened 2 years ago

nbayramberdiyev commented 2 years ago

Description:

I'm getting the following error:

Parsing error: require() of ES Module

Dependencies:

"gatsby": "^4.21.1",
"gatsby-plugin-eslint": "^4.0.2",
"babel-eslint": "^10.1.0",
"eslint": "^8.23.0",
"eslint-plugin-react": "^7.31.1",
"eslint-webpack-plugin": "^3.2.0",
"gatsby-plugin-eslint": "^4.0.2"

The gatsby-config.js file:

// ...
{
  resolve: 'gatsby-plugin-eslint',
  options: {
    rulePaths: [
      path.join(
        process.cwd(),
        'node_modules',
        'gatsby',
        'dist',
        'utils',
        'eslint-rules',
      ),
    ],
    stages: ['develop'],
    extensions: ['js'],
    exclude: ['node_modules', '.cache', 'public', 'es'],
  },
},
// ...

The .eslintrc file:

{
  "parser": "babel-eslint",
  "settings": {
    "react": {
      "version": "detect"
    }
  },
  "env": {
    "browser": true,
    "node": true,
    "es6": true
  },
  "extends": ["eslint:recommended", "plugin:react/recommended"],
  "rules": {
    "no-anonymous-exports-page-templates": "warn",
    "limited-exports-page-templates": "warn",
    "strict": 0,
    "react/prop-types": 0,
    "react/no-unescaped-entities": 0,
    "no-irregular-whitespace": ["error", { "skipTemplates": true }]
  }
}

Why is this happening?