Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

[CLEANUP] eslint ember-suave/prefer-destructuring #769

Merged
merged 1 commit into from
Oct 27, 2016
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
4 changes: 2 additions & 2 deletions app/appointments/search/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default AppointmentIndexRoute.extend(DateFormat, {
},

_modelQueryParams: function(params) {
let startDate = params.startDate;
let { startDate } = params;
let maxValue = this.get('maxValue');
if (Ember.isEmpty(startDate)) {
startDate = moment();
Expand All @@ -43,7 +43,7 @@ export default AppointmentIndexRoute.extend(DateFormat, {
selectedProvider: params.provider,
selectedStatus: params.status
});
let startDate = params.startDate;
let { startDate } = params;
startDate = new Date();
if (!Ember.isEmpty(params.startDate)) {
startDate.setTime(params.startDate);
Expand Down
2 changes: 1 addition & 1 deletion app/components/custom-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default Ember.Component.extend(SelectValues, {
let rows = [];
let form = this.get('form');
if (!Ember.isEmpty(form)) {
let fields = form.fields;
let { fields } = form;
let numberOfColumns = this.getWithDefault('form.columns', 1);
let currentRow = [];

Expand Down
3 changes: 1 addition & 2 deletions app/components/image-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ export default InputComponent.extend({
_resizeImage: function(img) {
// Derived from https://github.com/josefrichter/resize/blob/master/public/preprocess.js
let canvas = document.createElement('canvas');
let height = img.height;
let width = img.width;
let { height, width } = img;
let maxHeight = 1024;
let maxWidth = 1024;

Expand Down
2 changes: 1 addition & 1 deletion app/components/price-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default Ember.Component.extend(ChargeActions, {
return pricingItem;
}.bind(this));
let offset = 0;
let length = pricingList.length;
let { length } = pricingList;
while (offset < length) {
rows.push(pricingList.slice(offset, offset + 6));
offset += 6;
Expand Down
3 changes: 1 addition & 2 deletions app/components/quantity-calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ export default Ember.Component.extend({
let lastObject = quantityGroups.get('lastObject');
let targetUnit = this.get('targetUnit');
haveQuantities = quantityGroups.every(function(item) {
let quantity = item.quantity;
let unit = item.unit;
let { quantity, unit } = item;
return (!Ember.isEmpty(quantity) && !Ember.isEmpty(unit) && !isNaN(quantity));
});
if (haveQuantities && lastObject.unit === targetUnit) {
Expand Down
4 changes: 2 additions & 2 deletions app/components/role-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default Ember.Component.extend({

actions: {
change() {
let selectEl = this.$('select')[0];
let selectedIndex = selectEl.selectedIndex;
let selectEl = this.$('select').get(0);
let { selectedIndex } = selectEl;
let content = this.get('content');

// decrement index by 1 if we have a prompt
Expand Down
8 changes: 4 additions & 4 deletions app/components/take-photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ export default Ember.Component.extend({
fileUpload.hide();
camera.show();
if (!setupCamera) {
let canvas = this.$('canvas')[0];
let photo = this.$('img')[0];
let video = this.$('video')[0];
let canvas = this.$('canvas').get(0);
let photo = this.$('img').get(0);
let video = this.$('video').get(0);
this.setProperties({
canvas: canvas,
photo: photo,
Expand Down Expand Up @@ -163,7 +163,7 @@ export default Ember.Component.extend({
if (typeof streamToStop.active === 'undefined') {
streamToStop.stop();
} else {
let track = streamToStop.getTracks()[0];
let [track] = streamToStop.getTracks();
track.stop();
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/date-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Ember from 'ember';
export default Ember.Helper.helper(function(params, hash) {
if (!Ember.isEmpty(params[0])) {
let dateFormat = 'l';
let date = params[0];
let [date] = params;
if (hash && hash.format) {
dateFormat = hash.format;
}
Expand Down
13 changes: 6 additions & 7 deletions app/inventory/reports/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
_adjustPurchase: function(purchases, purchaseId, quantity, increment) {
let purchaseToAdjust = purchases.findBy('id', purchaseId);
if (!Ember.isEmpty(purchaseToAdjust)) {
let calculatedQuantity = purchaseToAdjust.calculatedQuantity;
let { calculatedQuantity } = purchaseToAdjust;
if (increment) {
calculatedQuantity += quantity;
} else {
Expand Down Expand Up @@ -405,7 +405,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
},

_calculateCostPerUnit: function(purchase) {
let purchaseCost = purchase.purchaseCost;
let { purchaseCost } = purchase;
let quantity = parseInt(purchase.originalQuantity);
if (Ember.isEmpty(purchaseCost) || Ember.isEmpty(quantity)) {
return 0;
Expand Down Expand Up @@ -572,7 +572,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
this._getInventoryItems(inventoryIds).then(function(inventoryMap) {
let i18n = this.get('i18n');
purchaseDocs.forEach(function(purchase) {
let currentQuantity = purchase.currentQuantity;
let { currentQuantity } = purchase;
let expirationDate = new Date(purchase.expirationDate);
let inventoryItem = inventoryMap[purchase.inventoryItem];
if (inventoryItem && this._includeLocation(purchase.location)) {
Expand Down Expand Up @@ -782,10 +782,10 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number
}
if (!Ember.isEmpty(inventoryRequests)) {
inventoryRequests.forEach(function(request) {
let adjustPurchases = request.adjustPurchases;
let { adjustPurchases } = request;
let increment = false;
let purchases = request.purchasesAffected;
let transactionType = request.transactionType;
let { transactionType } = request;
increment = (transactionType === 'Adjustment (Add)' || transactionType === 'Return');
if (adjustPurchases) {
if (!Ember.isEmpty(purchases) && !Ember.isEmpty(inventoryPurchases)) {
Expand Down Expand Up @@ -873,11 +873,10 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number

if (!Ember.isEmpty(inventoryRequests)) {
inventoryRequests.forEach(function(request) {
let adjustPurchases = request.adjustPurchases;
let { adjustPurchases, transactionType } = request;
let increment = false;
let locations = request.locationsAffected;
let purchases = request.purchasesAffected;
let transactionType = request.transactionType;

increment = (transactionType === 'Adjustment (Add)' || transactionType === 'Return');
if (adjustPurchases) {
Expand Down
4 changes: 2 additions & 2 deletions app/patients/notes/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export default AbstractEditController.extend(IsUpdateDisabled, UserSession, Pati
},
actions: {
changeVisit: function() {
let selectEl = $('select[name="note-visits"]')[0];
let selectedIndex = selectEl.selectedIndex;
let selectEl = $('select[name="note-visits"]').get(0);
let { selectedIndex } = selectEl;
let content = this.get('patientVisitsForSelect');

// decrement index by 1 if we have a prompt
Expand Down
2 changes: 1 addition & 1 deletion app/pricing/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default AbstractEditController.extend(LabPricingTypes, ImagingPricingType
this.send('closeModal');
},
deleteOverride: function(model) {
let overrideToDelete = model.overrideToDelete;
let { overrideToDelete } = model;
let pricingOverrides = this.get('model.pricingOverrides');
pricingOverrides.removeObject(overrideToDelete);
overrideToDelete.destroyRecord().then(function() {
Expand Down