gpt4 book ai didi

javascript - YAMLException : Error: duplicated mapping key at line 45, 列 30 : "beforeLineComment": false,

转载 作者:行者123 更新时间:2023-12-02 13:49:16 26 4
gpt4 key购买 nike

我正在尝试将 ESLINT 与 eslint . 一起使用在我的根目录上并遇到此错误:

YAMLException: Cannot read config file: 
/mypath/node_modules/extend/.eslintrc Error:
duplicated mapping key at line 45, column 30: "beforeLineComment": false,

我有节点 v6.9.1eslint 是 v3.12.1

这是我的 .eslintrc.json 配置文件:

{
"rules": {
"indent": [2, 2],
"quotes": [2, "single"],
"linebreak-style": [2, "unix"],
"semi": [2, "always"],
"no-underscore-dangle": 0,
"curly": 0,
"no-use-before-define": [2, "nofunc"],
"spaced-comment": [2, "always"],
"space-before-function-paren": [2, { "anonymous": "always", "named": "never" }],
"space-after-keywords": [2, "always"],
"space-before-blocks": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}],
"no-var": 2,
"object-shorthand": [2, "always"],
"prefer-const": 2
},
"env": {
"es6": true,
"node": true,
"mocha": true
}
}

如您所见,我使用的是 json 而不是 YAML,我不知道为什么会发生该错误。

最佳答案

正如您发布的异常中所指出的,错误实际上并没有发生在您的配置中,而是发生在您从 node_modules/extend/.eslintrc 中扩展的配置中(看起来已经奇怪)。

如果您使用 --debug 标志运行 eslint,您可以获得更多有关配置加载的信息。它将打印出有关 ESLint 正在加载和合并的配置文件的所有信息。这应该为您指明正确的方向,以查找谁在扩展该配置以及原因。

关于javascript - YAMLException : Error: duplicated mapping key at line 45, 列 30 : "beforeLineComment": false,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41131738/

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