style: xo
This commit is contained in:
@@ -8,9 +8,9 @@ module.exports = async (repositoryUrl, {cwd}, branches) => {
|
||||
return branches.reduce(
|
||||
(branches, branch) => [
|
||||
...branches,
|
||||
...remove(gitBranches, name => micromatch(gitBranches, branch.name).includes(name)).map(name => ({
|
||||
...remove(gitBranches, (name) => micromatch(gitBranches, branch.name).includes(name)).map((name) => ({
|
||||
name,
|
||||
...mapValues(omit(branch, 'name'), value => (isString(value) ? template(value)({name}) : value)),
|
||||
...mapValues(omit(branch, 'name'), (value) => (isString(value) ? template(value)({name}) : value)),
|
||||
})),
|
||||
],
|
||||
[]
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = async (repositoryUrl, ciBranch, context) => {
|
||||
const remoteBranches = await expand(
|
||||
repositoryUrl,
|
||||
context,
|
||||
context.options.branches.map(branch => (isString(branch) || isRegExp(branch) ? {name: branch} : branch))
|
||||
context.options.branches.map((branch) => (isString(branch) || isRegExp(branch) ? {name: branch} : branch))
|
||||
);
|
||||
|
||||
await pEachSeries(remoteBranches, async ({name}) => {
|
||||
@@ -32,7 +32,7 @@ module.exports = async (repositoryUrl, ciBranch, context) => {
|
||||
);
|
||||
|
||||
const result = Object.entries(DEFINITIONS).reduce((result, [type, {branchesValidator, branchValidator}]) => {
|
||||
branchesByType[type].forEach(branch => {
|
||||
branchesByType[type].forEach((branch) => {
|
||||
if (branchValidator && !branchValidator(branch)) {
|
||||
errors.push(getError(`E${type.toUpperCase()}BRANCH`, {branch}));
|
||||
}
|
||||
@@ -48,7 +48,7 @@ module.exports = async (repositoryUrl, ciBranch, context) => {
|
||||
}, {});
|
||||
|
||||
const duplicates = [...branches]
|
||||
.map(branch => branch.name)
|
||||
.map((branch) => branch.name)
|
||||
.sort()
|
||||
.filter((_, idx, array) => array[idx] === array[idx + 1] && array[idx] !== array[idx - 1]);
|
||||
|
||||
@@ -56,7 +56,7 @@ module.exports = async (repositoryUrl, ciBranch, context) => {
|
||||
errors.push(getError('EDUPLICATEBRANCHES', {duplicates}));
|
||||
}
|
||||
|
||||
await pEachSeries(branches, async branch => {
|
||||
await pEachSeries(branches, async (branch) => {
|
||||
if (!(await verifyBranchName(branch.name))) {
|
||||
errors.push(getError('EINVALIDBRANCHNAME', branch));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user