-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[update] Adds DSC style linting (#108)
* [init] adds DSC config to linting * [update] adds linting updates (removes `;` 😁)
- Loading branch information
1 parent
699d2ed
commit dc98e47
Showing
20 changed files
with
1,998 additions
and
1,687 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,9 @@ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 2017, | ||
sourceType: 'module' | ||
}, | ||
plugins: [ | ||
'ember' | ||
], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:ember/recommended' | ||
'dollarshaveclub/ember' | ||
], | ||
env: { | ||
browser: true | ||
}, | ||
rules: { | ||
}, | ||
overrides: [ | ||
// node files | ||
{ | ||
files: [ | ||
'index.js', | ||
'testem.js', | ||
'ember-cli-build.js', | ||
'config/**/*.js', | ||
'tests/dummy/config/**/*.js' | ||
], | ||
excludedFiles: [ | ||
'app/**', | ||
'addon/**', | ||
'tests/dummy/app/**' | ||
], | ||
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 | ||
}) | ||
} | ||
] | ||
root: true | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
import Mixin from '@ember/object/mixin'; | ||
import { get, computed } from '@ember/object'; | ||
import { inject } from '@ember/service'; | ||
import { getOwner } from '@ember/application'; | ||
import Mixin from '@ember/object/mixin' | ||
import { get, computed } from '@ember/object' | ||
import { inject } from '@ember/service' | ||
import { getOwner } from '@ember/application' | ||
|
||
export default Mixin.create({ | ||
scheduler: inject('scheduler'), | ||
service: inject('router-scroll'), | ||
|
||
isFastBoot: computed(function() { | ||
const fastboot = getOwner(this).lookup('service:fastboot'); | ||
return fastboot ? fastboot.get('isFastBoot') : false; | ||
isFastBoot: computed(function () { | ||
const fastboot = getOwner(this).lookup('service:fastboot') | ||
return fastboot ? fastboot.get('isFastBoot') : false | ||
}), | ||
|
||
willTransition(...args) { | ||
this._super(...args); | ||
willTransition (...args) { | ||
this._super(...args) | ||
|
||
if (get(this, 'isFastBoot')) { return; } | ||
if (get(this, 'isFastBoot')) { return } | ||
|
||
get(this, 'service').update(); | ||
get(this, 'service').update() | ||
}, | ||
|
||
didTransition(transitions, ...args) { | ||
this._super(transitions, ...args); | ||
didTransition (transitions, ...args) { | ||
this._super(transitions, ...args) | ||
|
||
if (get(this, 'isFastBoot')) { return; } | ||
if (get(this, 'isFastBoot')) { return } | ||
|
||
this.get('scheduler').scheduleWork('afterContentPaint', () => { | ||
this.updateScrollPosition(transitions); | ||
}); | ||
this.updateScrollPosition(transitions) | ||
}) | ||
}, | ||
|
||
updateScrollPosition(transitions) { | ||
const lastTransition = transitions[transitions.length - 1]; | ||
const url = get(lastTransition, 'handler.router.currentURL'); | ||
const hashElement = url ? document.getElementById(url.split('#').pop()) : null; | ||
updateScrollPosition (transitions) { | ||
const lastTransition = transitions[transitions.length - 1] | ||
const url = get(lastTransition, 'handler.router.currentURL') | ||
const hashElement = url ? document.getElementById(url.split('#').pop()) : null | ||
|
||
let scrollPosition; | ||
let scrollPosition | ||
|
||
if(url && url.indexOf('#') > -1 && hashElement) { | ||
scrollPosition = { x: hashElement.offsetLeft, y: hashElement.offsetTop }; | ||
if (url && url.indexOf('#') > -1 && hashElement) { | ||
scrollPosition = { x: hashElement.offsetLeft, y: hashElement.offsetTop } | ||
} else { | ||
scrollPosition = get(this, 'service.position'); | ||
scrollPosition = get(this, 'service.position') | ||
} | ||
const scrollElement = get(this, 'service.scrollElement'); | ||
const scrollElement = get(this, 'service.scrollElement') | ||
|
||
const preserveScrollPosition = get(lastTransition, 'handler.controller.preserveScrollPosition'); | ||
const preserveScrollPosition = get(lastTransition, 'handler.controller.preserveScrollPosition') | ||
|
||
if (!preserveScrollPosition) { | ||
if ('window' === scrollElement) { | ||
window.scrollTo(scrollPosition.x, scrollPosition.y); | ||
} else if ('#' === scrollElement.charAt(0)) { | ||
const element = document.getElementById(scrollElement.substring(1)); | ||
if (scrollElement === 'window') { | ||
window.scrollTo(scrollPosition.x, scrollPosition.y) | ||
} else if (scrollElement.charAt(0) === '#') { | ||
const element = document.getElementById(scrollElement.substring(1)) | ||
|
||
if (element) { | ||
element.scrollLeft = scrollPosition.x; | ||
element.scrollTop = scrollPosition.y; | ||
element.scrollLeft = scrollPosition.x | ||
element.scrollTop = scrollPosition.y | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
module.exports = function(/* environment, appConfig */) { | ||
return { }; | ||
}; | ||
module.exports = function (/* environment, appConfig */) { | ||
return { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
module.exports = { | ||
name: 'ember-router-scroll' | ||
}; | ||
name: 'ember-router-scroll', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit, click, currentURL } from '@ember/test-helpers'; | ||
import { module, test } from 'qunit' | ||
import { setupApplicationTest } from 'ember-qunit' | ||
import { visit, click, currentURL } from '@ember/test-helpers' | ||
|
||
module('Acceptance | basic functionality', function(hooks) { | ||
setupApplicationTest(hooks); | ||
module('Acceptance | basic functionality', function (hooks) { | ||
setupApplicationTest(hooks) | ||
|
||
test('The application should work when loading a page and clicking a link', async function(assert) { | ||
await visit('/'); | ||
test('The application should work when loading a page and clicking a link', async function (assert) { | ||
await visit('/') | ||
|
||
await click('a[href="/next-page"]'); | ||
await click('a[href="/next-page"]') | ||
|
||
assert.equal(currentURL(), '/next-page'); | ||
}); | ||
}); | ||
assert.equal(currentURL(), '/next-page') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import Application from '@ember/application'; | ||
import Resolver from './resolver'; | ||
import loadInitializers from 'ember-load-initializers'; | ||
import config from './config/environment'; | ||
import Application from '@ember/application' | ||
import Resolver from './resolver' | ||
import loadInitializers from 'ember-load-initializers' | ||
import config from './config/environment' | ||
|
||
const App = Application.extend({ | ||
modulePrefix: config.modulePrefix, | ||
podModulePrefix: config.podModulePrefix, | ||
Resolver | ||
}); | ||
Resolver, | ||
}) | ||
|
||
loadInitializers(App, config.modulePrefix); | ||
loadInitializers(App, config.modulePrefix) | ||
|
||
export default App; | ||
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import Resolver from 'ember-resolver'; | ||
import Resolver from 'ember-resolver' | ||
|
||
export default Resolver; | ||
export default Resolver |
Oops, something went wrong.