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

chore(deps-dev): Bump @readme/eslint-config from 1.10.0 to 1.11.0 #134

Merged
merged 2 commits into from
Feb 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"trailingComma": "es5"
}
5 changes: 1 addition & 4 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ module.exports = processArgv => {
//
// Instead of failing out to the user with an undecipherable "Unknown value: ..." error, let's
// try to parse their request again but a tad less eager.
if (
(e.name !== 'UNKNOWN_VALUE' || (e.name === 'UNKNOWN_VALUE' && !argv.version)) &&
argv.command !== 'oas'
) {
if ((e.name !== 'UNKNOWN_VALUE' || (e.name === 'UNKNOWN_VALUE' && !argv.version)) && argv.command !== 'oas') {
throw e;
}

Expand Down
10 changes: 3 additions & 7 deletions cmds/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,10 @@ exports.run = function(opts) {
}

if (!folder) {
return Promise.reject(
new Error(`No folder provided. Usage \`${config.cli} ${exports.usage}\`.`),
);
return Promise.reject(new Error(`No folder provided. Usage \`${config.cli} ${exports.usage}\`.`));
}

const files = fs
.readdirSync(folder)
.filter(file => file.endsWith('.md') || file.endsWith('.markdown'));
const files = fs.readdirSync(folder).filter(file => file.endsWith('.md') || file.endsWith('.markdown'));

const options = {
auth: { user: key },
Expand Down Expand Up @@ -116,6 +112,6 @@ exports.run = function(opts) {
.catch(err => {
return Promise.reject(err);
});
}),
})
);
};
4 changes: 1 addition & 3 deletions cmds/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ async function getCredentials(opts) {
return {
email: await read({ prompt: 'Email:', default: configStore.get('email') }),
password: await read({ prompt: 'Password:', silent: true }),
project:
opts.project ||
(await read({ prompt: 'Project subdomain:', default: configStore.get('project') })),
project: opts.project || (await read({ prompt: 'Project subdomain:', default: configStore.get('project') })),
token: opts['2fa'] && (await read({ prompt: '2fa token:' })),
};
}
Expand Down
2 changes: 1 addition & 1 deletion cmds/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ exports.run = async () => {
}

return Promise.resolve(
`You have logged out of Readme. Please use \`${config.cli} ${loginCmd.command}\` to login again.`,
`You have logged out of Readme. Please use \`${config.cli} ${loginCmd.command}\` to login again.`
);
};
10 changes: 3 additions & 7 deletions cmds/oas.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ exports.position = 1;
exports.args = [];

