我正在尝试使用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运行测试文件时,棉绒通过成功。
我不知道为什么。我在网上查找了它,看来我的配置文件确实很好。
您的解决方案与此帖子的答案相同。
但是,更适合您的是您只编辑.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 ...
}
您瞄准的那条线是
摩卡:真实
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句