我有一个.eslintrc.js文件,如下所示:
module.exports = {
"env": {
"browser": true
},
"extends": ["eslint:recommended", "plugin:compat/recommended"],
"plugins": [
// lint for unsupported es6 features in ie11 (not that I'm trying to
// excessively use es6, mostly idk what ie11 doesnt support and I'm used
// to using certain methods like String.includes)
"ie11",
"compat"
],
// need to setup stylelint.io for linting for css features
// https://stylelint.io/
// https://github.com/ismay/stylelint-no-unsupported-browser-features
// it also references the same "browserslist" in package.json
// this won't work, but when it does, npm install --save-dev eslint-plugin-compat
// the extends compat/recommended will work
"rules": {
"ie11/no-collection-args": [ "error" ],
"ie11/no-for-in-const": [ "error" ],
"ie11/no-loop-func": [ "warn" ],
"ie11/no-weak-collections": [ "error" ],
"no-console": "off",
"semi": [
"error",
"always"
],
"no-mixed-spaces-and-tabs": "off",
"compat/compat": "error"
},
"settings": {
"polyfills": ['']
},
"parserOptions": {
"ecmaVersion": 5
}
};
将navigator.serviceWorker添加到js文件时,vscode中没有警告(我确实收到未使用的var的警告,因此我的编辑器插件和eslint正常工作)
但是当我将package.json中的browserslist设置为99.99%时,我没有收到任何新警告。但是,在IE11中,由于未定义的String.repeat方法,我的代码无法运行。 (代码在chrome和firefox中一直有效)
您的猜测与我的一样好!我尝试在本地安装eslint +插件,并在全局安装eslint + plugins
我也确实尝试删除parserOptions es5选项..注释掉settings.polyfills ..删除除compat插件和我的自定义规则以外的所有内容..不知道还要尝试什么
在自动修复之后,我还使用eslint .
在命令行中进行了两次检查,结果与我的编辑器没有什么不同。
节点-v === v8.12.0 npm -v === 6.4.1 eslint -v === v5.7.0
是否有brew doctor
这样的押金?