Skip to content

Commit

Permalink
Reformat JS files using prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jun 6, 2018
1 parent fee6e66 commit 735924f
Show file tree
Hide file tree
Showing 93 changed files with 1,137 additions and 1,110 deletions.
34 changes: 14 additions & 20 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,35 @@ module.exports = {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
'experimentalObjectRestSpread': true,
experimentalObjectRestSpread: true,
},
},
plugins: [
'ember',
],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
],
plugins: ['ember'],
extends: ['eslint:recommended', 'plugin:ember/recommended'],
env: {
browser: true,
},
rules: {
'arrow-parens': 'off',
'brace-style': 'off',
'camelcase': 'off',
camelcase: 'off',
'comma-dangle': 'off',
'dot-notation': 'off',
'indent': ['error', 4],
indent: ['error', 4],
'operator-linebreak': 'off',
'quotes': ['error', 'single', {
'allowTemplateLiterals': true,
'avoidEscape': true,
}],
quotes: [
'error',
'single',
{
allowTemplateLiterals: true,
avoidEscape: true,
},
],
},
overrides: [
// node files
{
files: [
'testem.js',
'ember-cli-build.js',
'config/**/*.js',
'lib/*/index.js',
],
files: ['testem.js', 'ember-cli-build.js', 'config/**/*.js', 'lib/*/index.js'],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015,
Expand Down
6 changes: 2 additions & 4 deletions app/adapters/category-slug.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
pathForType(modelName) {
let decamelized = underscore(
decamelize(modelName)
);
let decamelized = underscore(decamelize(modelName));
return pluralize(decamelized);
}
},
});
2 changes: 1 addition & 1 deletion app/adapters/crate-owner-invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export default DS.RESTAdapter.extend({
namespace: 'api/v1/me',
pathForType() {
return 'crate_owner_invitations';
}
},
});
6 changes: 3 additions & 3 deletions app/adapters/crate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export default ApplicationAdapter.extend({
return this.ajax(this.urlForOwnerAction(id), 'PUT', {
data: {
owners: [username],
}
},
});
},

removeOwner(id, username) {
return this.ajax(this.urlForOwnerAction(id), 'DELETE', {
data: {
owners: [username],
}
},
});
},

Expand All @@ -31,5 +31,5 @@ export default ApplicationAdapter.extend({

urlForOwnerAction(id) {
return `${this.buildURL('crate', id)}/owners`;
}
},
});
3 changes: 1 addition & 2 deletions app/adapters/dependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default ApplicationAdapter.extend({
delete query.reverse;
let { crate } = query;
delete query.crate;
return this.ajax(`/${this.urlPrefix()}/crates/${crate.get('id')}/reverse_dependencies`,
'GET', { data: query });
return this.ajax(`/${this.urlPrefix()}/crates/${crate.get('id')}/reverse_dependencies`, 'GET', { data: query });
},
});
2 changes: 1 addition & 1 deletion app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import config from './config/environment';
const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
Resolver,
});

