作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 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/
我正在尝试将 ESLINT 与 eslint . 一起使用在我的根目录上并遇到此错误: YAMLException: Cannot read config file: /mypath/node_mod
我是一名优秀的程序员,十分优秀!