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

[Cleanup] eslint ember-suave/no-const-outside-module-scope #735

Merged
merged 1 commit into from
Oct 13, 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
6 changes: 3 additions & 3 deletions app/components/custom-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ export default Ember.Component.extend(SelectValues, {
classNames: 'detail-section-content',
fieldsByRow: function() {
let rows = [];
const form = this.get('form');
let form = this.get('form');
if (!Ember.isEmpty(form)) {
const fields = form.fields;
const numberOfColumns = this.getWithDefault('form.columns', 1);
let fields = form.fields;
let numberOfColumns = this.getWithDefault('form.columns', 1);
let currentRow = [];

let colCount = 0;
Expand Down
14 changes: 7 additions & 7 deletions app/components/role-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ export default Ember.Component.extend({

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

// decrement index by 1 if we have a prompt
const hasPrompt = !!this.get('prompt');
const contentIndex = hasPrompt ? selectedIndex - 1 : selectedIndex;
let hasPrompt = !!this.get('prompt');
let contentIndex = hasPrompt ? selectedIndex - 1 : selectedIndex;

const selection = content[contentIndex].roles;
let selection = content[contentIndex].roles;

// set the local, shadowed selection to avoid leaking
// changes to `selection` out via 2-way binding
this.set('_selection', selection);

const changeCallback = this.get('action');
let changeCallback = this.get('action');
changeCallback(selection);
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default Ember.Controller.extend(HospitalRunVersion, ModalHelper, Progress
},

invalidateSession: function() {
const session = this.get('session');
let session = this.get('session');
if (session.get('isAuthenticated')) {
session.invalidate();
}
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/charge-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default Ember.Mixin.create({

afterModel: function() {
return new Ember.RSVP.Promise(function(resolve, reject) {
const database = this.get('database');
let database = this.get('database');
let maxId = database.getPouchId({}, 'pricing'),
minId = database.getPouchId(null, 'pricing'),
pricingCategory = this.get('pricingCategory'),
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export default Ember.Mixin.create({

// Navigation items get mapped localizations
localizedNavItems: Ember.computed('navItems.[]', function() {
const localizationPrefix = 'navigation.';
let localizationPrefix = 'navigation.';
// Supports unlocalized keys for now, otherwise we would get:
// "Missing translation: key.etc.path"
let translationOrOriginal = (translation, original) => {
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/pagination-props.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
export default Ember.Mixin.create({
paginationProps: function() {
const paginationProperties = [
let paginationProperties = [
'disableNextPage',
'disablePreviousPage',
'showFirstPageButton',
Expand Down
14 changes: 7 additions & 7 deletions app/mixins/patient-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ export default Ember.Mixin.create(PouchDbMixin, {
* id will be automatically generated via Ember data.
*/
generateFriendlyId() {
const config = this.get('config');
const database = this.get('database');
const maxValue = this.get('maxValue');
let config = this.get('config');
let database = this.get('database');
let maxValue = this.get('maxValue');

const findUnusedId = (sequence) => {
let findUnusedId = (sequence) => {
let current, id;
return config.getPatientPrefix()
.then(function(prefix) {
current = sequence.get('value');
id = sequenceId(prefix, current);
const query = {
startkey: [ id, null ],
endkey: [ id, maxValue ]
let query = {
startkey: [id, null],
endkey: [id, maxValue]
};
return database.queryMainDB(query, 'patient_by_display_id');
})
Expand Down
4 changes: 2 additions & 2 deletions app/mixins/setup-user-role.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Ember from 'ember';
export default Ember.Mixin.create({
setupUserRole() {
const session = this.get('session');
const userRole = session.get('data.authenticated.role');
let session = this.get('session');
let userRole = session.get('data.authenticated.role');
return this.get('store').find('user-role', userRole.dasherize()).then((userCaps) => {
session.set('data.authenticated.userCaps', userCaps.get('capabilities'));
let sessionStore = session.get('store');
Expand Down
4 changes: 2 additions & 2 deletions app/models/inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export default AbstractModel.extend(LocationName, {
}),

condition: computed('rank', 'estimatedDaysOfStock', function() {
const estimatedDaysOfStock = this.get('estimatedDaysOfStock');
const multiplier = rankToMultiplier(this.get('rank'));
let estimatedDaysOfStock = this.get('estimatedDaysOfStock');
let multiplier = rankToMultiplier(this.get('rank'));

return getCondition(estimatedDaysOfStock, multiplier);
}),
Expand Down
18 changes: 9 additions & 9 deletions app/patients/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,16 +529,16 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession,
},

_updateSequence: function(record) {
const config = this.get('config');
const friendlyId = record.get('friendlyId');
let config = this.get('config');
let friendlyId = record.get('friendlyId');
return config.getPatientPrefix().then((prefix) => {
const re = new RegExp(`^${prefix}\\d{5}$`);
let re = new RegExp(`^${prefix}\\d{5}$`);
if (!re.test(friendlyId)) {
return;
}
return this.store.find('sequence', 'patient').then((sequence) => {
const sequenceNumber = sequence.get('value');
const patientNumber = parseInt(friendlyId.slice(prefix.length));
let sequenceNumber = sequence.get('value');
let patientNumber = parseInt(friendlyId.slice(prefix.length));
if (patientNumber > sequenceNumber) {
sequence.set('value', patientNumber);
return sequence.save();
Expand All @@ -551,10 +551,10 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession,
if (!this.get('model.isNew')) {
return Ember.RSVP.resolve();
}
const database = this.get('database');
const id = this.get('model.friendlyId');
const maxValue = this.get('maxValue');
const query = {
let database = this.get('database');
let id = this.get('model.friendlyId');
let maxValue = this.get('maxValue');
let query = {
startkey: [id, null],
endkey: [id, maxValue]
};
Expand Down
10 changes: 5 additions & 5 deletions app/patients/notes/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ export default AbstractEditController.extend(IsUpdateDisabled, UserSession, Pati
},
actions: {
changeVisit: function() {
const selectEl = $('select[name="note-visits"]')[0];
const selectedIndex = selectEl.selectedIndex;
const content = this.get('patientVisitsForSelect');
let selectEl = $('select[name="note-visits"]')[0];
let selectedIndex = selectEl.selectedIndex;
let content = this.get('patientVisitsForSelect');

// decrement index by 1 if we have a prompt
const contentIndex = selectedIndex - 1;
let contentIndex = selectedIndex - 1;

const selection = content[contentIndex].selectObject;
let selection = content[contentIndex].selectObject;

// set the local, shadowed selection to avoid leaking
// changes to `selection` out via 2-way binding
Expand Down
4 changes: 2 additions & 2 deletions app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, {
},

model: function(params, transition) {
const session = this.get('session');
const isAuthenticated = session && session.get('isAuthenticated');
let session = this.get('session');
let isAuthenticated = session && session.get('isAuthenticated');
return this.get('config').setup().then(function(configs) {
if (transition.targetName !== 'finishgauth' && transition.targetName !== 'login') {
this.set('shouldSetupUserRole', true);
Expand Down
28 changes: 14 additions & 14 deletions app/services/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default Ember.Service.extend({
sessionData: Ember.computed.alias('session.data'),

setup() {
const replicateConfigDB = this.replicateConfigDB.bind(this);
const loadConfig = this.loadConfig.bind(this);
let replicateConfigDB = this.replicateConfigDB.bind(this);
let loadConfig = this.loadConfig.bind(this);
let db = this.createDB();
this.set('configDB', db);
this.setCurrentUser();
Expand All @@ -21,14 +21,14 @@ export default Ember.Service.extend({
return new PouchDB('config');
},
replicateConfigDB(db) {
const promise = new Ember.RSVP.Promise((resolve) => {
const url = `${document.location.protocol}//${document.location.host}/db/config`;
let promise = new Ember.RSVP.Promise((resolve) => {
let url = `${document.location.protocol}//${document.location.host}/db/config`;
db.replicate.from(url).then(resolve).catch(resolve);
});
return promise;
},
loadConfig() {
const config = this.get('configDB');
let config = this.get('configDB');
let options = {
include_docs: true,
keys: [
Expand All @@ -46,7 +46,7 @@ export default Ember.Service.extend({
console.log('Could not get configDB configs:', err);
reject(err);
}
const configObj = {};
let configObj = {};
for (let i = 0; i < response.rows.length; i++) {
if (!response.rows[i].error && response.rows[i].doc) {
configObj[response.rows[i].id] = response.rows[i].doc.value;
Expand All @@ -57,7 +57,7 @@ export default Ember.Service.extend({
}, 'getting configuration from the database');
},
getFileLink(id) {
const config = this.get('configDB');
let config = this.get('configDB');
return new Ember.RSVP.Promise(function(resolve, reject) {
config.get(`file-link_${id}`, function(err, doc) {
if (err) {
Expand All @@ -68,13 +68,13 @@ export default Ember.Service.extend({
});
},
removeFileLink(id) {
const config = this.get('configDB');
let config = this.get('configDB');
return this.getFileLink(id).then(function(fileLink) {
config.remove(fileLink);
});
},
saveFileLink(fileName, id) {
const config = this.get('configDB');
let config = this.get('configDB');
return new Ember.RSVP.Promise(function(resolve, reject) {
config.put({ fileName }, `file-link_${id}`, function(err, doc) {
if (err) {
Expand All @@ -85,7 +85,7 @@ export default Ember.Service.extend({
});
},
saveOauthConfigs: function(configs) {
const configDB = this.get('configDB');
let configDB = this.get('configDB');
let configKeys = Object.keys(configs);
let savePromises = [];
return this._getOauthConfigs(configKeys).then(function(records) {
Expand Down Expand Up @@ -118,7 +118,7 @@ export default Ember.Service.extend({
},

getConfigValue(id, defaultValue) {
const configDB = this.get('configDB');
let configDB = this.get('configDB');
return new Ember.RSVP.Promise(function(resolve) {
configDB.get('config_' + id).then(function(doc) {
run(null, resolve, doc.value);
Expand All @@ -130,7 +130,7 @@ export default Ember.Service.extend({
},

_getOauthConfigs: function(configKeys) {
const configDB = this.get('configDB');
let configDB = this.get('configDB');
let options = {
include_docs: true,
keys: configKeys
Expand All @@ -139,8 +139,8 @@ export default Ember.Service.extend({
},

setCurrentUser: function(userName) {
const config = this.get('configDB');
const sessionData = this.get('sessionData');
let config = this.get('configDB');
let sessionData = this.get('sessionData');
if (!userName && sessionData.authenticated) {
userName = sessionData.authenticated.name;
}
Expand Down
2 changes: 1 addition & 1 deletion app/services/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default Ember.Service.extend(PouchAdapterUtils, {
pouchOptions.ajax.headers = headers;
}
}
const url = `${document.location.protocol}//${document.location.host}/db/main`;
let url = `${document.location.protocol}//${document.location.host}/db/main`;

this._createRemoteDB(url, pouchOptions)
.catch((err) => {
Expand Down
2 changes: 1 addition & 1 deletion app/utils/item-condition.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const rankMultiplierValues = [
];

export function rankToMultiplier(rank = 'B') {
const rankModel = Ember.A(rankMultiplierValues).findBy('rank', rank);
let rankModel = Ember.A(rankMultiplierValues).findBy('rank', rank);
return rankModel.value;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/admin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test('Update address options', function(assert) {
});

test('Update workflow options', function(assert) {
const selector = 'input[type=checkbox]';
let selector = 'input[type=checkbox]';

runWithPouchDump('admin', function() {
authenticateUser();
Expand Down
14 changes: 7 additions & 7 deletions tests/acceptance/patients-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ test('visiting /patients route', function(assert) {
visit('/patients');
andThen(function() {
assert.equal(currentURL(), '/patients');
const noPatientsFound = find('[data-test-selector="no-patients-found"]');
let noPatientsFound = find('[data-test-selector="no-patients-found"]');
assert.equal(noPatientsFound.text().trim(), 'No patients found. Create a new patient record?', 'no records found');
const newPatientButton = find('button:contains(+ new patient)');
let newPatientButton = find('button:contains(+ new patient)');
assert.equal(newPatientButton.length, 1, 'Add new patient button is visible');
});
click('button:contains(+ new patient)');
Expand All @@ -39,7 +39,7 @@ test('View reports tab', function(assert) {
let generateReportButton = find('button:contains(Generate Report)');
assert.equal(currentURL(), '/patients/reports');
assert.equal(generateReportButton.length, 1, 'Generate Report button is visible');
const reportType = find('[data-test-selector="select-report-type"]');
let reportType = find('[data-test-selector="select-report-type"]');
assert.equal(reportType.length, 1, 'Report type select is visible');
assert.equal(reportType.find(':selected').text().trim(), 'Admissions Detail', 'Default value selected"');
});
Expand All @@ -62,7 +62,7 @@ test('View reports tab | Patient Status', function(assert) {
let generateReportButton = find('button:contains(Generate Report)');
assert.equal(currentURL(), '/patients/reports');
assert.equal(generateReportButton.length, 1, 'Generate Report button is visible');
const reportType = find('[data-test-selector="select-report-type"] select');
let reportType = find('[data-test-selector="select-report-type"] select');
assert.equal(reportType.length, 1, 'Report type select is visible');
assert.equal(reportType.find(':selected').text().trim(), 'Patient Status', 'Default value selected"');
});
Expand Down Expand Up @@ -106,11 +106,11 @@ function testSimpleReportForm(reportName) {
select('[data-test-selector="select-report-type"] select', reportName);

andThen(function() {
const reportStartDate = find('[data-test-selector="select-report-start-date"]');
const reportEndDate = find('[data-test-selector="select-report-end-date"]');
let reportStartDate = find('[data-test-selector="select-report-start-date"]');
let reportEndDate = find('[data-test-selector="select-report-end-date"]');
assert.equal(reportStartDate.length, 1, 'Report start date select is visible');
assert.equal(reportEndDate.length, 1, 'Report end date select is visible');
const reportType = find('[data-test-selector="select-report-type"] select');
let reportType = find('[data-test-selector="select-report-type"] select');
assert.equal(reportType.find(':selected').text().trim(), reportName, `${reportName} option selected`);
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/authenticate-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
} = Ember;

Ember.Test.registerHelper('authenticateUser', function(app, attrs = {}) {
const expiresAt = new Date().getTime() + 600000;
let expiresAt = new Date().getTime() + 600000;
authenticateSession(app, merge({
name: 'hradmin',
roles: ['System Administrator','admin','user'],
Expand Down
Loading