简体   繁体   中英

.eslintrc: Configuration for rule "import/extensions" is invalid:

First things first, I have some basics but I don't consider myself as a developer at all :p Here's my problem: I cloned a repo ( this one ) in order to work on a brand new portfolio and test the whole enchilada, but i ran into some errors, as I'm not familiar at all with the eslint setup.

After cloning the repo, I try to gatsby develop and I ran into a few error messages like this one:


Generating development JavaScript bundle failed


/home/asus/code/chrisnopa/gatsby-projects/portf-boilerplate/src/hoc/withProvider.js
  4:25  error  Missing file extension for "store/createStore"  import/extensions

✖ 1 problem (1 error, 0 warnings)


File: src/hoc/withProvider.js

Here's the content of my .eslintrc file :

  "parser": "babel-eslint",
  "env": {
    "browser": true,
    "jest": true,
    "es6": true,
    "node": true
  },
  "extends": [
    "airbnb",
    "prettier"
  ],
  "plugins": [
    "prettier"
  ],
  "globals": {
    "graphql": true
  },
  "rules": {
    "react/jsx-filename-extension": 0,
    "react/require-default-props": 0,
    "react/jsx-one-expression-per-line": 0,
    "arrow-body-style": 0,
    "import/no-unresolved": 0,
    "prettier/prettier": ["error", {
      "semi": true,
      "singleQuote": true,
      "trailingComma": "es5"
    }]
  }
}

I added this line to the part "Rules" : "import/extensions": [".js", ".jsx", ".json", ".ts", ".tsx"] and it fixed everything except for one error. Here is the message in my console :


Generating development JavaScript bundle failed

.eslintrc:
    Configuration for rule "import/extensions" is invalid:
    Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '".js"').


File: src/pages/index.js

failed Building development bundle - 4.029s

Any idea on what I am doing wrong here, and on how to fix this would be much appreciated!

将 eslint-plugin-import 更新到 v2.11.0(或更高版本)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM