react-redux:在模块主体中导入重新排序到顶部导入/首先 [英] react-redux: Import in body of module reorder to top import/first

查看:31
本文介绍了react-redux:在模块主体中导入重新排序到顶部导入/首先的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的错误

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.

我只是导入 Provider 以遵循标准添加 redux 存储.我对错误的搜索似乎导致禁用 ESLint.我假设很多人都将 Provider 用于 redux 存储,那么我是唯一遇到此错误的人吗?为什么 { Provider } from 'react-redux' 不遵循 ESLint 约定?我假设禁用 ESLint 是不正常的?

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?

推荐答案

问题似乎是您正在对导入的库进行 ESLinting,您可能不想这样做,因为您不想这样做改变它们.您需要将 ESLint 配置为仅处理您的代码.真的,您只是不想让 node_modules 位于/src 下.

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.

这篇关于react-redux:在模块主体中导入重新排序到顶部导入/首先的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