Fix eslint warnings (#1388)

This commit is contained in:
John Hildenbiddle 2020-10-08 21:58:30 -05:00 committed by GitHub
parent 761210c2cf
commit 0afbf96701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View File

@ -73,7 +73,7 @@ export function fetchMixin(proto) {
case 'object':
key = Object.keys(notFoundPage)
.sort((a, b) => b.length - a.length)
.find(key => path.match(new RegExp('^' + key)));
.find(k => path.match(new RegExp('^' + k)));
path404 = (key && notFoundPage[key]) || defaultPath;
break;

View File

@ -18,21 +18,22 @@ export function initLifecycle(vm) {
});
}
export function callHook(vm, hook, data, next = noop) {
const queue = vm._hooks[hook];
export function callHook(vm, hookName, data, next = noop) {
const queue = vm._hooks[hookName];
const step = function(index) {
const hook = queue[index];
const hookFn = queue[index];
if (index >= queue.length) {
next(data);
} else if (typeof hook === 'function') {
if (hook.length === 2) {
hook(data, result => {
} else if (typeof hookFn === 'function') {
if (hookFn.length === 2) {
hookFn(data, result => {
data = result;
step(index + 1);
});
} else {
const result = hook(data);
const result = hookFn(data);
data = result === undefined ? data : result;
step(index + 1);
}

View File

@ -14,6 +14,7 @@ function walkFetchEmbed({ embedTokens, compile, fetch }, cb) {
}
while ((token = embedTokens[step++])) {
// eslint-disable-next-line no-shadow
const next = (function(token) {
return text => {
let embedToken;

View File

@ -190,7 +190,9 @@ export function renderMixin(proto) {
html = formatUpdated(html, opt.updatedAt, this.config.formatUpdated);
}
callHook(this, 'afterEach', html, text => renderMain.call(this, text));
callHook(this, 'afterEach', html, hookData =>
renderMain.call(this, hookData)
);
};
if (this.isHTML) {