eslint - ESLint 没有为 console.log 发送警告
问题描述
我有以下 .eslintrc ...
{
plugins: [
'markdown',
'json'
],
parserOptions: {
'ecmaVersion': 2017,
'sourceType': 'module',
},
extends: [
'eslint:recommended',
'plugin:vue/essential'
]
}
为了测试它,我向 test.js 添加了一个控制台语句并运行./node_modules/.bin/eslint <folder>/test.js
. 我希望看到类似...
警告 Unexpected console statement
no-console
但相反,我没有看到任何输出。我错过了什么?
解决方案
我认为它会为你工作。注意扩展和插件。我在我的项目中使用了这个结构,一切都很好。你console.log
在.js文件中添加了,eslint:recommended
就可以了。
module.exports = {
root: true,
parserOptions: {
parser: "babel-eslint",
sourceType: "module"
},
env: {
browser: true
},
extends: [
"eslint:recommended",
"plugin:vue/recommended"
],
plugins: [
"vue" // required to lint *.vue files
],
// add your custom rules here
rules: {
"arrow-parens": 0,
"generator-star-spacing": 0,
"no-debugger": process.env.NODE_ENV === "production" ? 2 : 0
}
}
推荐阅读
- c# - 让 Hangfire 使用 MongoDB 存储
- c - 无需乘法即可计算阶乘的嵌套循环
- c# - 只读与静态只读澄清
- wpf - WrapPanel里面的WPF数据网格?
- reactjs - React intel 和 i18next React-Native
- java - Selenium - 如何确认提交后更改了带有两个数字的验证码
- php - CodeIgniter 分页不起作用(在其他页面中)
- angular - ionic 4 - 这是 ngx-translate 的最佳方式?
- javascript - 除了具有浮动和中心的 div 类之外,布局 div
- c# - Costura.Fody 未嵌入 .pdb