为什么我的ESlinter在保存时不格式化?

问题描述

我正在Ubuntu 20.04上使用VSCode在JS(Node.js)中编写代码。 我配置了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"]
}

.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"
          ]
      }
};

我的第一部分代码是在保存时格式化的

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

午休后,我添加了新行

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

但什么也没发生。

问题

enter image description here

它表示服务器正在运行

[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

如何控制我的ESlinter?

解决方法

似乎“问题”屏幕快照中列出的所有问题都不是可以自动修复的。因此,保存时的自动棉绒似乎无法正常工作,但是午餐前工作的时候很好。

尝试插入一个简单文件,并确认您会自动修复该错误。例如使用错误的引号类型。