exports.run = function() {
const cp = spawn(
path.join(__dirname, '..', 'node_modules', '.bin', 'oas'),
process.argv.slice(3),
{
stdio: 'inherit',
},
);
const cp = spawn(path.join(__dirname, '..', 'node_modules', '.bin', 'oas'), process.argv.slice(3), {
stdio: 'inherit',
});

return new Promise((resolve, reject) => {
cp.on('close', code => {
Expand Down
21 changes: 7 additions & 14 deletions cmds/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ exports.run = async function(opts) {
let isUpdate;

if (!key && opts.token) {
console.warn(
'Using `rdme` with --token has been deprecated. Please use `--key` and `--id` instead.',
);
console.warn('Using `rdme` with --token has been deprecated. Please use `--key` and `--id` instead.');

[key, id] = opts.token.split('-');
}
Expand All @@ -77,7 +75,7 @@ exports.run = async function(opts) {
'',
// eslint-disable-next-line no-underscore-dangle
`\trdme swagger FILE --key=${key} --id=${JSON.parse(data.body)._id}`.green,
].join('\n'),
].join('\n')
);
}

Expand Down Expand Up @@ -109,9 +107,7 @@ exports.run = async function(opts) {
function updateSpec(specId) {
isUpdate = true;

return request
.put(`${config.host}/api/v1/api-specification/${specId}`, options)
.then(success, error);
return request.put(`${config.host}/api/v1/api-specification/${specId}`, options).then(success, error);
}

/*
Expand Down Expand Up @@ -150,17 +146,14 @@ exports.run = async function(opts) {
try {
if (versionFlag) {
options.json.version = versionFlag;
const foundVersion = await request.get(
`${config.host}/api/v1/version/${versionFlag}`,
options,
);
const foundVersion = await request.get(`${config.host}/api/v1/version/${versionFlag}`, options);

return foundVersion.version;
}

const versionList = await request.get(`${config.host}/api/v1/version`, options);
const { option, versionSelection, newVersion } = await prompt(
promptOpts.generatePrompts(versionList, versionFlag),
promptOpts.generatePrompts(versionList, versionFlag)
);

if (option === 'update') return versionSelection;
Expand Down Expand Up @@ -199,8 +192,8 @@ exports.run = async function(opts) {
reject(
new Error(
"We couldn't find a Swagger or OpenAPI file.\n\n" +
'Run `rdme swagger ./path/to/file` to upload an existing file or `rdme oas init` to create a fresh one!',
),
'Run `rdme swagger ./path/to/file` to upload an existing file or `rdme oas init` to create a fresh one!'
)
);
});
};
12 changes: 4 additions & 8 deletions cmds/versions/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ exports.run = async function(opts) {

if (!version || !semver.valid(semver.coerce(version))) {
return Promise.reject(
new Error(
`Please specify a semantic version. See \`${config.cli} help ${exports.command}\` for help.`,
),
new Error(`Please specify a semantic version. See \`${config.cli} help ${exports.command}\` for help.`)
);
}

Expand All @@ -82,9 +80,7 @@ exports.run = async function(opts) {
is_stable: main === 'true' || promptResponse.is_stable,
is_beta: beta === 'true' || promptResponse.is_beta,
from: fork || promptResponse.from,
is_hidden: promptResponse.is_stable
? false
: !(isPublic === 'true' || promptResponse.is_hidden),
is_hidden: promptResponse.is_stable ? false : !(isPublic === 'true' || promptResponse.is_hidden),
},
auth: { user: key },
};
Expand All @@ -97,8 +93,8 @@ exports.run = async function(opts) {
new Error(
err.error && err.error.description
? err.error.description
: 'Failed to create a new version using your specified parameters.',
),
: 'Failed to create a new version using your specified parameters.'
)
);
});
};
10 changes: 2 additions & 8 deletions cmds/versions/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ exports.run = async function(opts) {

if (!version || !semver.valid(semver.coerce(version))) {
return Promise.reject(
new Error(
`Please specify a semantic version. See \`${config.cli} help ${exports.command}\` for help.`,
),
new Error(`Please specify a semantic version. See \`${config.cli} help ${exports.command}\` for help.`)
);
}

Expand All @@ -44,11 +42,7 @@ exports.run = async function(opts) {
.then(() => Promise.resolve(`Version ${version} deleted successfully.`))
.catch(err => {
return Promise.reject(
new Error(
err.error && err.error.description
? err.error.description
: 'Failed to delete target version.',
),
new Error(err.error && err.error.description ? err.error.description : 'Failed to delete target version.')
);
});
};
11 changes: 4 additions & 7 deletions cmds/versions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ const versionsCreate = require('./create');

exports.command = 'versions';
exports.usage = 'versions [options]';
exports.description =
'List versions available in your project or get a version by SemVer (https://semver.org/).';
exports.description = 'List versions available in your project or get a version by SemVer (https://semver.org/).';
exports.category = 'versions';
exports.position = 1;

Expand Down Expand Up @@ -87,9 +86,7 @@ exports.run = function(opts) {
return Promise.reject(new Error('No project API key provided. Please use `--key`.'));
}

const uri = version
? `${config.host}/api/v1/version/${version}`
: `${config.host}/api/v1/version`;
const uri = version ? `${config.host}/api/v1/version/${version}` : `${config.host}/api/v1/version`;

return request
.get(uri, {
Expand All @@ -109,8 +106,8 @@ exports.run = function(opts) {
if (!versions.length) {
return Promise.reject(
new Error(
`Sorry, you haven't created any versions yet! See \`${config.cli} help ${versionsCreate.command}\` for commands on how to do that.`,
),
`Sorry, you haven't created any versions yet! See \`${config.cli} help ${versionsCreate.command}\` for commands on how to do that.`
)
);
}

Expand Down
8 changes: 2 additions & 6 deletions cmds/versions/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ exports.run = async function(opts) {

if (!version || !semver.valid(semver.coerce(version))) {
return Promise.reject(
new Error(
`Please specify a semantic version. See \`${config.cli} help ${exports.command}\` for help.`,
),
new Error(`Please specify a semantic version. See \`${config.cli} help ${exports.command}\` for help.`)
);
}

Expand All @@ -73,9 +71,7 @@ exports.run = async function(opts) {
is_stable: foundVersion.is_stable || main === 'true' || promptResponse.is_stable,
is_beta: beta === 'true' || promptResponse.is_beta,
is_deprecated: deprecated || promptResponse.is_deprecated,
is_hidden: promptResponse.is_stable
? false
: !(isPublic === 'true' || promptResponse.is_hidden),
is_hidden: promptResponse.is_stable ? false : !(isPublic === 'true' || promptResponse.is_hidden),
},
auth: { user: key },
};
Expand Down
2 changes: 1 addition & 1 deletion cmds/whoami.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ exports.run = () => {
return Promise.resolve(
`You are currently logged in as ${configStore.get('email').green} to the ${
configStore.get('project').blue
} project.`,
} project.`
);
};
6 changes: 2 additions & 4 deletions lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ const owlbert = () => {
▐░░░░░░▄ ░░░░░░░░░
░░░░░░░░░▐░░░ ░░░░░░░░░░░░░ ${config.cli.blue.bold}
░░░░░░░░░░░░░░░░░▐▐▐░░░░░░░░░░▐▐░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ${
`a utlity for interacting with ReadMe`.bold
}
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ${`a utlity for interacting with ReadMe`.bold}
▐░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
▐░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
▐░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▄▄░░░
Expand Down Expand Up @@ -118,7 +116,7 @@ exports.globalUsage = async args => {
{ name: 'command', noWrap: true, width: 28, padding: { left: ' ', right: '' } },
{ name: 'description', maxWidth: 65 },
],
}).renderLines(),
}).renderLines()
);

availableCommands.push('');
Expand Down
7 changes: 2 additions & 5 deletions lib/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ exports.generatePrompts = versionList => [
{
type: 'select',
name: 'option',
message:
'Would you like to use an existing version or create a new one to associate with your OAS file?',
message: 'Would you like to use an existing version or create a new one to associate with your OAS file?',
choices: [
{ message: 'Use existing', value: 'update' },
{ message: 'Create a new version', value: 'create' },
Expand Down Expand Up @@ -86,9 +85,7 @@ exports.createVersionPrompt = (versionList, opts, isUpdate) => [
},
hint: '1.0.0',
validate(val) {
return semver.valid(semver.coerce(val))
? true
: this.styles.danger('Please specify a semantic version.');
return semver.valid(semver.coerce(val)) ? true : this.styles.danger('Please specify a semantic version.');
},
},
{
Expand Down
Loading