Skip to content
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

Bring all dependencies inline with each other and stabilize versions #2946

Merged
merged 9 commits into from
May 24, 2019
  •  
  •  
  •  
50 changes: 43 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: "module",
allowImportExportEverywhere: false
ecmaVersion: 2017,
sourceType: 'module'
},
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember-suave/recommended'
],
env: {
'browser': true
browser: true
},
rules: {
'arrow-spacing': 'error',
'no-var': 'error',
'no-useless-escape': 'off',
'space-before-blocks': 'error',
'comma-dangle': ['error', 'never'],
Expand Down Expand Up @@ -45,7 +48,6 @@ module.exports = {
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
'max-statements-per-line': ['error', { 'max': 2 }],
'quotes': ['error', 'single'],
'no-var': 'off',
'indent': [
'error', 2, {
"FunctionExpression": {"parameters": "first"},
Expand All @@ -64,7 +66,9 @@ module.exports = {
'eqeqeq': ['error', 'smart'],
'one-var': 'off',
'ember-suave/no-const-outside-module-scope': 'off',
'ember-suave/require-access-in-comments': 'off'
'ember-suave/require-access-in-comments': 'off',
'ember/no-get': 'error',
'ember/no-get-properties': 'error',
},
globals: {
module : true,
Expand All @@ -74,5 +78,37 @@ module.exports = {
Uint8Array : true,
require : true,
Promise : 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
},
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-extraneous-require': 'off'
})
}
]
};
3 changes: 0 additions & 3 deletions .jshintrc

This file was deleted.

4 changes: 2 additions & 2 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, AdapterFetch, Cac

