Skip to content

Commit

Permalink
linting with @thoughtbot/eslint-config. #280
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jan 1, 2020
1 parent 4e1767d commit 1a1ac3e
Show file tree
Hide file tree
Showing 217 changed files with 2,718 additions and 2,744 deletions.
27 changes: 15 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module'
sourceType: 'module',
},
extends: 'eslint:recommended',
extends: [
'eslint:recommended',
'@thoughtbot/eslint-config',
],
env: {
browser: true
browser: true,
},
rules: {
"no-console": "off"
'no-console': 'off',
},
overrides: [
// node files
Expand All @@ -22,23 +25,23 @@ module.exports = {
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
'server/**/*.js'
'server/**/*.js',
],
parserOptions: {
sourceType: 'script'
sourceType: 'script',
},
env: {
browser: false,
node: true
node: true,
},
plugins: ['node'],
plugins: [ 'node' ],
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
// add your custom rules and overrides for node files here

// this can be removed once the following is fixed
// https://github.com/mysticatea/eslint-plugin-node/issues/77
'node/no-unpublished-require': 'off'
})
}
]
'node/no-unpublished-require': 'off',
}),
},
],
};
5 changes: 2 additions & 3 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = {
'no-triple-curlies': false,
'no-unused-block-params': false,
'simple-unless': false,
'no-console': false,
'no-bare-strings': false
}
'no-bare-strings': false,
},
};
88 changes: 44 additions & 44 deletions app/abilities/doi.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { w } from '@ember/string';
export default Ability.extend({
currentUser: service(),

canViewHealth: computed('currentUser.role_id', function () {
canViewHealth: computed('currentUser.role_id', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
case 'provider_admin':
Expand All @@ -15,7 +15,7 @@ export default Ability.extend({
return false;
}
}),
canViewState: computed('currentUser.role_id', function () {
canViewState: computed('currentUser.role_id', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
case 'provider_admin':
Expand All @@ -25,18 +25,18 @@ export default Ability.extend({
return false;
}
}),
canSource: computed('currentUser.role_id', function () {
canSource: computed('currentUser.role_id', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
default:
return false;
}
}),
canTransfer: computed('currentUser.role_id', 'currentUser.provider_id', 'model.repository.provider.id', 'repository.provider.id', 'model.repository.id', 'model.query.client-id', function () {
canTransfer: computed('currentUser.role_id', 'currentUser.provider_id', 'model.repository.provider.id', 'repository.provider.id', 'model.repository.id', 'model.query.client-id', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
if (w("crossref.citations medra.citations kisti.citations jalc.citations op.citations").includes(this.get('model.repository.id')) || w("crossref.citations medra.citations kisti.citations jalc.citations op.citations").includes(this.get('model.query.client-id'))) {
if (w('crossref.citations medra.citations kisti.citations jalc.citations op.citations').includes(this.get('model.repository.id')) || w('crossref.citations medra.citations kisti.citations jalc.citations op.citations').includes(this.get('model.query.client-id'))) {
return false;
} else {
return true;
Expand All @@ -47,64 +47,64 @@ export default Ability.extend({
return false;
}
}),
canMove: computed('currentUser.role_id', 'currentUser.provider_id', 'repository.id', 'repository.provider.id', function () {
canMove: computed('currentUser.role_id', 'currentUser.provider_id', 'repository.id', 'repository.provider.id', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
if (w("crossref.citations medra.citations kisti.citations jalc.citations op.citations").includes(this.get('repository.id'))) {
if (w('crossref.citations medra.citations kisti.citations jalc.citations op.citations').includes(this.get('repository.id'))) {
return false;
} else {
return true;
}
case 'provider_admin':
return true; //this.get('currentUser.provider_id') === this.get('repository.provider.id');
return true; // this.get('currentUser.provider_id') === this.get('repository.provider.id');
default:
return false;
}
}),
canUpdate: computed('currentUser.role_id', 'currentUser.client_id', 'model.id', function () {
if (w("crossref.citations medra.citations kisti.citations jalc.citations op.citations").includes(this.get('model.id'))) {
canUpdate: computed('currentUser.role_id', 'currentUser.client_id', 'model.id', function() {
if (w('crossref.citations medra.citations kisti.citations jalc.citations op.citations').includes(this.get('model.id'))) {
return false;
} else {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
case 'provider_admin':
return true;
case 'client_admin':
return this.get('currentUser.client_id') === this.get('model.repository.id');
default:
return false;
case 'staff_admin':
case 'provider_admin':
return true;
case 'client_admin':
return this.get('currentUser.client_id') === this.get('model.repository.id');
default:
return false;
}
}
}),
canUpload: computed('currentUser.role_id', 'currentUser.client_id', 'model.query.client-id', function () {
if (w("crossref.citations medra.citations kisti.citations jalc.citations op.citations").includes(this.get('model.query.client-id'))) {
canUpload: computed('currentUser.role_id', 'currentUser.client_id', 'model.query.client-id', function() {
if (w('crossref.citations medra.citations kisti.citations jalc.citations op.citations').includes(this.get('model.query.client-id'))) {
return false;
} else {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
case 'client_admin':
return this.get('currentUser.client_id') === this.get('model.query.client-id');
default:
return false;
case 'staff_admin':
return true;
case 'client_admin':
return this.get('currentUser.client_id') === this.get('model.query.client-id');
default:
return false;
}
}
}),
canCreate: computed('currentUser.role_id', 'currentUser.client_id', 'model.query.client-id', function () {
if (w("crossref.citations medra.citations kisti.citations jalc.citations op.citations").includes(this.get('model.query.client-id'))) {
canCreate: computed('currentUser.role_id', 'currentUser.client_id', 'model.query.client-id', function() {
if (w('crossref.citations medra.citations kisti.citations jalc.citations op.citations').includes(this.get('model.query.client-id'))) {
return false;
} else {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
case 'client_admin':
return this.get('currentUser.client_id') === this.get('model.query.client-id');
default:
return false;
case 'staff_admin':
return true;
case 'client_admin':
return this.get('currentUser.client_id') === this.get('model.query.client-id');
default:
return false;
}
}
}),
canDelete: computed('currentUser.role_id', 'currentUser.client_id', 'model.repository.id', function () {
canDelete: computed('currentUser.role_id', 'currentUser.client_id', 'model.repository.id', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
Expand All @@ -114,8 +114,8 @@ export default Ability.extend({
return false;
}
}),
canModify: computed('currentUser.role_id', 'currentUser.client_id', 'model.repository.id', function () {
if (w("crossref.citations medra.citations kisti.citations jalc.citations op.citations").includes(this.get('model.repository.id'))) {
canModify: computed('currentUser.role_id', 'currentUser.client_id', 'model.repository.id', function() {
if (w('crossref.citations medra.citations kisti.citations jalc.citations op.citations').includes(this.get('model.repository.id'))) {
return false;
} else {
switch (this.get('currentUser.role_id')) {
Expand All @@ -128,8 +128,8 @@ export default Ability.extend({
}
}
}),
canEdit: computed('currentUser.role_id', 'currentUser.client_id', 'model.repository.id', function () {
if (w("crossref.citations medra.citations kisti.citations jalc.citations op.citations").includes(this.get('model.repository.id'))) {
canEdit: computed('currentUser.role_id', 'currentUser.client_id', 'model.repository.id', function() {
if (w('crossref.citations medra.citations kisti.citations jalc.citations op.citations').includes(this.get('model.repository.id'))) {
return false;
} else {
switch (this.get('currentUser.role_id')) {
Expand All @@ -140,9 +140,9 @@ export default Ability.extend({
default:
return false;
}
}
}
}),
canForm: computed('currentUser.role_id', 'currentUser.client_id', 'model.repository.id', function () {
canForm: computed('currentUser.role_id', 'currentUser.client_id', 'model.repository.id', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
Expand All @@ -152,11 +152,11 @@ export default Ability.extend({
return false;
}
}),
canDetail: computed('currentUser.role_id', 'currentUser.provider_id', 'currentUser.client_id', 'model.repository.id', 'model.repository.provider.id', 'model.state', function () {
canDetail: computed('currentUser.role_id', 'currentUser.provider_id', 'currentUser.client_id', 'model.repository.id', 'model.repository.provider.id', 'model.state', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
case 'provider_admin':
case 'provider_admin':
return this.get('currentUser.provider_id') === this.get('model.repository.provider.id');
case 'client_admin':
return this.get('currentUser.client_id') === this.get('model.repository.id');
Expand All @@ -166,7 +166,7 @@ export default Ability.extend({
return false;
}
}),
canRead: computed('currentUser.role_id', 'currentUser.provider_id', 'currentUser.client_id', 'model.repository.id', 'model.provider.id', 'model.state', function () {
canRead: computed('currentUser.role_id', 'currentUser.provider_id', 'currentUser.client_id', 'model.repository.id', 'model.provider.id', 'model.state', function() {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
Expand All @@ -179,5 +179,5 @@ export default Ability.extend({
default:
return this.get('model.state') === 'findable';
}
})
}),
});
6 changes: 3 additions & 3 deletions app/abilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ export default Ability.extend({
currentUser: service(),

canWrite: computed(function() {
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
default:
return false;
}
}),
canRead: computed(function() {
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
default:
return false;
}
})
}),
});
6 changes: 3 additions & 3 deletions app/abilities/message.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
import { Ability } from 'ember-can'
import { Ability } from 'ember-can';

export default Ability.extend({
currentUser: service(),

canRead: computed('currentUser.role_id', 'model.id', function() {
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return 'admin' === this.get('model.id');
case 'provider_admin':
Expand All @@ -16,5 +16,5 @@ export default Ability.extend({
default:
return false;
}
})
}),
});
10 changes: 5 additions & 5 deletions app/abilities/organization.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default Ability.extend({
currentUser: service(),

canCreate: computed('currentUser.role_id', 'currentUser.provider_id', 'model.organizations.query.consortium-id', function() {
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
case 'provider_admin':
Expand All @@ -16,15 +16,15 @@ export default Ability.extend({
}
}),
canDelete: computed('currentUser.role_id', function() {
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
default:
return false;
}
}),
canUpdate: computed('currentUser.role_id', 'currentUser.provider_id', 'model.id', function() {
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
case 'provider_admin':
Expand All @@ -34,13 +34,13 @@ export default Ability.extend({
}
}),
canRead: computed('currentUser.role_id', 'currentUser.provider_id', 'model.id', function() {
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
case 'provider_admin':
return this.get('currentUser.provider_id') === this.get('model.id');
default:
return false;
}
})
}),
});
10 changes: 5 additions & 5 deletions app/abilities/prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default Ability.extend({
currentUser: service(),

canWrite: computed('currentUser.role_id', function() {
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
case 'provider_admin':
return true;
Expand All @@ -15,8 +15,8 @@ export default Ability.extend({
}
}),
canUpdate: computed('currentUser.role_id', 'currentUser.provider_id', 'currentUser.client_id', 'model.repositories', 'model.providers', function() {
//let self = this;
switch(this.get('currentUser.role_id')) {
// let self = this;
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
case 'provider_admin':
Expand All @@ -30,7 +30,7 @@ export default Ability.extend({
}),
canRead: computed('currentUser.role_id', 'currentUser.provider_id', 'currentUser.client_id', 'model.repositories', 'model.providers', function() {
let self = this;
switch(this.get('currentUser.role_id')) {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
case 'provider_admin':
Expand All @@ -45,5 +45,5 @@ export default Ability.extend({
default:
return false;
}
})
}),
});
Loading

0 comments on commit 1a1ac3e

Please sign in to comment.