我正在尝试使用ESLint进行摩卡咖啡,但是由于某些原因,该规则不适用,棉绒也无法通过。
我的配置文件:
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true,
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"expect": "true"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
overrides: [
{
files: [
"**/*.test.js"
],
env: {
mocha: true
},
plugins: ["mocha"],
rules: {
"mocha/no-exclusive-tests": "error",
"mocha/no-pending-tests": "error"
}
}
]
};
我的测试文件仅包含一行:
it('should throw a lint error')
由于“没有待决的测试”规则,短绒棉应该发现错误,但是当我使用eslint运行测试文件时,棉绒成功通过了。
我不知道为什么。我在网上查找了它,看起来我的配置文件看起来不错。
答案 0 :(得分:1)
您的解决方案与此帖子answer相同。
但是,更适合您的是您只编辑 .eslintrc 文件的文件,如eslint-configuration-doc所示,如下所示:
module.exports = {
env: {
browser: false,
es6: true,
node: true,
mocha: true
}
// More code to go on that is not relative to your question ...
}
您瞄准的线是
摩卡咖啡:是
答案 1 :(得分:1)
此解决方案对我有用。
{
"env": {
"browser": true,
"es6": true,
"mocha": true // add mocha as true to your ".eslintrc. *" file
}
}