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

fix: remove useless code #6325

Open
wants to merge 1 commit into
base: v1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions bin/GithubAPI.js
Expand Up @@ -50,9 +50,7 @@ export default class GithubAPI {
async isCollaborator(user) {
try {
return (await this.axios.get(`/collaborators/${user}`)).status === 204;
} catch (e) {

}
} catch {}
}

async deleteLabel(issue, label) {
Expand Down Expand Up @@ -102,16 +100,15 @@ export default class GithubAPI {
static async getTagRef(tag) {
try {
return (await exec(`git show-ref --tags "refs/tags/${tag}"`)).stdout.split(' ')[0];
} catch (e) {
}
} catch {}
}

static async getLatestTag() {
try{
const {stdout} = await exec(`git for-each-ref refs/tags --sort=-taggerdate --format='%(refname)' --count=1`);

return stdout.split('/').pop();
} catch (e) {}
} catch {}
}

static normalizeTag(tag){
Expand Down
3 changes: 1 addition & 2 deletions bin/contributors.js
Expand Up @@ -229,8 +229,7 @@ const renderPRsList = async (tag, template, {comments_threshold= 5, awesome_thre
const getTagRef = async (tag) => {
try {
return (await exec(`git show-ref --tags "refs/tags/${tag}"`)).stdout.split(' ')[0];
} catch(e) {
}
} catch {}
}

export {
Expand Down
2 changes: 1 addition & 1 deletion bin/pr.js
Expand Up @@ -66,7 +66,7 @@ const generateBody = async ({files, template = './templates/pr.hbs'} = {}) => {
return Handlebars.compile(String(await fs.readFile(template)))(data);
}

console.log(await generateBody({
console.log(generateBody({
files: {
'Browser build (UMD)' : './dist/axios.min.js',
'Browser build (ESM)' : './dist/esm/axios.min.js',
Expand Down
2 changes: 1 addition & 1 deletion dist/axios.js

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

2 changes: 1 addition & 1 deletion examples/get/server.js
Expand Up @@ -31,4 +31,4 @@ export default function (req, res) {
});
res.write(JSON.stringify(people));
res.end();
};
}
2 changes: 1 addition & 1 deletion examples/post/server.js
Expand Up @@ -13,4 +13,4 @@ export default function (req, res) {
res.write(JSON.stringify(data));
res.end();
});
};
}
4 changes: 2 additions & 2 deletions examples/postMultipartFormData/server.js
@@ -1,6 +1,6 @@
export default function (req, res) {

req.on('data', function (chunk) {
req.on('data', function () {
});

req.on('end', function () {
Expand All @@ -10,4 +10,4 @@ export default function (req, res) {
});
res.end();
});
};
}
2 changes: 1 addition & 1 deletion examples/upload/server.js
Expand Up @@ -10,4 +10,4 @@ export default function (req, res) {
res.writeHead(200);
res.end();
});
};
}
2 changes: 1 addition & 1 deletion gulpfile.js
Expand Up @@ -59,7 +59,7 @@ const packageJSON = gulp.task('package', async function () {
.filter(
({type, contributions}) => type.toLowerCase() === 'user' && contributions >= CONTRIBUTION_THRESHOLD
)
.map(({login, name, url}) => `${name || login} (https://github.com/${login})`);
.map(({login, name}) => `${name || login} (https://github.com/${login})`);

await fs.writeFile('package.json', JSON.stringify(npm, null, 2));
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions test/specs/basicAuth.spec.js
Expand Up @@ -2,7 +2,7 @@ import axios from "../../index";

function validateInvalidCharacterError(error) {
expect(/character/i.test(error.message)).toEqual(true);
};
}

describe('basicAuth', function () {
// Validate an invalid character error
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('basicAuth', function () {
username: 'Aladßç£☃din',
password: 'open sesame'
}
}).then(function (response) {
}).then(function () {
done(new Error('Should not succeed to make a HTTP Basic auth request with non-latin1 chars in credentials.'));
}).catch(function (error) {
validateInvalidCharacterError(error);
Expand Down
1 change: 0 additions & 1 deletion test/specs/defaults.spec.js
@@ -1,5 +1,4 @@
import defaults from '../../lib/defaults';
import utils from '../../lib/utils';
import AxiosHeaders from '../../lib/core/AxiosHeaders';

describe('defaults', function () {
Expand Down
2 changes: 0 additions & 2 deletions test/specs/headers.spec.js
@@ -1,5 +1,3 @@
import assert from "assert";

const {AxiosHeaders} = axios;

function testHeaderValue(headers, key, val) {
Expand Down
2 changes: 1 addition & 1 deletion test/specs/interceptors.spec.js
Expand Up @@ -414,7 +414,7 @@ describe('interceptors', function () {
describe('and when the fulfillment-interceptor throws', function () {

function fireRequestCatchAndExpect(expectation) {
axios('/foo').catch(function(data) {
axios('/foo').catch(function() {
// dont handle result
});
getAjaxRequest().then(function (request) {
Expand Down
2 changes: 0 additions & 2 deletions test/specs/options.spec.js
@@ -1,5 +1,3 @@
import AxiosHeaders from "../../lib/core/AxiosHeaders.js";

describe('options', function () {
beforeEach(function () {
jasmine.Ajax.install();
Expand Down
4 changes: 2 additions & 2 deletions test/specs/progress.spec.js
Expand Up @@ -27,7 +27,7 @@ describe('progress events', function () {

axios('/foo', { onUploadProgress: progressSpy } );

getAjaxRequest().then(function (request) {
getAjaxRequest().then(function () {
// Jasmine AJAX doesn't trigger upload events. Waiting for upstream fix
// expect(progressSpy).toHaveBeenCalled();
done();
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('progress events', function () {

instance.get('/foo');

getAjaxRequest().then(function (request) {
getAjaxRequest().then(function () {
// expect(progressSpy).toHaveBeenCalled();
done();
});
Expand Down
2 changes: 1 addition & 1 deletion test/specs/xsrf.spec.js
Expand Up @@ -50,7 +50,7 @@ describe('xsrf', function () {
xsrfCookieName: null
});

getAjaxRequest().then(function (request) {
getAjaxRequest().then(function () {
expect(cookies.read).not.toHaveBeenCalled();
done();
});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/core/AxiosHeaders.js
Expand Up @@ -138,7 +138,7 @@ describe('AxiosHeaders', function () {

headers.set('foo', 'bar=value1');

assert.strictEqual(headers.has('foo', (value, header, headers)=> {
assert.strictEqual(headers.has('foo', (value, header)=> {
assert.strictEqual(value, 'bar=value1');
assert.strictEqual(header, 'foo');
return true;
Expand Down