Skip to content

Commit 918eb5f

Browse files
authored
Merge pull request #1420 from Turbo87/prettier
Use `prettier` to format JS code
2 parents e7c6b14 + 0ed4cd0 commit 918eb5f

File tree

95 files changed

+1186
-1618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1186
-1618
lines changed

.eslintrc.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,28 @@ module.exports = {
44
ecmaVersion: 2017,
55
sourceType: 'module',
66
ecmaFeatures: {
7-
'experimentalObjectRestSpread': true,
7+
experimentalObjectRestSpread: true,
88
},
99
},
10-
plugins: [
11-
'ember',
12-
],
13-
extends: [
14-
'eslint:recommended',
15-
'plugin:ember/recommended',
16-
],
10+
plugins: ['ember', 'prettier'],
11+
extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'],
1712
env: {
1813
browser: true,
1914
},
2015
rules: {
16+
'prettier/prettier': 'error',
17+
2118
'arrow-parens': 'off',
2219
'brace-style': 'off',
23-
'camelcase': 'off',
20+
camelcase: 'off',
2421
'comma-dangle': 'off',
2522
'dot-notation': 'off',
26-
'indent': ['error', 4],
2723
'operator-linebreak': 'off',
28-
'quotes': ['error', 'single', {
29-
'allowTemplateLiterals': true,
30-
'avoidEscape': true,
31-
}],
3224
},
3325
overrides: [
3426
// node files
3527
{
36-
files: [
37-
'testem.js',
38-
'ember-cli-build.js',
39-
'config/**/*.js',
40-
'lib/*/index.js',
41-
],
28+
files: ['testem.js', 'ember-cli-build.js', 'config/**/*.js', 'lib/*/index.js'],
4229
parserOptions: {
4330
sourceType: 'script',
4431
ecmaVersion: 2015,

app/adapters/category-slug.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import ApplicationAdapter from './application';
55

66
export default ApplicationAdapter.extend({
77
pathForType(modelName) {
8-
let decamelized = underscore(
9-
decamelize(modelName)
10-
);
8+
let decamelized = underscore(decamelize(modelName));
119
return pluralize(decamelized);
12-
}
10+
},
1311
});

app/adapters/crate-owner-invite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export default DS.RESTAdapter.extend({
44
namespace: 'api/v1/me',
55
pathForType() {
66
return 'crate_owner_invitations';
7-
}
7+
},
88
});

app/adapters/crate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ export default ApplicationAdapter.extend({
99
return this.ajax(this.urlForOwnerAction(id), 'PUT', {
1010
data: {
1111
owners: [username],
12-
}
12+
},
1313
});
1414
},
1515

1616
removeOwner(id, username) {
1717
return this.ajax(this.urlForOwnerAction(id), 'DELETE', {
1818
data: {
1919
owners: [username],
20-
}
20+
},
2121
});
2222
},
2323

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

3232
urlForOwnerAction(id) {
3333
return `${this.buildURL('crate', id)}/owners`;
34-
}
34+
},
3535
});

app/adapters/dependency.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export default ApplicationAdapter.extend({
88
delete query.reverse;
99
let { crate } = query;
1010
delete query.crate;
11-
return this.ajax(`/${this.urlPrefix()}/crates/${crate.get('id')}/reverse_dependencies`,
12-
'GET', { data: query });
11+
return this.ajax(`/${this.urlPrefix()}/crates/${crate.get('id')}/reverse_dependencies`, 'GET', { data: query });
1312
},
1413
});

app/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import config from './config/environment';
77
const App = Application.extend({
88
modulePrefix: config.modulePrefix,
99
podModulePrefix: config.podModulePrefix,
10-
Resolver
10+
Resolver,
1111
});
1212

1313
loadInitializers(App, config.modulePrefix);

