Skip to content

Commit fd08c18

Browse files
committed
Auto merge of #1817 - CodingItWrong:jjustice/lint, r=sgrif
Two-Space Linting Updates the JS and HBS linters to use the standard two-spaces instead of four, at @locks' request. This should make working with blueprints easier in the future. Other changes: - Adds the standard `lint:hbs` NPM script and runs it as part of CI. - Disable the `html-comments` lint rule, as there are HTML comments present.
2 parents d66efaf + a5c5db8 commit fd08c18

File tree

202 files changed

+5769
-5765
lines changed

Some content is hidden

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

202 files changed

+5769
-5765
lines changed

.eslintrc.js

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
module.exports = {
2-
root: true,
3-
parserOptions: {
4-
ecmaVersion: 2017,
5-
sourceType: 'module',
6-
ecmaFeatures: {
7-
experimentalObjectRestSpread: true,
8-
},
2+
root: true,
3+
parserOptions: {
4+
ecmaVersion: 2017,
5+
sourceType: 'module',
6+
ecmaFeatures: {
7+
experimentalObjectRestSpread: true,
98
},
10-
plugins: ['ember', 'prettier'],
11-
extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'],
12-
env: {
13-
browser: true,
14-
},
15-
rules: {
16-
'prettier/prettier': 'error',
9+
},
10+
plugins: ['ember', 'prettier'],
11+
extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'],
12+
env: {
13+
browser: true,
14+
},
15+
rules: {
16+
'prettier/prettier': 'error',
1717

18-
'arrow-parens': 'off',
19-
'brace-style': 'off',
20-
camelcase: 'off',
21-
'comma-dangle': 'off',
22-
'dot-notation': 'off',
23-
'operator-linebreak': 'off',
18+
'arrow-parens': 'off',
19+
'brace-style': 'off',
20+
camelcase: 'off',
21+
'comma-dangle': 'off',
22+
'dot-notation': 'off',
23+
'operator-linebreak': 'off',
24+
},
25+
overrides: [
26+
// node files
27+
{
28+
files: [
29+
'.eslintrc.js',
30+
'.template-lintrc.js',
31+
'ember-cli-build.js',
32+
'testem.js',
33+
'blueprints/*/index.js',
34+
'config/**/*.js',
35+
'lib/*/index.js',
36+
'server/**/*.js',
37+
],
38+
parserOptions: {
39+
sourceType: 'script',
40+
ecmaVersion: 2015,
41+
},
42+
env: {
43+
browser: false,
44+
node: true,
45+
},
2446
},
25-
overrides: [
26-
// node files
27-
{
28-
files: [
29-
'.eslintrc.js',
30-
'.template-lintrc.js',
31-
'ember-cli-build.js',
32-
'testem.js',
33-
'blueprints/*/index.js',
34-
'config/**/*.js',
35-
'lib/*/index.js',
36-
'server/**/*.js',
37-
],
38-
parserOptions: {
39-
sourceType: 'script',
40-
ecmaVersion: 2015,
41-
},
42-
env: {
43-
browser: false,
44-
node: true,
45-
},
46-
},
47-
],
47+
],
4848
};

.template-lintrc.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
/* eslint-env node */
44

55
module.exports = {
6-
extends: 'recommended',
6+
extends: 'recommended',
77

8-
rules: {
9-
'block-indentation': false,
10-
'img-alt-attributes': false,
11-
'triple-curlies': false,
12-
},
8+
rules: {
9+
'img-alt-attributes': false,
10+
'triple-curlies': false,
11+
'html-comments': false,
12+
},
1313
};

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ matrix:
5959
- npm ci
6060
before_script: skip
6161
script:
62+
- npm run lint:hbs
6263
- npm run lint:js
6364
- npm run lint:deps
6465
- npm test

app/adapters/api-token.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import DS from 'ember-data';
22

33
export default DS.RESTAdapter.extend({
4-
namespace: 'api/v1/me',
5-
pathForType() {
6-
return 'tokens';
7-
},
8-
createRecord(store, type, snapshot) {
9-
let data = {};
10-
let serializer = store.serializerFor(type.modelName);
11-
let url = this.buildURL(type.modelName, null, snapshot, 'createRecord');
4+
namespace: 'api/v1/me',
5+
pathForType() {
6+
return 'tokens';
7+
},
8+
createRecord(store, type, snapshot) {
9+
let data = {};
10+
let serializer = store.serializerFor(type.modelName);
11+
let url = this.buildURL(type.modelName, null, snapshot, 'createRecord');
1212

13-
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
13+
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
1414

15-
return this.ajax(url, 'PUT', { data });
16-
},
15+
return this.ajax(url, 'PUT', { data });
16+
},
1717
});

app/adapters/application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import DS from 'ember-data';
22
import AdapterFetch from 'ember-fetch/mixins/adapter-fetch';
33

44
export default DS.RESTAdapter.extend(AdapterFetch, {
5-
namespace: 'api/v1',
5+
namespace: 'api/v1',
66
});

app/adapters/category-slug.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { underscore, decamelize } from '@ember/string';
44
import ApplicationAdapter from './application';
55

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

app/adapters/crate-owner-invite.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import DS from 'ember-data';
22

33
export default DS.RESTAdapter.extend({
4-
namespace: 'api/v1/me',
5-
pathForType() {
6-
return 'crate_owner_invitations';
7-
},
4+
namespace: 'api/v1/me',
5+
pathForType() {
6+
return 'crate_owner_invitations';
7+
},
88
});

app/adapters/crate.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
import ApplicationAdapter from './application';
22

33
export default ApplicationAdapter.extend({
4-
follow(id) {
5-
return this.ajax(this.urlForFollowAction(id), 'PUT');
6-
},
4+
follow(id) {
5+
return this.ajax(this.urlForFollowAction(id), 'PUT');
6+
},
77

8-
inviteOwner(id, username) {
9-
return this.ajax(this.urlForOwnerAction(id), 'PUT', {
10-
data: {
11-
owners: [username],
12-
},
13-
});
14-
},
8+
inviteOwner(id, username) {
9+
return this.ajax(this.urlForOwnerAction(id), 'PUT', {
10+
data: {
11+
owners: [username],
12+
},
13+
});
14+
},
1515

16-
removeOwner(id, username) {
17-
return this.ajax(this.urlForOwnerAction(id), 'DELETE', {
18-
data: {
19-
owners: [username],
20-
},
21-
});
22-
},
16+
removeOwner(id, username) {
17+
return this.ajax(this.urlForOwnerAction(id), 'DELETE', {
18+
data: {
19+
owners: [username],
20+
},
21+
});
22+
},
2323

24-
unfollow(id) {
25-
return this.ajax(this.urlForFollowAction(id), 'DELETE');
26-
},
24+
unfollow(id) {
25+
return this.ajax(this.urlForFollowAction(id), 'DELETE');
26+
},
2727

28-
urlForFollowAction(id) {
29-
return `${this.buildURL('crate', id)}/follow`;
30-
},
28+
urlForFollowAction(id) {
29+
return `${this.buildURL('crate', id)}/follow`;
30+
},
3131

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

app/adapters/dependency.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import ApplicationAdapter from './application';
22

33
export default ApplicationAdapter.extend({
4-
query(store, type, query) {
5-
if (!query.reverse) {
6-
return this._super(...arguments);
7-
}
8-
delete query.reverse;
9-
let { crate } = query;
10-
delete query.crate;
11-
return this.ajax(`/${this.urlPrefix()}/crates/${crate.get('id')}/reverse_dependencies`, 'GET', { data: query });
12-
},
4+
query(store, type, query) {
5+
if (!query.reverse) {
6+
return this._super(...arguments);
7+
}
8+
delete query.reverse;
9+
let { crate } = query;
10+
delete query.crate;
11+
return this.ajax(`/${this.urlPrefix()}/crates/${crate.get('id')}/reverse_dependencies`, 'GET', { data: query });
12+
},
1313
});

app/adapters/team.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import ApplicationAdapter from './application';
22

33
export default ApplicationAdapter.extend({
4-
queryRecord(store, type, query) {
5-
let url = this.urlForFindRecord(query.team_id, 'team');
6-
return this.ajax(url, 'GET');
7-
},
4+
queryRecord(store, type, query) {
5+
let url = this.urlForFindRecord(query.team_id, 'team');
6+
return this.ajax(url, 'GET');
7+
},
88
});

app/adapters/user.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import ApplicationAdapter from './application';
22

33
export default ApplicationAdapter.extend({
4-
stats(id) {
5-
return this.ajax(this.urlForStatsAction(id), 'GET');
6-
},
4+
stats(id) {
5+
return this.ajax(this.urlForStatsAction(id), 'GET');
6+
},
77

8-
urlForStatsAction(id) {
9-
return `${this.buildURL('user', id)}/stats`;
10-
},
8+
urlForStatsAction(id) {
9+
return `${this.buildURL('user', id)}/stats`;
10+
},
1111

12-
queryRecord(store, type, query) {
13-
let url = this.urlForFindRecord(query.user_id, 'user');
14-
return this.ajax(url, 'GET');
15-
},
12+
queryRecord(store, type, query) {
13+
let url = this.urlForFindRecord(query.user_id, 'user');
14+
return this.ajax(url, 'GET');
15+
},
1616
});

app/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import loadInitializers from 'ember-load-initializers';
55
import config from './config/environment';
66

77
const App = Application.extend({
8-
modulePrefix: config.modulePrefix,
9-
podModulePrefix: config.podModulePrefix,
10-
Resolver,
8+
modulePrefix: config.modulePrefix,
9+
podModulePrefix: config.podModulePrefix,
10+
Resolver,
1111
});
1212

1313
loadInitializers(App, config.modulePrefix);

app/components/api-token-row.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,44 @@ import Component from '@ember/component';
22
import { empty, or } from '@ember/object/computed';
33

44
export default Component.extend({
5-
emptyName: empty('api_token.name'),
6-
disableCreate: or('api_token.isSaving', 'emptyName'),
7-
serverError: null,
5+
emptyName: empty('api_token.name'),
6+
disableCreate: or('api_token.isSaving', 'emptyName'),
7+
serverError: null,
88

9-
didInsertElement() {
10-
if (this.get('api_token.isNew')) {
11-
this.$('input').focus();
9+
didInsertElement() {
10+
if (this.get('api_token.isNew')) {
11+
this.$('input').focus();
12+
}
13+
},
14+
15+
actions: {
16+
async saveToken() {
17+
try {
18+
await this.api_token.save();
19+
this.set('serverError', null);
20+
} catch (err) {
21+
let msg;
22+
if (err.errors && err.errors[0] && err.errors[0].detail) {
23+
msg = `An error occurred while saving this token, ${err.errors[0].detail}`;
24+
} else {
25+
msg = 'An unknown error occurred while saving this token';
1226
}
27+
this.set('serverError', msg);
28+
}
1329
},
1430

15-
actions: {
16-
async saveToken() {
17-
try {
18-
await this.api_token.save();
19-
this.set('serverError', null);
20-
} catch (err) {
21-
let msg;
22-
if (err.errors && err.errors[0] && err.errors[0].detail) {
23-
msg = `An error occurred while saving this token, ${err.errors[0].detail}`;
24-
} else {
25-
msg = 'An unknown error occurred while saving this token';
26-
}
27-
this.set('serverError', msg);
28-
}
29-
},
30-
31-
async revokeToken() {
32-
try {
33-
await this.api_token.destroyRecord();
34-
} catch (err) {
35-
let msg;
36-
if (err.errors && err.errors[0] && err.errors[0].detail) {
37-
msg = `An error occurred while revoking this token, ${err.errors[0].detail}`;
38-
} else {
39-
msg = 'An unknown error occurred while revoking this token';
40-
}
41-
this.set('serverError', msg);
42-
}
43-
},
31+
async revokeToken() {
32+
try {
33+
await this.api_token.destroyRecord();
34+
} catch (err) {
35+
let msg;
36+
if (err.errors && err.errors[0] && err.errors[0].detail) {
37+
msg = `An error occurred while revoking this token, ${err.errors[0].detail}`;
38+
} else {
39+
msg = 'An unknown error occurred while revoking this token';
40+
}
41+
this.set('serverError', msg);
42+
}
4443
},
44+
},
4545
});

0 commit comments

Comments
 (0)