Why is my ESlinter not formatting on save?

447 views Asked by At

I am writing code in JS(Node.js) using VSCode on Ubuntu 20.04. I configured my ESlint settings.json

{
    "todo-tree.tree.showScanModeButton": false,
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
      },
      "eslint.validate": ["javascript"]
}

And .eslinterc.js

module.exports = {
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:react/recommended"
    ],
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 12,
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules" : {
        "no-console": "off",
         "quotes": [
            "error",
            "double"
          ]
      }
};

My first part of the code was formatted on save

passport.use("register", new LocalStrategy(
    {
        usernameField: "username",
        passwordField: "password",
        passReqToCallback: true,
        session: false,
    },

After the lunch break,I added new lines

passport.use(
  'login',
  new LocalStrategy(
    {
      usernameField: 'username',
      passwordField: 'password',
      session: false,
    },

but nothing happens.

PROBLEMS

enter image description here

It says that server is running

[Info  - 1:24:15 PM] ESLint server is starting
[Info  - 1:24:15 PM] ESLint server running in node v12.14.1
[Info  - 1:24:15 PM] ESLint server is running.
[Info  - 1:24:16 PM] ESLint library loaded from: /home/milenko/myblog/backend/node_modules/eslint/lib/api.js

How to control my ESlinter?

1

There are 1 answers

1
Phil On BEST ANSWER

It looks like not all the problems listed in the PROBLEMS screenshot are auto-fixable. Therefore it might seem like the auto-lint on save is not working, but chances are it is fine when it was working before lunch.

Try linting a simple file with an error that you are sure of will auto-fix. Like using the wrong type of quotes for example.