diff --git a/addon/index.js b/addon/index.js index 1528c54e..53ccaa31 100644 --- a/addon/index.js +++ b/addon/index.js @@ -24,7 +24,7 @@ export default Ember.Mixin.create({ didTransition(transitions, ...args) { this._super(transitions, ...args); - if (get(this, 'isFastBoot')) return; + if (get(this, 'isFastBoot')) { return; } next(() => this.updateScrollPosition(transitions)); }, diff --git a/addon/locations/router-scroll.js b/addon/locations/router-scroll.js index c713b6cc..76501f65 100644 --- a/addon/locations/router-scroll.js +++ b/addon/locations/router-scroll.js @@ -2,7 +2,7 @@ import Ember from 'ember'; const { get, - HistoryLocation + HistoryLocation, } = Ember; export default HistoryLocation.extend({ @@ -11,15 +11,15 @@ export default HistoryLocation.extend({ this.stateCounter = 0; }, pushState(path) { - let id = `${this.stateCounter++}`; - let state = { path, id }; + const id = `${this.stateCounter++}`; + const state = { path, id }; get(this, 'history').pushState(state, null, path); - this._previousURL = this.getURL(); + this._previousURL = this.getURL(); // eslint-disable-line no-underscore-dangle }, replaceState(path) { - let id = `${this.stateCounter++}`; - let state = { path, id }; + const id = `${this.stateCounter++}`; + const state = { path, id }; get(this, 'history').replaceState(state, null, path); - this._previousURL = this.getURL(); - } + this._previousURL = this.getURL(); // eslint-disable-line no-underscore-dangle + }, }); diff --git a/addon/services/router-scroll.js b/addon/services/router-scroll.js index 48557bbb..1b7ee130 100644 --- a/addon/services/router-scroll.js +++ b/addon/services/router-scroll.js @@ -1,3 +1,4 @@ +/* global window */ import Ember from 'ember'; const { @@ -5,7 +6,7 @@ const { set, computed, getWithDefault, - Service + Service, } = Ember; export default Service.extend({ @@ -14,21 +15,23 @@ export default Service.extend({ set(this, 'scrollMap', {}); set(this, 'key', null); }, + update() { - let scrollMap = get(this, 'scrollMap'); - let key = get(this, 'key'); + const scrollMap = get(this, 'scrollMap'); + const key = get(this, 'key'); if (key) { set(scrollMap, key, { x: window.scrollX, y: window.scrollY }); } }, - position: computed(function() { - let scrollMap = get(this, 'scrollMap'); - let stateId = get(window, 'history.state.id'); + + position: computed(function position() { + const scrollMap = get(this, 'scrollMap'); + const stateId = get(window, 'history.state.id'); set(this, 'key', stateId); - let key = getWithDefault(this, 'key', '-1'); + const key = getWithDefault(this, 'key', '-1'); return getWithDefault(scrollMap, key, { x: 0, y: 0 }); - }).volatile() + }).volatile(), }); diff --git a/package.json b/package.json index 574eddea..30355ff8 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "scripts": { "build": "ember build", - "eslint": "eslint . --ignore-path .eslintignore", + "eslint": "eslint app/**/*.js addon/**/*.js tests/**/*.js --quiet --ignore-path .eslintignore", "start": "ember server", "test": "ember try:each" },