LifterCoder
LifterCoder

Reputation: 152

react-redux: Import in body of module reorder to top import/first

here is my error

Failed to compile 
./src/node_modules/react-redux/es/components/Provider.js
  Line 7:   Import in body of module; reorder to top  import/first
  Line 8:   Import in body of module; reorder to top  import/first
  Line 9:   Import in body of module; reorder to top  import/first
  Line 10:  Import in body of module; reorder to top  import/first

Search for the keywords to learn more about each error.

I am just importing Provider to follow standard to add redux store. My search of the error seem to lead to disable ESLint. I am assuming that many people are using Provider for redux store so am I the only person that have this error? Why would { Provider } from 'react-redux' not follow ESLint convention? I am assuming that it is not normal to disable ESLint?

Upvotes: 1

Views: 2521

Answers (2)

Abhay
Abhay

Reputation: 6760

Most probably you are using Eslint. If so Add the following rules, it will gonna solve your issue. Modify .eslintrc

"rules": {
    "import/first": 0,
    "import/order": 0
}

Upvotes: 0

billjamesdev
billjamesdev

Reputation: 14642

The problem would seem to be that you're ESLinting the libraries you import, which you probably don't want to do, since you don't want to change them. You'll want to configure ESLint to only process YOUR code. Really, you just don't want to have node_modules be under /src.

Upvotes: 1

Related Questions