Skip to content

Commit

Permalink
chore: Run lint after update
Browse files Browse the repository at this point in the history
  • Loading branch information
acezard committed Dec 2, 2021
1 parent 921d530 commit b6eb830
Show file tree
Hide file tree
Showing 106 changed files with 402 additions and 504 deletions.
9 changes: 2 additions & 7 deletions packages/babel-preset-cozy-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,8 @@ const mkConfig = (api, options) => {
merge(presetOptions, ...libConfigs)
}

const {
node,
react,
presetEnv,
transformRuntime,
transformRegenerator
} = presetOptions
const { node, react, presetEnv, transformRuntime, transformRegenerator } =
presetOptions

const config = {}

Expand Down
30 changes: 16 additions & 14 deletions packages/babel-preset-cozy-app/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ const isFalse = (value, key) => {
}
}

const either = (...validators) => (value, key) => {
let errors = []
for (const validator of validators) {
try {
validator(value, key)
return
} catch (e) {
errors.push(e)
const either =
(...validators) =>
(value, key) => {
let errors = []
for (const validator of validators) {
try {
validator(value, key)
return
} catch (e) {
errors.push(e)
}
}
throw new Error(
`"${value}" at ${key} did not pass either validator : ${errors
.map(e => e.message)
.join('\n')}`
)
}
throw new Error(
`"${value}" at ${key} did not pass either validator : ${errors
.map(e => e.message)
.join('\n')}`
)
}

const validate = (obj, validators) => {
for (const key of Object.keys(obj)) {
Expand Down
6 changes: 1 addition & 5 deletions packages/cli-tree/src/completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ async function completionHandler(commands = {}) {

const command = findCommand(
{ _main: commands },
'_main ' +
env.line
.split(' ')
.slice(1)
.join(' ')
'_main ' + env.line.split(' ').slice(1).join(' ')
)
if (!command) process.exit(1)

Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-app-publish/src/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const promptConfirm = question =>
}
]

return prompt.get(promptProperties, function(err, received) {
return prompt.get(promptProperties, function (err, received) {
console.log()
if (err) {
reject(new Error(colorize.red(`prompt: ${err}`)))
Expand Down
18 changes: 6 additions & 12 deletions packages/cozy-app-publish/src/cozy-app-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ parser.addArgument('--token', {
})
parser.addArgument('--space', {
metavar: 'space-name',
help:
'Registry space name to publish the application to (default __default__)'
help: 'Registry space name to publish the application to (default __default__)'
})
parser.addArgument('--build-dir', {
metavar: 'relative-path',
dest: 'buildDir',
help:
'Path of the build directory relative to the current directory (default ./build)'
help: 'Path of the build directory relative to the current directory (default ./build)'
})
parser.addArgument('--build-url', {
metavar: 'url',
Expand All @@ -50,24 +48,20 @@ parser.addArgument('--build-commit', {
parser.addArgument('--manual-version', {
metavar: 'version',
dest: 'manualVersion',
help:
'Specify a version manually (must not be already published in the registry)'
help: 'Specify a version manually (must not be already published in the registry)'
})
parser.addArgument('--prepublish', {
metavar: 'script-path',
help:
'Hook to process parameters just before publishing, typically to upload archive on custom host'
help: 'Hook to process parameters just before publishing, typically to upload archive on custom host'
})
parser.addArgument('--postpublish', {
metavar: 'script-path',
help:
'Hook to process parameters just after publishing, typically to deploy app'
help: 'Hook to process parameters just after publishing, typically to deploy app'
})
parser.addArgument('--tag-prefix', {
metavar: 'tag-prefix',
dest: 'tagPrefix',
help:
'When publishing from a monorepo, only consider tags with tagPrefix, ex: cozy-banks/1.0.1.'
help: 'When publishing from a monorepo, only consider tags with tagPrefix, ex: cozy-banks/1.0.1.'
})
parser.addArgument('--registry-url', {
metavar: 'url',
Expand Down
6 changes: 2 additions & 4 deletions packages/cozy-app-publish/src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const spawn = require('child_process').spawn
const logger = require('./utils/logger')

const launchCmd = (cmd, params, options) => {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
const result = { stdout: [], stderr: [] }
const cmdOptions = { encoding: 'utf8', ...options }
Expand Down Expand Up @@ -37,10 +38,7 @@ const getCurrentTags = async () => {
logger.info('No tags')
return []
}
const gitTags = result.stdout
.join('')
.split('\n')
.filter(Boolean)
const gitTags = result.stdout.join('').split('\n').filter(Boolean)

logger.info('Current tags: ', gitTags.join(', '))
return gitTags
Expand Down
5 changes: 3 additions & 2 deletions packages/cozy-app-publish/src/hooks/post/mattermost.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ const getMessage = options => {
]
.filter(Boolean)
.join('\n')
const message = `${appTypeLabelMap[appType] ||
''} __${appSlug}__ version \`${appVersion}\` has been published${spaceMessage}.${
const message = `${
appTypeLabelMap[appType] || ''
} __${appSlug}__ version \`${appVersion}\` has been published${spaceMessage}.${
infos.length > 0 ? '\n\n' + infos : ''
}`
return message
Expand Down
4 changes: 2 additions & 2 deletions packages/cozy-app-publish/src/hooks/post/mattermost.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ describe('sendMattermost Post', () => {
end: endSpy
}
})
// eslint-disable-next-line no-useless-catch
try {
await sendMattermostReleaseMessage(commonInfo)
expect(JSON.parse(writeSpy.mock.calls[0][0])).toEqual({
channel: 'gh-notif-appvenger',
icon_url: 'https://files.cozycloud.cc/travis.png',
username: 'Travis',
text:
'Application __banks__ version `1.6.1` has been published on space __banks__.\n\n- [Last commit: Beautiful commit title & a beautiful ampersand 😍 ](https://github.com/cozy/cozy-banks/commits/sha1deadbeef)\n- [Job](https://travis.com/cozy/cozy-banks/jobs/jobId1234)'
text: 'Application __banks__ version `1.6.1` has been published on space __banks__.\n\n- [Last commit: Beautiful commit title & a beautiful ampersand 😍 ](https://github.com/cozy/cozy-banks/commits/sha1deadbeef)\n- [Job](https://travis.com/cozy/cozy-banks/jobs/jobId1234)'
})
expect(https.request).toHaveBeenCalledWith(
{
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-app-publish/src/manual.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const manualPublish = publisher({
showConfirmation: true
})

const manualPublishCLI = function() {
const manualPublishCLI = function () {
return manualPublish.apply(this, arguments).catch(e => {
console.error(e)
console.error(e.message)
Expand Down
Loading

0 comments on commit b6eb830

Please sign in to comment.