Skip to content

Commit

Permalink
Fix eslint warnings (#1388)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhildenbiddle committed Oct 9, 2020
1 parent 761210c commit 0afbf96
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/core/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 8 additions & 7 deletions src/core/init/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/core/render/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/core/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

1 comment on commit 0afbf96

@vercel
Copy link

@vercel vercel bot commented on 0afbf96 Oct 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.