Skip to content

Two-Space Linting #1817

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

Merged
merged 8 commits into from
Sep 6, 2019
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
86 changes: 43 additions & 43 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
root: true,
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
plugins: ['ember', 'prettier'],
extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'],
env: {
browser: true,
},
rules: {
'prettier/prettier': 'error',
},
plugins: ['ember', 'prettier'],
extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'],
env: {
browser: true,
},
rules: {
'prettier/prettier': 'error',

'arrow-parens': 'off',
'brace-style': 'off',
camelcase: 'off',
'comma-dangle': 'off',
'dot-notation': 'off',
'operator-linebreak': 'off',
'arrow-parens': 'off',
'brace-style': 'off',
camelcase: 'off',
'comma-dangle': 'off',
'dot-notation': 'off',
'operator-linebreak': 'off',
},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
'server/**/*.js',
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015,
},
env: {
browser: false,
node: true,
},
},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
'server/**/*.js',
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015,
},
env: {
browser: false,
node: true,
},
},
],
],
};
12 changes: 6 additions & 6 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
/* eslint-env node */

module.exports = {
extends: 'recommended',
extends: 'recommended',

rules: {
'block-indentation': false,
'img-alt-attributes': false,
'triple-curlies': false,
},
rules: {
'img-alt-attributes': false,
'triple-curlies': false,
'html-comments': false,
},
};
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ matrix:
- npm ci
before_script: skip
script:
- npm run lint:hbs
- npm run lint:js
- npm run lint:deps
- npm test
Expand Down
22 changes: 11 additions & 11 deletions app/adapters/api-token.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import DS from 'ember-data';

export default DS.RESTAdapter.extend({
namespace: 'api/v1/me',
pathForType() {
return 'tokens';
},
createRecord(store, type, snapshot) {
let data = {};
let serializer = store.serializerFor(type.modelName);
let url = this.buildURL(type.modelName, null, snapshot, 'createRecord');
namespace: 'api/v1/me',
pathForType() {
return 'tokens';
},
createRecord(store, type, snapshot) {
let data = {};
let serializer = store.serializerFor(type.modelName);
let url = this.buildURL(type.modelName, null, snapshot, 'createRecord');

serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });

return this.ajax(url, 'PUT', { data });
},
return this.ajax(url, 'PUT', { data });
},
});
2 changes: 1 addition & 1 deletion app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import DS from 'ember-data';
import AdapterFetch from 'ember-fetch/mixins/adapter-fetch';

export default DS.RESTAdapter.extend(AdapterFetch, {
namespace: 'api/v1',
namespace: 'api/v1',
});
8 changes: 4 additions & 4 deletions app/adapters/category-slug.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { underscore, decamelize } from '@ember/string';
import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
pathForType(modelName) {
let decamelized = underscore(decamelize(modelName));
return pluralize(decamelized);
},
pathForType(modelName) {
let decamelized = underscore(decamelize(modelName));
return pluralize(decamelized);
},
});
8 changes: 4 additions & 4 deletions app/adapters/crate-owner-invite.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import DS from 'ember-data';

export default DS.RESTAdapter.extend({
namespace: 'api/v1/me',
pathForType() {
return 'crate_owner_invitations';
},
namespace: 'api/v1/me',
pathForType() {
return 'crate_owner_invitations';
},
});
52 changes: 26 additions & 26 deletions app/adapters/crate.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
follow(id) {
return this.ajax(this.urlForFollowAction(id), 'PUT');
},
follow(id) {
return this.ajax(this.urlForFollowAction(id), 'PUT');
},

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

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

unfollow(id) {
return this.ajax(this.urlForFollowAction(id), 'DELETE');
},
unfollow(id) {
return this.ajax(this.urlForFollowAction(id), 'DELETE');
},

urlForFollowAction(id) {
return `${this.buildURL('crate', id)}/follow`;
},
urlForFollowAction(id) {
return `${this.buildURL('crate', id)}/follow`;
},

urlForOwnerAction(id) {
return `${this.buildURL('crate', id)}/owners`;
},
urlForOwnerAction(id) {
return `${this.buildURL('crate', id)}/owners`;
},
});
18 changes: 9 additions & 9 deletions app/adapters/dependency.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
query(store, type, query) {
if (!query.reverse) {
return this._super(...arguments);
}
delete query.reverse;
let { crate } = query;
delete query.crate;
return this.ajax(`/${this.urlPrefix()}/crates/${crate.get('id')}/reverse_dependencies`, 'GET', { data: query });
},
query(store, type, query) {
if (!query.reverse) {
return this._super(...arguments);
}
delete query.reverse;
let { crate } = query;
delete query.crate;
return this.ajax(`/${this.urlPrefix()}/crates/${crate.get('id')}/reverse_dependencies`, 'GET', { data: query });
},
});
8 changes: 4 additions & 4 deletions app/adapters/team.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
queryRecord(store, type, query) {
let url = this.urlForFindRecord(query.team_id, 'team');
return this.ajax(url, 'GET');
},
queryRecord(store, type, query) {
let url = this.urlForFindRecord(query.team_id, 'team');
return this.ajax(url, 'GET');
},
});
20 changes: 10 additions & 10 deletions app/adapters/user.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
stats(id) {
return this.ajax(this.urlForStatsAction(id), 'GET');
},
stats(id) {
return this.ajax(this.urlForStatsAction(id), 'GET');
},

urlForStatsAction(id) {
return `${this.buildURL('user', id)}/stats`;
},
urlForStatsAction(id) {
return `${this.buildURL('user', id)}/stats`;
},

queryRecord(store, type, query) {
let url = this.urlForFindRecord(query.user_id, 'user');
return this.ajax(url, 'GET');
},
queryRecord(store, type, query) {
let url = this.urlForFindRecord(query.user_id, 'user');
return this.ajax(url, 'GET');
},
});
6 changes: 3 additions & 3 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver,
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver,
});

loadInitializers(App, config.modulePrefix);
Expand Down
70 changes: 35 additions & 35 deletions app/components/api-token-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,44 @@ import Component from '@ember/component';
import { empty, or } from '@ember/object/computed';

export default Component.extend({
emptyName: empty('api_token.name'),
disableCreate: or('api_token.isSaving', 'emptyName'),
serverError: null,
emptyName: empty('api_token.name'),
disableCreate: or('api_token.isSaving', 'emptyName'),
serverError: null,

didInsertElement() {
if (this.get('api_token.isNew')) {
this.$('input').focus();
didInsertElement() {
if (this.get('api_token.isNew')) {
this.$('input').focus();
}
},

actions: {
async saveToken() {
try {
await this.api_token.save();
this.set('serverError', null);
} 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}`;
} else {
msg = 'An unknown error occurred while saving this token';
}
this.set('serverError', msg);
}
},

actions: {
async saveToken() {
try {
await this.api_token.save();
this.set('serverError', null);
} 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}`;
} else {
msg = 'An unknown error occurred while saving this token';
}
this.set('serverError', msg);
}
},

async revokeToken() {
try {
await this.api_token.destroyRecord();
} 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}`;
} else {
msg = 'An unknown error occurred while revoking this token';
}
this.set('serverError', msg);
}
},
async revokeToken() {
try {
await this.api_token.destroyRecord();
} 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}`;
} else {
msg = 'An unknown error occurred while revoking this token';
}
this.set('serverError', msg);
}
},
},
});
Loading