loadInitializers(App, config.modulePrefix);
Expand Down
6 changes: 3 additions & 3 deletions app/components/api-token-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default Component.extend({
try {
await this.api_token.save();
this.set('serverError', null);
} catch(err) {
} catch (err) {
let msg;
if (err.errors && err.errors[0] && err.errors[0].detail) {
msg = `An error occurred while saving this token, ${err.errors[0].detail}`;
Expand All @@ -31,7 +31,7 @@ export default Component.extend({
async revokeToken() {
try {
await this.api_token.destroyRecord();
} catch(err) {
} catch (err) {
let msg;
if (err.errors && err.errors[0] && err.errors[0].detail) {
msg = `An error occurred while revoking this token, ${err.errors[0].detail}`;
Expand All @@ -41,5 +41,5 @@ export default Component.extend({
this.set('serverError', msg);
}
},
}
},
});
9 changes: 5 additions & 4 deletions app/components/badge-appveyor.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ export default Component.extend({
}),

projectName: computed('badge.attributes.project_name', function() {
return this.get('badge.attributes.project_name') ||
this.get('badge.attributes.repository').replace(/[_.]/g, '-');
return (
this.get('badge.attributes.project_name') || this.get('badge.attributes.repository').replace(/[_.]/g, '-')
);
}),

service: computed('badge.attributes.service', function() {
return this.get('badge.attributes.service') || 'github';
}),

text: computed('badge', function() {
return `Appveyor build status for the ${ this.branch } branch`;
})
return `Appveyor build status for the ${this.branch} branch`;
}),
});
4 changes: 2 additions & 2 deletions app/components/badge-circle-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default Component.extend({
return encodeURIComponent(this.get('badge.attributes.branch') || 'master');
}),
text: computed('branch', function() {
return `Circle CI build status for the ${ this.branch } branch`;
})
return `Circle CI build status for the ${this.branch} branch`;
}),
});
4 changes: 2 additions & 2 deletions app/components/badge-codecov.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export default Component.extend({
return this.get('badge.attributes.service') || 'github';
}),
text: computed('branch', function() {
return `CodeCov coverage status for the ${ this.branch } branch`;
})
return `CodeCov coverage status for the ${this.branch} branch`;
}),
});
4 changes: 2 additions & 2 deletions app/components/badge-coveralls.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export default Component.extend({
return this.get('badge.attributes.service') || 'github';
}),
text: computed('branch', function() {
return `Coveralls coverage status for the ${ this.branch } branch`;
})
return `Coveralls coverage status for the ${this.branch} branch`;
}),
});
4 changes: 2 additions & 2 deletions app/components/badge-gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default Component.extend({
return this.get('badge.attributes.branch') || 'master';
}),
text: computed('badge', function() {
return `GitLab build status for the ${ this.branch } branch`;
})
return `GitLab build status for the ${this.branch} branch`;
}),
});
2 changes: 1 addition & 1 deletion app/components/badge-is-it-maintained-issue-resolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export default Component.extend({
repository: alias('badge.attributes.repository'),
text: computed('badge', function() {
return `Is It Maintained average time to resolve an issue`;
})
}),
});
2 changes: 1 addition & 1 deletion app/components/badge-is-it-maintained-open-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export default Component.extend({
repository: alias('badge.attributes.repository'),
text: computed('badge', function() {
return `Is It Maintained percentage of issues still open`;
})
}),
});
29 changes: 14 additions & 15 deletions app/components/badge-maintenance.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@ export default Component.extend({
return this.get('badge.attributes.status').replace(/-/g, '--');
}),
none: computed('badge', function() {
return this.get('badge.attributes.status') === 'none'
|| !this.get('badge.attributes.status');
return this.get('badge.attributes.status') === 'none' || !this.get('badge.attributes.status');
}),
status: alias('badge.attributes.status'),
color: computed('badge', function() {
switch (this.get('badge.attributes.status')) {
case 'actively-developed':
return 'brightgreen';
case 'passively-maintained':
return 'yellowgreen';
case 'as-is':
return 'yellow';
case 'experimental':
return 'blue';
case 'looking-for-maintainer':
return 'orange';
case 'deprecated':
return 'red';
case 'actively-developed':
return 'brightgreen';
case 'passively-maintained':
return 'yellowgreen';
case 'as-is':
return 'yellow';
case 'experimental':
return 'blue';
case 'looking-for-maintainer':
return 'orange';
case 'deprecated':
return 'red';
}
}),
text: 'Maintenance intention for this crate'
text: 'Maintenance intention for this crate',
});
4 changes: 2 additions & 2 deletions app/components/badge-travis-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default Component.extend({
return this.get('badge.attributes.branch') || 'master';
}),
text: computed('branch', function() {
return `Travis CI build status for the ${ this.branch } branch`;
})
return `Travis CI build status for the ${this.branch} branch`;
}),
});
2 changes: 1 addition & 1 deletion app/components/crate-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export default Component.extend({
this.$('pre > code').each(function() {
window.Prism.highlightElement(this);
});
}
},
});
28 changes: 10 additions & 18 deletions app/components/download-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@ import Component from '@ember/component';
import $ from 'jquery';

