gpt4 book ai didi

javascript - 为什么我的 ESlint 在保存时没有格式化?

转载 作者:行者123 更新时间:2023-12-04 17:24:16 26 4
gpt4 key购买 nike

我正在 Ubuntu 20.04 上使用 VSCode 在 JS(Node.js) 中编写代码。我配置了我的 ESlint设置.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',
session: false,
},

但什么也没发生。

问题

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?

最佳答案

看起来并非问题屏幕截图中列出的所有问题都是可自动修复的。因此,保存时自动检查似乎不起作用,但它在午餐前工作时很可能没问题。

尝试 linting 一个简单的文件,其中包含一个您确定会自动修复的错误。例如,使用错误类型的引号。

关于javascript - 为什么我的 ESlint 在保存时没有格式化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64426544/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com