Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/lint warnings #1388

Merged
merged 3 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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