avani kothari
avani kothari

Reputation: 739

eslint not giving errors in VSCode according to rules in .eslintrc file

I have installed eslint globally using npm and I have added my own .eslintrc file which contains following code:

{
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true,
        "node": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:react/recommended"
    ],
    "parserOptions": {
        "ecmaFeatures": {
            "experimentalObjectRestSpread": true,
            "jsx": true
        },
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
        "indent": [
            "error",
            "tab"
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "always"
        ]
    }
}

I have added following dev dependencies:

"eslint": "3.19.0",
    "eslint-config-standard": "10.2.1",
    "eslint-plugin-import": "2.7.0",
    "eslint-plugin-markdown": "1.0.0-beta.6",
    "eslint-plugin-node": "5.1.1",
    "eslint-plugin-promise": "3.5.0",
    "eslint-plugin-standard": "3.0.1"

and also installed eslint-plugin-react in my react native project. Still no indentation, semi colon, double quotes errors are shown, although parsing errors are shown. P.S. eslint plugin is enabled in VScode.

Upvotes: 9

Views: 3518

Answers (1)

Zolbayar
Zolbayar

Reputation: 936

Exact same thing happened to me. And I found out the cause of this issue by looking at the Eslint log:

  1. Open Command Palette by Ctrl + Shift + P
  2. Select Eslint: Show Output Channel

In my case, the output channel displayed this: Failed to load config "airbnb-base" to extend from. Referenced from: ...eslintrc.js

I just forgot to do npm install after adding the dev dependencies!

Upvotes: 2

Related Questions