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.15.0 to 2.0.0 #158

Merged
merged 2 commits into from
Mar 23, 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
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion cmds/docs/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports.args = [
},
];

exports.run = async function(opts) {
exports.run = async function (opts) {
const { slug, key, version } = opts;

if (!key) {
Expand Down
7 changes: 2 additions & 5 deletions cmds/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports.args = [
},
];

exports.run = function(opts) {
exports.run = function (opts) {
const { folder, key, version } = opts;

if (!key) {
Expand Down Expand Up @@ -98,10 +98,7 @@ exports.run = function(opts) {
const matter = frontMatter(file);
// Stripping the markdown extension from the filename
const slug = filename.replace(path.extname(filename), '');
const hash = crypto
.createHash('sha1')
.update(file)
.digest('hex');
const hash = crypto.createHash('sha1').update(file).digest('hex');

return request
.get(`${config.host}/api/v1/docs/${slug}`, {
Expand Down
2 changes: 1 addition & 1 deletion cmds/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function getCredentials(opts) {
};
}

exports.run = async function(opts) {
exports.run = async function (opts) {
let { email, password, project, token } = opts;

// We only want to prompt for input outside of the test environment
Expand Down
2 changes: 1 addition & 1 deletion cmds/oas.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports.position = 1;

exports.args = [];

exports.run = function() {
exports.run = function () {
const cp = spawn(path.join(__dirname, '..', 'node_modules', '.bin', 'oas'), process.argv.slice(3), {
stdio: 'inherit',
});
Expand Down
2 changes: 1 addition & 1 deletion cmds/open.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports.position = 2;

exports.args = [];

exports.run = function(opts) {
exports.run = function (opts) {
const project = configStore.get('project');
if (!project) {
return Promise.reject(new Error(`Please login using \`${config.cli} ${loginCmd.command}\`.`));
Expand Down
2 changes: 1 addition & 1 deletion cmds/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exports.args = [
},
];

exports.run = async function(opts) {
exports.run = async function (opts) {
const { spec, version } = opts;
let { key, id } = opts;
let selectedVersion;
Expand Down
2 changes: 1 addition & 1 deletion cmds/versions/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports.args = [
},
];

exports.run = async function(opts) {
exports.run = async function (opts) {
let versionList;
const { key, version, codename, fork, main, beta, isPublic } = opts;

Expand Down
2 changes: 1 addition & 1 deletion cmds/versions/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exports.args = [
},
];

exports.run = async function(opts) {
exports.run = async function (opts) {
const { key, version } = opts;

if (!key) {
Expand Down
2 changes: 1 addition & 1 deletion cmds/versions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const getVersionFormatted = version => {
return output.join('\n');
};

exports.run = function(opts) {
exports.run = function (opts) {
const { key, version, raw } = opts;

if (!key) {
Expand Down
2 changes: 1 addition & 1 deletion cmds/versions/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ exports.args = [
},
];

exports.run = async function(opts) {
exports.run = async function (opts) {
const { key, version, codename, newVersion, main, beta, isPublic, deprecated } = opts;

if (!key) {
Expand Down
1 change: 1 addition & 0 deletions lib/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ exports.createVersionPrompt = (versionList, opts, isUpdate) => [
skip() {
return opts.fork || isUpdate;
},
// eslint-disable-next-line sonarjs/no-identical-functions
choices: versionList.map(v => {
return {
message: v.version,
Expand Down
50 changes: 25 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
"table-layout": "^1.0.0"
},
"devDependencies": {
"@readme/eslint-config": "^1.3.1",
"@readme/eslint-config": "^2.0.0",
"conventional-changelog-cli": "^2.0.31",
"eslint": "^6.2.0",
"jest": "^25.1.0",
"nock": "^12.0.0",
"prettier": "^1.12.1"
"prettier": "^2.0.1"
},
"scripts": {
"lint": "eslint .",
Expand All @@ -75,5 +75,6 @@
"statements": 90
}
}
}
},
"prettier": "@readme/eslint-config/prettier"
}
12 changes: 3 additions & 9 deletions test/cmds/docs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,9 @@ describe('rdme docs:edit', () => {
expect.assertions(2);
const slug = 'getting-started';

const getMock = nock(config.host)
.get(`/api/v1/docs/${slug}`)
.reply(200, {});
const getMock = nock(config.host).get(`/api/v1/docs/${slug}`).reply(200, {});

const putMock = nock(config.host)
.put(`/api/v1/docs/${slug}`)
.reply(400, { error: 'Bad Request' });
const putMock = nock(config.host).put(`/api/v1/docs/${slug}`).reply(400, { error: 'Bad Request' });

function mockEditor(filename, cb) {
return cb(0);
Expand All @@ -248,9 +244,7 @@ describe('rdme docs:edit', () => {
it('should handle error if $EDITOR fails', () => {
expect.assertions(1);
const slug = 'getting-started';
nock(config.host)
.get(`/api/v1/docs/${slug}`)
.reply(200, {});
nock(config.host).get(`/api/v1/docs/${slug}`).reply(200, {});

function mockEditor(filename, cb) {
return cb(1);
Expand Down
24 changes: 9 additions & 15 deletions test/cmds/login.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ describe('rdme login', () => {
const project = 'subdomain';
const apiKey = 'abcdefg';

const mock = nock(config.host)
.post('/api/v1/login', { email, password, project })
.reply(200, { apiKey });
const mock = nock(config.host).post('/api/v1/login', { email, password, project }).reply(200, { apiKey });

return cmd.run({ email, password, project }).then(() => {
mock.done();
Expand All @@ -47,12 +45,10 @@ describe('rdme login', () => {
const password = '123456';
const project = 'subdomain';

const mock = nock(config.host)
.post('/api/v1/login', { email, password, project })
.reply(400, {
description: 'Invalid email/password',
error: 'Bad Request',
});
const mock = nock(config.host).post('/api/v1/login', { email, password, project }).reply(400, {
description: 'Invalid email/password',
error: 'Bad Request',
});

return cmd.run({ email, password, project }).catch(err => {
mock.done();
Expand All @@ -67,12 +63,10 @@ describe('rdme login', () => {
const password = '123456';
const project = 'subdomain';

const mock = nock(config.host)
.post('/api/v1/login', { email, password, project })
.reply(400, {
description: 'You must provide a Two Factor Code',
error: 'Bad Request',
});
const mock = nock(config.host).post('/api/v1/login', { email, password, project }).reply(400, {
description: 'You must provide a Two Factor Code',
error: 'Bad Request',
});

return cmd.run({ email, password, project }).catch(err => {
mock.done();
Expand Down
15 changes: 3 additions & 12 deletions test/cmds/versions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ describe('rdme versions*', () => {
is_beta: false,
});

const mockRequest = nock(config.host)
.post(`/api/v1/version`)
.basicAuth({ user: key })
.reply(400);
const mockRequest = nock(config.host).post(`/api/v1/version`).basicAuth({ user: key }).reply(400);

return createVersion.run({ key, version, fork: '0.0.5' }).catch(err => {
expect(err.message).toBe('Failed to create a new version using your specified parameters.');
Expand All @@ -164,21 +161,15 @@ describe('rdme versions*', () => {
});

it('should delete a specific version', async () => {
const mockRequest = nock(config.host)
.delete(`/api/v1/version/${version}`)
.basicAuth({ user: key })
.reply(200);
const mockRequest = nock(config.host).delete(`/api/v1/version/${version}`).basicAuth({ user: key }).reply(200);

return deleteVersion.run({ key, version }).then(() => {
mockRequest.done();
});
});

it('should catch any request errors', async () => {
const mockRequest = nock(config.host)
.delete(`/api/v1/version/${version}`)
.basicAuth({ user: key })
.reply(400);
const mockRequest = nock(config.host).delete(`/api/v1/version/${version}`).basicAuth({ user: key }).reply(400);

return deleteVersion.run({ key, version }).catch(err => {
expect(err.message).toBe('Failed to delete target version.');
Expand Down