chore(package): update xo to version 0.21.0
This commit is contained in:
committed by
Pierre Vanduynslager
parent
cd9f2bdd44
commit
f3e4991819
@@ -20,6 +20,7 @@ const {gitTags, isRefInHistory, gitTagHead} = require('./git');
|
||||
* - Sort the versions
|
||||
* - Retrive the highest version
|
||||
*
|
||||
* @param {String} tagFormat Git tag format.
|
||||
* @param {Object} logger Global logger.
|
||||
* @return {Promise<LastRelease>} The last tagged release or `undefined` if none is found.
|
||||
*/
|
||||
|
||||
+15
-16
@@ -37,21 +37,20 @@ module.exports = (pluginType, pluginsPath, globalOpts, pluginOpts, logger) => {
|
||||
throw getError('EPLUGIN', {pluginType, pluginName});
|
||||
}
|
||||
|
||||
return Object.defineProperty(
|
||||
async input => {
|
||||
const definition = PLUGINS_DEFINITIONS[pluginType];
|
||||
try {
|
||||
const result = await func(cloneDeep(input));
|
||||
if (definition && definition.output && !definition.output.validator(result)) {
|
||||
throw getError(PLUGINS_DEFINITIONS[pluginType].output.error, {result, pluginName});
|
||||
}
|
||||
return result;
|
||||
} catch (err) {
|
||||
extractErrors(err).forEach(err => Object.assign(err, {pluginName}));
|
||||
throw err;
|
||||
const validator = async input => {
|
||||
const definition = PLUGINS_DEFINITIONS[pluginType];
|
||||
try {
|
||||
const result = await func(cloneDeep(input));
|
||||
if (definition && definition.output && !definition.output.validator(result)) {
|
||||
throw getError(PLUGINS_DEFINITIONS[pluginType].output.error, {result, pluginName});
|
||||
}
|
||||
},
|
||||
'pluginName',
|
||||
{value: pluginName, writable: false, enumerable: true}
|
||||
);
|
||||
return result;
|
||||
} catch (err) {
|
||||
extractErrors(err).forEach(err => Object.assign(err, {pluginName}));
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
Reflect.defineProperty(validator, 'pluginName', {value: pluginName, writable: false, enumerable: true});
|
||||
return validator;
|
||||
};
|
||||
|
||||
+2
-2
@@ -6,14 +6,14 @@ const getError = require('./get-error');
|
||||
module.exports = async options => {
|
||||
const errors = [];
|
||||
|
||||
if (!await isGitRepo()) {
|
||||
if (!(await isGitRepo())) {
|
||||
errors.push(getError('ENOGITREPO'));
|
||||
} else if (!options.repositoryUrl) {
|
||||
errors.push(getError('ENOREPOURL'));
|
||||
}
|
||||
|
||||
// Verify that compiling the `tagFormat` produce a valid Git tag
|
||||
if (!await verifyTagName(template(options.tagFormat)({version: '0.0.0'}))) {
|
||||
if (!(await verifyTagName(template(options.tagFormat)({version: '0.0.0'})))) {
|
||||
errors.push(getError('EINVALIDTAGFORMAT', {tagFormat: options.tagFormat}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user