B
B
bormor2018-03-13 14:37:39
JavaScript
bormor, 2018-03-13 14:37:39

ESLint in create-react-app - how to use it via VSCode?

I'm learning react. Judging by the docs for create-react-app, it includes the config for eslint.
How to use this config via VSCode plugin?
If I don't manually install npm packages of eslint, cogfig and .eslintrc I get an error in VSCode:

[Info  - 12:21:21] ESLint server is running.
[Info  - 12:21:23] ESLint library loaded from: d:\React\test-project\node_modules\eslint\lib\api.js
[Warn  - 12:21:23] 
No ESLint configuration (e.g .eslintrc) found for file: d:\React\test-project\src\App.js
File will not be validated. Consider running 'eslint --init' in the workspace folder test-project
Alternatively you can disable ESLint by executing the 'Disable ESLint' command.

In the console after "npm start" or "yarn start" - eslint works correctly.
$ yarn start
yarn run v1.3.2
$ react-scripts start
Compiled with warnings.

./src/App.js
  Line 5:  'test' is assigned a value but never used  no-unused-vars

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2018-03-13
@bormor

https://github.com/facebook/create-react-app/issue...
Add to package.json

"eslintConfig": {
    "extends": "react-app"
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question