Skip to content

Commit

Permalink
Fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GenieTim committed Feb 23, 2021
1 parent d5c2553 commit 45a8555
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions packages/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,29 @@ module.exports = createPrompt((config, done) => {

if (isEnterKey(key)) {
rl.pause();
editAsync(config.default || '', async (error, answer) => {
rl.resume();
if (error) {
setError(error);
} else {
setStatus('loading');
const isValid = await config.validate(answer);
if (isValid === true) {
setError(undefined);
setStatus('done');
done(answer);
editAsync(
config.default || '',
async (error, answer) => {
rl.resume();
if (error) {
setError(error);
} else {
setError(isValid || 'You must provide a valid value');
setStatus('pending');
setStatus('loading');
const isValid = await config.validate(answer);
if (isValid === true) {
setError(undefined);
setStatus('done');
done(answer);
} else {
setError(isValid || 'You must provide a valid value');
setStatus('pending');
}
}
},
{
postfix: config.postfix || '.txt',
}
}, {
postfix: config.postfix || ".txt"
});
);
}
});

Expand Down

0 comments on commit 45a8555

Please sign in to comment.