var load = function (protocol, domains, path, query, cb) {
var tryRequest = function (at) {
var url = makeURL(protocol, domains[at], path, query)
loadScript(url, function (err) {
if (err) {
if (at >= domains.length - 1) {
cb(true) //https://google.com/#q=standard%2Fno-callback-literal Unexpected literal in error position of callback
} else {
tryRequest(at + 1)
}
} else {
cb(false) //https://google.com/#q=standard%2Fno-callback-literal Unexpected literal in error position of callback
}
})
}
tryRequest(0)
}
https://github.com/standard/s...
从这里我看到了callback(true)或callback(false)在ES6里是不被允许的,这上面的代码是由JS上改写的,应该怎样写才能符合ES6标准?
这是 eslint 的 standard 标准不允许的写法。
如果非要这么写,你可以在
.eslintrc.js
文件里的 rules 对象里配置来忽略这条规则。no-callback-literal: 0