简体   繁体   中英

eslint with create-react-app facebook incubator

i can not use eslint with create-react-app

eslint src/App.js

it said in the console

Error: Cannot find module 'eslint-config-react-app'
Referenced from: /home/user-name/Code/react/dev.app/.eslintrc
    at ModuleResolver.resolve (/usr/lib/node_modules/eslint/lib/util/module-resolver.js:74:19)
    at resolve (/usr/lib/node_modules/eslint/lib/config/config-file.js:515:25)
    at load (/usr/lib/node_modules/eslint/lib/config/config-file.js:584:26)
    at configExtends.reduceRight.e (/usr/lib/node_modules/eslint/lib/config/config-file.js:421:36)
    at Array.reduceRight (native)
    at applyExtends (/usr/lib/node_modules/eslint/lib/config/config-file.js:405:28)
    at loadFromDisk (/usr/lib/node_modules/eslint/lib/config/config-file.js:556:22)
    at Object.load (/usr/lib/node_modules/eslint/lib/config/config-file.js:592:20)
    at Config.getLocalConfigHierarchy (/usr/lib/node_modules/eslint/lib/config.js:228:44)
    at Config.getConfigHierarchy (/usr/lib/node_modules/eslint/lib/config.js:182:43)

the eslint works properly in the global and i have tried to install eslint-config-react-app in the global also the local project folder. My project folder looks like

node_modules
public
src
.eslintrc
.gitignore
.README.md
package.json

everything seems to be good ? how can i resolve the problem, thank you

Looks like, you haven't installed some eslint packages to your node modules, try:

yarn add --dev eslint-config-react-app

or

npm install --save-dev eslint-config-react-app

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