isInvalid(statusCode) {
if (statusCode !== 404 && statusCode !== 422 && statusCode !== 403 && statusCode !== 409) {
this.get('notify').error('An unexpected error occurred.', {
this.notify.error('An unexpected error occurred.', {
closeAfter: 5000
});
}
Expand Down Expand Up @@ -83,7 +83,7 @@ export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, AdapterFetch, Cac
*/
ensureResponseAuthorized(status) {
if (status === 401 && this.get('session.isAuthenticated')) {
this.get('session').invalidate();
this.session.invalidate();
}
}
});
2 changes: 1 addition & 1 deletion app/components/event-card.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from '@ember/component';
import { computed } from '@ember/object';
import { forOwn } from 'lodash';
import { forOwn } from 'lodash-es';
import { pascalCase } from 'open-event-frontend/utils/string';

export default Component.extend({
Expand Down
4 changes: 2 additions & 2 deletions app/components/events/event-import-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export default Component.extend(FormMixin, {
rules : [
{
type : 'empty',
prompt : this.get('l10n').t('Please upload a file')
prompt : this.l10n.t('Please upload a file')
},
{
type : 'regExp',
value : '/^(.*.((zip|xml|ical|ics|xcal)$))?[^.]*$/i',
prompt : this.get('l10n').t('Please upload a file in suggested format')
prompt : this.l10n.t('Please upload a file in suggested format')
}
]
}
Expand Down
18 changes: 9 additions & 9 deletions app/components/events/view/export/api-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export default Component.extend({
isLoading: false,

baseUrl: computed('eventId', function() {
return `${`${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/`}${this.get('eventId')}`;
return `${`${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/`}${this.eventId}`;
}),

displayUrl: computed('eventId', function() {
return `${`${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/`}${this.get('eventId')}`;
return `${`${ENV.APP.apiHost}/${ENV.APP.apiNamespace}/events/`}${this.eventId}`;
}),

toggleSwitches: {
Expand All @@ -32,14 +32,14 @@ export default Component.extend({

makeRequest() {
this.set('isLoading', true);
this.get('loader')
.load(this.get('displayUrl'), { isExternal: true })
this.loader
.load(this.displayUrl, { isExternal: true })
.then(json => {
json = JSON.stringify(json, null, 2);
this.set('json', htmlSafe(syntaxHighlight(json)));
})
.catch(() => {
this.get('notify').error(this.get('l10n').t('Could not fetch from the server'));
this.notify.error(this.l10n.t('Could not fetch from the server'));
this.set('json', 'Could not fetch from the server');
})
.finally(() => {
Expand All @@ -48,12 +48,12 @@ export default Component.extend({
},

buildDisplayUrl() {
let newUrl = this.get('baseUrl');
let newUrl = this.baseUrl;
const include = [];

for (const key in this.get('toggleSwitches')) {
if (this.get('toggleSwitches').hasOwnProperty(key)) {
this.get('toggleSwitches')[key] && include.push(key);
for (const key in this.toggleSwitches) {
if (this.toggleSwitches.hasOwnProperty(key)) {
this.toggleSwitches[key] && include.push(key);
}
}

Expand Down
20 changes: 10 additions & 10 deletions app/components/events/view/export/download-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default Component.extend({
eventDownloadUrl : '',
isLoading : false,
fileFormat : computed(function() {
switch (this.get('downloadType')) {
switch (this.downloadType) {
case 'iCalendar':
return 'ical';
case 'Pentabarf XML':
Expand All @@ -19,29 +19,29 @@ export default Component.extend({
}
}),
displayUrl: computed(function() {
return this.get(`model.${ this.get('fileFormat') }Url`) !== null ? this.get(`model.${ this.get('fileFormat') }Url`) : 'Please publish to generate the link';
return this.get(`model.${ this.fileFormat }Url`) !== null ? this.get(`model.${ this.fileFormat }Url`) : 'Please publish to generate the link';
}),
requestLoop(exportJobInfo) {
run.later(() => {
this.get('loader')
this.loader
.load(exportJobInfo.task_url, { withoutPrefix: true })
.then(exportJobStatus => {
if (exportJobStatus.state === 'SUCCESS') {
this.set('isDownloadDisabled', false);
this.set('eventDownloadUrl', exportJobStatus.result.download_url);
this.get('notify').success(this.get('l10n').t('Download Ready'));
this.notify.success(this.l10n.t('Download Ready'));
} else if (exportJobStatus.state === 'WAITING') {
this.requestLoop(exportJobInfo);
this.set('eventExportStatus', exportJobStatus.state);
this.get('notify').alert(this.get('l10n').t('Task is going on.'));
this.notify.alert(this.l10n.t('Task is going on.'));
} else {
this.set('eventExportStatus', exportJobStatus.state);
this.get('notify').error(this.get('l10n').t('Task failed.'));
this.notify.error(this.l10n.t('Task failed.'));
}
})
.catch(() => {
this.set('eventExportStatus', 'FAILURE');
this.get('notify').error(this.get('l10n').t('Task failed.'));
this.notify.error(this.l10n.t('Task failed.'));
})
.finally(() => {
this.set('isLoading', false);
Expand All @@ -51,14 +51,14 @@ export default Component.extend({
actions: {
startExportTask() {
this.set('isLoading', true);
this.get('loader')
.load(`/events/${this.get('model.id')}/export/${this.get('fileFormat')}`)
this.loader
.load(`/events/${this.get('model.id')}/export/${this.fileFormat}`)
.then(exportJobInfo => {
this.requestLoop(exportJobInfo);
})
.catch(() => {
this.set('isLoading', false);
this.get('notify').error(this.get('l10n').t('Unexpected error occurred.'));
this.notify.error(this.l10n.t('Unexpected error occurred.'));
});
}
}
Expand Down
21 changes: 10 additions & 11 deletions app/components/events/view/overview/manage-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,33 @@ export default Component.extend({
classNames : ['ui', 'fluid', 'card'],
roleType : 'accepted',
roleInvites : computed('data.roleInvites.@each', 'roleType', function() {
return this.get('data.roleInvites').filterBy('status', this.get('roleType'));
return this.get('data.roleInvites').filterBy('status', this.roleType);
}),
actions: {
openAddUserRoleModal(invite) {
if (invite) {
this.set('currentInvite', invite);
this.set('isNewInvite', false);
} else {
const currentInvite = this.get('data').roleInvites.createRecord({});
const currentInvite = this.data.roleInvites.createRecord({});
this.set('currentInvite', currentInvite);
this.set('isNewInvite', true);
}
this.set('isAddUserRoleModalOpen', true);
},
updateUserRoles() {
this.set('isLoading', true);
const currentInvite = this.get('currentInvite');
currentInvite.set('roleName', currentInvite.get('role.name'));
this.get('currentInvite').save()
this.currentInvite.set('roleName', this.currentInvite.get('role.name'));
this.currentInvite.save()
.then(() => {
if (this.get('isNewInvite')) {
this.get('data.roleInvites').addObject(currentInvite);
if (this.isNewInvite) {
this.get('data.roleInvites').addObject(this.currentInvite);
}
this.set('isAddUserRoleModalOpen', false);
this.get('notify').success(this.get('isNewInvite') ? this.get('l10n').t('Role Invite sent successfully') : this.get('l10n').t('Role Invite updated successfully'));
this.notify.success(this.isNewInvite ? this.l10n.t('Role Invite sent successfully') : this.l10n.t('Role Invite updated successfully'));
})
.catch(() => {
this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again'));
this.notify.error(this.l10n.t('Oops something went wrong. Please try again'));
})
.finally(() => {
this.set('isLoading', false);
Expand All @@ -42,11 +41,11 @@ export default Component.extend({
this.set('isLoading', true);
invite.destroyRecord()
.then(() => {
this.get('notify').success(this.get('l10n').t('Role Invite deleted successfully'));
this.notify.success(this.l10n.t('Role Invite deleted successfully'));
this.get('data.roleInvites').removeObject(invite);
})
.catch(() => {
this.get('notify').error(this.get('l10n').t('Oops something went wrong. Please try again'));
this.notify.error(this.l10n.t('Oops something went wrong. Please try again'));
})
.finally(() => {
this.set('isLoading', false);
Expand Down
16 changes: 8 additions & 8 deletions app/components/explore/side-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default Component.extend({
customEndDate: null,

hideClearFilters: computed('category', 'sub_category', 'event_type', 'startDate', 'endDate', 'location', function() {
return !(this.get('category') || this.get('sub_category') || this.get('event_type') || this.get('startDate') || this.get('endDate') || this.get('location') !== null);
return !(this.category || this.sub_category || this.event_type || this.startDate || this.endDate || this.location !== null);
}),

dateRanges: computed(function() {
Expand All @@ -21,16 +21,16 @@ export default Component.extend({

actions: {
selectCategory(category, subCategory) {
this.set('category', (category === this.get('category') && !subCategory) ? null : category);
this.set('sub_category', (!subCategory || subCategory === this.get('sub_category')) ? null : subCategory);
this.set('category', (category === this.category && !subCategory) ? null : category);
this.set('sub_category', (!subCategory || subCategory === this.sub_category) ? null : subCategory);
},

selectEventType(eventType) {
this.set('event_type', eventType === this.get('event_type') ? null : eventType);
this.set('event_type', eventType === this.event_type ? null : eventType);
},

dateValidate(date) {
if (moment(date).isAfter(this.get('customEndDate'))) {
if (moment(date).isAfter(this.customEndDate)) {
this.set('customEndDate', date);
}

Expand All @@ -41,14 +41,14 @@ export default Component.extend({
let newStartDate = null;
let newEndDate = null;

if (dateType === this.get('dateType') && dateType !== 'custom_dates') {
if (dateType === this.dateType && dateType !== 'custom_dates') {
this.set('dateType', null);
} else {
this.set('dateType', dateType);
switch (dateType) {
case 'custom_dates':
newStartDate = this.get('customStartDate');
newEndDate = this.get('customEndDate');
newStartDate = this.customStartDate;
newEndDate = this.customEndDate;
break;

case 'all_dates':
Expand Down
8 changes: 4 additions & 4 deletions app/components/footer-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ export default Component.extend({
tagName : 'footer',
classNames : ['ui', 'inverted', 'vertical', 'footer', 'segment'],
currentLocale : computed(function() {
return this.get('l10n').getLocale();
return this.l10n.getLocale();
}),
actions: {
switchLanguage(locale) {
this.get('l10n').switchLanguage(locale);
this.l10n.switchLanguage(locale);
}
},

didInsertElement() {
this.set('eventLocations', this.get('eventLocations').sortBy('name'));
this.set('eventLocations', this.eventLocations.sortBy('name'));

let eventTypes = this.get('eventTypes').sortBy('name').toArray();
let eventTypes = this.eventTypes.sortBy('name').toArray();
eventTypes.forEach(eventType => {
if (eventType.name === 'Other') {
let other = eventType;
Expand Down
Loading