// Colors by http://colorbrewer2.org/#type=diverging&scheme=RdBu&n=10
const COLORS = [
'#67001f',
'#b2182b',
'#d6604d',
'#f4a582',
'#92c5de',
'#4393c3',
'#2166ac',
'#053061'
];
const COLORS = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#92c5de', '#4393c3', '#2166ac', '#053061'];

export default Component.extend({
classNames: 'graph-data',
Expand Down Expand Up @@ -110,7 +101,7 @@ export default Component.extend({
let avg = total / days;
return {
v: avg,
f: avg.toFixed(2)
f: avg.toFixed(2),
};
};
};
Expand All @@ -123,43 +114,44 @@ export default Component.extend({

range(headers.length - 1, 0, -1).forEach((dataCol, i) => {
columns.push(dataCol); // add the column itself
columns.push({ // add a 'calculated' column, the moving average
columns.push({
// add a 'calculated' column, the moving average
type: 'number',
label: `${headers[dataCol]} ${days}-day avg.`,
calc: moving_avg_func_for_col(dataCol)
calc: moving_avg_func_for_col(dataCol),
});
// Note: while the columns start with index 1 (because 0 is the time
// axis), the series configuration starts with index 0.
seriesOption[i * 2] = {
type: 'scatter',
color: COLORS[i % COLORS.length],
pointSize: 3,
pointShape: 'square'
pointShape: 'square',
};
seriesOption[i * 2 + 1] = {
type: 'area',
color: COLORS[i % COLORS.length],
lineWidth: 2,
curveType: 'function',
visibleInLegend: false
visibleInLegend: false,
};
});
view.setColumns(columns);

let chart = new window.google.visualization.ComboChart(this.element);
chart.draw(view, {
chartArea: { 'left': 85, 'width': '77%', 'height': '80%' },
chartArea: { left: 85, width: '77%', height: '80%' },
hAxis: {
minorGridlines: { count: 8 },
},
vAxis: {
minorGridlines: { count: 5 },
viewWindow: { min: 0, },
viewWindow: { min: 0 },
},
isStacked: true,
focusTarget: 'category',
seriesType: 'scatter',
series: seriesOption
series: seriesOption,
});
},
});
Expand Down
12 changes: 6 additions & 6 deletions app/components/email-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export default Component.extend({
prevEmail: '',
emailIsNull: computed('user.email', function() {
let email = this.get('user.email');
return (email == null);
return email == null;
}),
emailNotVerified: computed('user.{email,email_verified}', function() {
let email = this.get('user.email');
let verified = this.get('user.email_verified');

return (email != null && !verified);
return email != null && !verified;
}),
isError: false,
emailError: '',
Expand All @@ -41,7 +41,7 @@ export default Component.extend({
editEmail() {
let email = this.value;
let isEmailNull = function(email) {
return (email == null);
return email == null;
};

this.set('emailIsNull', isEmailNull(email));
Expand Down Expand Up @@ -98,7 +98,7 @@ export default Component.extend({
try {
await ajax(`/api/v1/users/${user.id}/resend`, { method: 'PUT' });
this.set('disableResend', true);
} catch(error) {
} catch (error) {
if (error.payload) {
this.set('isError', true);
this.set('emailError', `Error in resending message: ${error.payload.errors[0].detail}`);
Expand All @@ -107,6 +107,6 @@ export default Component.extend({
this.set('emailError', 'Unknown error in resending message');
}
}
}
}
},
},
});
2 changes: 1 addition & 1 deletion app/components/flash-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export default Component.extend({

elementId: 'flash',
tagName: 'p',
classNameBindings: ['message:shown']
classNameBindings: ['message:shown'],
});
Loading

0 comments on commit 735924f

Please sign in to comment.