0

I have the following error in the line of "import React" in each file.

import React, { Component } from 'react'

The error is the following:

Error while running ESlint: Cannot read property file: "path"

I already tried a solution to a similar question, but doesn´t work in my case.

This is my .eslintrc file:

{
  "extends": "airbnb",
  "parser": "babel-eslint",
  "plugins": [
    "import",
    "jsx-a11y",
    "react"
  ],
  "env": {
    "jest": true,
    "browser": true,
    "node": true
  },
  "rules": {
    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
    "global-require": 0,
    "comma-dangle": 0,
    "arrow-body-style": 0,
    "space-before-function-paren": 0,
    "import/no-extraneous-dependencies": 0,
    "react/jsx-filename-extension": 1,
    "react/forbid-prop-types": 1,
    "jsx-a11y/anchor-has-content": 0
  }
}

I tried adding this to my file, but doesn´t work:

"parserOptions": {
      "ecmaVersion": 6,
      "sourceType": "module",
      "ecmaFeatures": {
          "jsx": true
      }
  },
  "rules": {
    "semi": 2
  }
Iván
  • 401
  • 2
  • 6
  • 17

0 Answers0