app/components/api-token-row.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default Component.extend({
1717
try {
1818
await this.api_token.save();
1919
this.set('serverError', null);
20-
} catch(err) {
20+
} catch (err) {
2121
let msg;
2222
if (err.errors && err.errors[0] && err.errors[0].detail) {
2323
msg = `An error occurred while saving this token, ${err.errors[0].detail}`;
@@ -31,7 +31,7 @@ export default Component.extend({
3131
async revokeToken() {
3232
try {
3333
await this.api_token.destroyRecord();
34-
} catch(err) {
34+
} catch (err) {
3535
let msg;
3636
if (err.errors && err.errors[0] && err.errors[0].detail) {
3737
msg = `An error occurred while revoking this token, ${err.errors[0].detail}`;
@@ -41,5 +41,5 @@ export default Component.extend({
4141
this.set('serverError', msg);
4242
}
4343
},
44-
}
44+
},
4545
});

app/components/badge-appveyor.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ export default Component.extend({
2727
}),
2828

2929
projectName: computed('badge.attributes.project_name', function() {
30-
return this.get('badge.attributes.project_name') ||
31-
this.get('badge.attributes.repository').replace(/[_.]/g, '-');
30+
return (
31+
this.get('badge.attributes.project_name') || this.get('badge.attributes.repository').replace(/[_.]/g, '-')
32+
);
3233
}),
3334

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

3839
text: computed('badge', function() {
39-
return `Appveyor build status for the ${ this.branch } branch`;
40-
})
40+
return `Appveyor build status for the ${this.branch} branch`;
41+
}),
4142
});

app/components/badge-circle-ci.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export default Component.extend({
1010
return encodeURIComponent(this.get('badge.attributes.branch') || 'master');
1111
}),
1212
text: computed('branch', function() {
13-
return `Circle CI build status for the ${ this.branch } branch`;
14-
})
13+
return `Circle CI build status for the ${this.branch} branch`;
14+
}),
1515
});

app/components/badge-codecov.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ export default Component.extend({
1313
return this.get('badge.attributes.service') || 'github';
1414
}),
1515
text: computed('branch', function() {
16-
return `CodeCov coverage status for the ${ this.branch } branch`;
17-
})
16+
return `CodeCov coverage status for the ${this.branch} branch`;
17+
}),
1818
});

app/components/badge-coveralls.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ export default Component.extend({
1313
return this.get('badge.attributes.service') || 'github';
1414
}),
1515
text: computed('branch', function() {
16-
return `Coveralls coverage status for the ${ this.branch } branch`;
17-
})
16+
return `Coveralls coverage status for the ${this.branch} branch`;
17+
}),
1818
});

app/components/badge-gitlab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export default Component.extend({
1010
return this.get('badge.attributes.branch') || 'master';
1111
}),
1212
text: computed('badge', function() {
13-
return `GitLab build status for the ${ this.branch } branch`;
14-
})
13+
return `GitLab build status for the ${this.branch} branch`;
14+
}),
1515
});

app/components/badge-is-it-maintained-issue-resolution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export default Component.extend({
88
repository: alias('badge.attributes.repository'),
99
text: computed('badge', function() {
1010
return `Is It Maintained average time to resolve an issue`;
11-
})
11+
}),
1212
});

app/components/badge-is-it-maintained-open-issues.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export default Component.extend({
88
repository: alias('badge.attributes.repository'),
99
text: computed('badge', function() {
1010
return `Is It Maintained percentage of issues still open`;
11-
})
11+
}),
1212
});

app/components/badge-maintenance.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,24 @@ export default Component.extend({
99
return this.get('badge.attributes.status').replace(/-/g, '--');
1010
}),
1111
none: computed('badge', function() {
12-
return this.get('badge.attributes.status') === 'none'
13-
|| !this.get('badge.attributes.status');
12+
return this.get('badge.attributes.status') === 'none' || !this.get('badge.attributes.status');
1413
}),
1514
status: alias('badge.attributes.status'),
1615
color: computed('badge', function() {
1716
switch (this.get('badge.attributes.status')) {
18-
case 'actively-developed':
19-
return 'brightgreen';
20-
case 'passively-maintained':
21-
return 'yellowgreen';
22-
case 'as-is':
23-
return 'yellow';
24-
case 'experimental':
25-
return 'blue';
26-
case 'looking-for-maintainer':
27-
return 'orange';
28-
case 'deprecated':
29-
return 'red';
17+
case 'actively-developed':
18+
return 'brightgreen';
19+
case 'passively-maintained':
20+
return 'yellowgreen';
21+
case 'as-is':
22+
return 'yellow';
23+
case 'experimental':
24+
return 'blue';
25+
case 'looking-for-maintainer':
26+
return 'orange';
27+
case 'deprecated':
28+
return 'red';
3029
}
3130
}),
32-
text: 'Maintenance intention for this crate'
31+
text: 'Maintenance intention for this crate',
3332
});

app/components/badge-travis-ci.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export default Component.extend({
1010
return this.get('badge.attributes.branch') || 'master';
1111
}),
1212
text: computed('branch', function() {
13-
return `Travis CI build status for the ${ this.branch } branch`;
14-
})
13+
return `Travis CI build status for the ${this.branch} branch`;
14+
}),
1515
});

app/components/crate-readme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export default Component.extend({
77
this.$('pre > code').each(function() {
88
window.Prism.highlightElement(this);
99
});
10-
}
10+
},
1111
});

