question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Displaying Lint Output in the Editor" instructions not working in VS Code

See original GitHub issue

Description

The “Displaying Lint Output in the Editor” instructions do not work for VS Code.

Expected behavior

I expect my editor to show linting warnings and errors.

Actual behavior

ESLint is unable to load.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): This is coming back empty…
  2. node -v: 6.5.0
  3. npm -v: 3.10.3

Then, specify:

  1. Operating system: macOS
  2. Browser and version: N/A
  3. VS Code version: 1.5.3

Reproducible Demo

My working version of @wesbos’s React for Beginners project. I did change the value of eslintConfig.extends in package.json like the instructions state. Pull from c55d10ae48718695a0fca61b0981c8a4974ea92f to get a state where ESLint didn’t work.

Workaround

I got ESLint to work in VS Code by adding all of the dependencies (including eslint@3.5.0) as local dev dependencies to my project.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
octrefcommented, Oct 31, 2016

Hey @gaearon and @martellaj , to get linting working in VSCode, you need 4 things:

  1. Have eslint plugin for VSCode

  2. npm i -g eslint

  3. A .eslintrc.js like this, in your project root:

    module.exports = {
      "extends": "react-app"
    };
    
  4. Have npm@3 and run npm i in your project.

4 is needed as create-react-app seems to only install npm@2 style deps, but for VSCode’s eslint plugin to work node_modules/eslint-config-react-app needs to be present. Currently it’s at node_modules/react-scripts/node_modules/eslint-config-react-app.

I’m wondering if I can let create-react-app use npm@3 style deps (or yarn).

0reactions
dinhvlecommented, Apr 20, 2017

EsLint in VS Code is looking for .eslintrc.json, so to remove errors messages just add that to your root:

{
  "extends": "react-app"
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Linting Python in Visual Studio Code
To perform linting, open the Command Palette (Ctrl+Shift+P), filter on "linting", and select Python: Run Linting. Linting will run automatically when you save...
Read more >
ESLint not working in VSCode? Help build a troubleshooting ...
Open the command palette by pressing Ctrl / Cmd + Shift + P and select 'ESLint: Show Output Channel '. If ESLint throws...
Read more >
ESLint not working in VS Code? - Stack Overflow
To verify, press Ctrl + Shift + U in VSCode to open the Output panel after opening a JavaScript file with a known...
Read more >
How To Lint and Format Code with ESLint in Visual Studio Code
To find the settings in Visual Studio Code, use the command palette to open Preferences: Open Workspace Settings (JSON). With this code in...
Read more >
Advanced Visual Studio Code for Python Developers
To assign that shortcut to only work when you're editing Python code, ... The -q flag is a Python command-line flag to stop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found