app/components/download-graph.js

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,7 @@ import Component from '@ember/component';
22
import $ from 'jquery';
33

44
// Colors by http://colorbrewer2.org/#type=diverging&scheme=RdBu&n=10
5-
const COLORS = [
6-
'#67001f',
7-
'#b2182b',
8-
'#d6604d',
9-
'#f4a582',
10-
'#92c5de',
11-
'#4393c3',
12-
'#2166ac',
13-
'#053061'
14-
];
5+
const COLORS = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#92c5de', '#4393c3', '#2166ac', '#053061'];
156

167
export default Component.extend({
178
classNames: 'graph-data',
@@ -110,7 +101,7 @@ export default Component.extend({
110101
let avg = total / days;
111102
return {
112103
v: avg,
113-
f: avg.toFixed(2)
104+
f: avg.toFixed(2),
114105
};
115106
};
116107
};
@@ -123,43 +114,44 @@ export default Component.extend({
123114

124115
range(headers.length - 1, 0, -1).forEach((dataCol, i) => {
125116
columns.push(dataCol); // add the column itself
126-
columns.push({ // add a 'calculated' column, the moving average
117+
columns.push({
118+
// add a 'calculated' column, the moving average
127119
type: 'number',
128120
label: `${headers[dataCol]} ${days}-day avg.`,
129-
calc: moving_avg_func_for_col(dataCol)
121+
calc: moving_avg_func_for_col(dataCol),
130122
});
131123
// Note: while the columns start with index 1 (because 0 is the time
132124
// axis), the series configuration starts with index 0.
133125
seriesOption[i * 2] = {
134126
type: 'scatter',
135127
color: COLORS[i % COLORS.length],
136128
pointSize: 3,
137-
pointShape: 'square'
129+
pointShape: 'square',
138130
};
139131
seriesOption[i * 2 + 1] = {
140132
type: 'area',
141133
color: COLORS[i % COLORS.length],
142134
lineWidth: 2,
143135
curveType: 'function',
144-
visibleInLegend: false
136+
visibleInLegend: false,
145137
};
146138
});
147139
view.setColumns(columns);
148140

149141
let chart = new window.google.visualization.ComboChart(this.element);
150142
chart.draw(view, {
151-
chartArea: { 'left': 85, 'width': '77%', 'height': '80%' },
143+
chartArea: { left: 85, width: '77%', height: '80%' },
152144
hAxis: {
153145
minorGridlines: { count: 8 },
154146
},
155147
vAxis: {
156148
minorGridlines: { count: 5 },
157-
viewWindow: { min: 0, },
149+
viewWindow: { min: 0 },
158150
},
159151
isStacked: true,
160152
focusTarget: 'category',
161153
seriesType: 'scatter',
162-
series: seriesOption
154+
series: seriesOption,
163155
});
164156
},
165157
});

app/components/email-input.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export default Component.extend({
1616
prevEmail: '',
1717
emailIsNull: computed('user.email', function() {
1818
let email = this.get('user.email');
19-
return (email == null);
19+
return email == null;
2020
}),
2121
emailNotVerified: computed('user.{email,email_verified}', function() {
2222
let email = this.get('user.email');
2323
let verified = this.get('user.email_verified');
2424

25-
return (email != null && !verified);
25+
return email != null && !verified;
2626
}),
2727
isError: false,
2828
emailError: '',
@@ -41,7 +41,7 @@ export default Component.extend({
4141
editEmail() {
4242
let email = this.value;
4343
let isEmailNull = function(email) {
44-
return (email == null);
44+
return email == null;
4545
};
4646

4747
this.set('emailIsNull', isEmailNull(email));
@@ -98,7 +98,7 @@ export default Component.extend({
9898
try {
9999
await ajax(`/api/v1/users/${user.id}/resend`, { method: 'PUT' });
100100
this.set('disableResend', true);
101-
} catch(error) {
101+
} catch (error) {
102102
if (error.payload) {
103103
this.set('isError', true);
104104
this.set('emailError', `Error in resending message: ${error.payload.errors[0].detail}`);
@@ -107,6 +107,6 @@ export default Component.extend({
107107
this.set('emailError', 'Unknown error in resending message');
108108
}
109109
}
110-
}
111-
}
110+
},
111+
},
112112
});

app/components/flash-message.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export default Component.extend({
88

99
elementId: 'flash',
1010
tagName: 'p',
11-
classNameBindings: ['message:shown']
11+
classNameBindings: ['message:shown'],
1212
});

0 commit comments

Comments
 (0)