Skip to content

Commit b22f46a

Browse files
committed
Ember 2.18 upgrade
1 parent 50055a1 commit b22f46a

20 files changed

+1478
-226
lines changed

.eslintrc.js

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,54 @@ module.exports = {
44
ecmaVersion: 6,
55
sourceType: 'module'
66
},
7-
extends: 'eslint:recommended',
7+
plugins: [
8+
'ember'
9+
],
10+
extends: [
11+
'eslint:recommended',
12+
'plugin:ember/recommended'
13+
],
814
env: {
915
browser: true
1016
},
1117
rules: {
18+
'ember/no-on-calls-in-components': 'off',
19+
'ember/closure-actions': 'off'
1220
},
13-
globals: {
14-
define: true,
15-
FastBoot: true
16-
}
21+
overrides: [
22+
// node files
23+
{
24+
files: [
25+
'index.js',
26+
'testem.js',
27+
'ember-cli-build.js',
28+
'config/**/*.js',
29+
'tests/dummy/config/**/*.js'
30+
],
31+
excludedFiles: [
32+
'app/**',
33+
'addon/**'
34+
],
35+
parserOptions: {
36+
sourceType: 'script',
37+
ecmaVersion: 2015
38+
},
39+
env: {
40+
browser: false,
41+
node: true
42+
},
43+
plugins: ['node'],
44+
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
45+
})
46+
},
47+
48+
// test files
49+
{
50+
files: ['tests/**/*.js'],
51+
excludedFiles: ['tests/dummy/**/*.js'],
52+
env: {
53+
embertest: true
54+
}
55+
}
56+
]
1757
};

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
.bowerrc
88
.editorconfig
99
.ember-cli
10-
.gitignore
1110
.eslintrc.js
11+
.gitignore
1212
.watchmanconfig
1313
.travis.yml
1414
bower.json

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ before_install:
4444
- npm --version
4545

4646
script:
47+
- npm run lint:js
4748
# Usually, it's ok to finish the test scenario without reverting
4849
# to the addon's original dependency state, skipping "cleanup".
4950
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ You can declare an array in JavaScript in your controller or parent component:
4141

4242
```javascript
4343
// app/controllers/ticket.js
44-
import Ember from 'ember';
44+
import Controller from '@ember/controller';
45+
import { computed } from '@ember/object';
4546

46-
export default Ember.Controller.extend({
47-
steps: Ember.computed(function(){
47+
export default Controller.extend({
48+
steps: computed(function() {
4849
return [
4950
{
5051
element: $('#step1'),
@@ -77,7 +78,7 @@ import Ember from 'ember';
7778

7879
export default Ember.Route.extend({
7980
actions: {
80-
introBeforeChange: function(previousStep, nextStep, introJSComponent,
81+
introBeforeChange(previousStep, nextStep, introJSComponent,
8182
elementOfNewStep){
8283
// You could track user interactions here, e.g. analytics.
8384
this.sendAnalytics(prevStep);

addon/components/intro-js.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { on } from '@ember/object/evented';
66
import Component from '@ember/component';
77
import introJS from 'intro-js'
88

9-
var INTRO_JS_OPTIONS = [
9+
let INTRO_JS_OPTIONS = [
1010
'next-label',
1111
'prev-label',
1212
'skip-label',
@@ -27,7 +27,7 @@ var INTRO_JS_OPTIONS = [
2727
'disable-interaction'
2828
];
2929

30-
var IntroJSComponent = Component.extend({
30+
export default Component.extend({
3131

3232
setupIntroJS: on('didInsertElement', observer('start-if', function() {
3333
scheduleOnce('afterRender', this, this.startIntroJS);
@@ -77,7 +77,6 @@ var IntroJSComponent = Component.extend({
7777
'exit-on-esc',
7878
'exit-on-overlay-click',
7979
'show-step-numbers',
80-
'show-step-numbers',
8180
'keyboard-navigation',
8281
'show-buttons',
8382
'show-bullets',
@@ -88,9 +87,9 @@ var IntroJSComponent = Component.extend({
8887
'steps',
8988

9089
function(){
91-
var option, normalizedName, value, options = {};
90+
let option, normalizedName, value, options = {};
9291

93-
for(var i = 0; i < INTRO_JS_OPTIONS.length; i++){
92+
for(let i = 0; i < INTRO_JS_OPTIONS.length; i++){
9493
option = INTRO_JS_OPTIONS[i];
9594
normalizedName = camelize(underscore(option));
9695
value = this.get(option);
@@ -106,15 +105,12 @@ var IntroJSComponent = Component.extend({
106105
}
107106
),
108107

109-
startIntroJS: function(){
110-
var intro;
111-
var options = this.get('introJSOptions');
112-
108+
startIntroJS(){
113109
if (!this.get('introJS')) {
114110
this._setIntroJS(introJS());
115111
}
116-
117-
intro = this.get('introJS');
112+
let intro = this.get('introJS');
113+
let options = this.get('introJSOptions');
118114

119115
if (this.get('start-if')){
120116
intro.setOptions(options);
@@ -165,18 +161,16 @@ var IntroJSComponent = Component.extend({
165161
},
166162

167163
willDestroyElement() {
168-
var intro = this.get('introJS');
164+
let intro = this.get('introJS');
169165
if (intro) {
170166
intro.exit();
171167
}
172168

173169
this._super(...arguments);
174170
},
175171

176-
_setCurrentStep: function(step){
177-
var stepObject = A(this.get('steps')).objectAt(step);
172+
_setCurrentStep(step){
173+
let stepObject = A(this.get('steps')).objectAt(step);
178174
this.set('currentStep', stepObject);
179175
}
180176
});
181-
182-
export default IntroJSComponent;

addon/test-helpers.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ var currentStep;
1414
var introJS;
1515

1616
IntroJSComponent.reopen({
17-
_setIntroJS: function(_introJS) {
17+
_setIntroJS(_introJS) {
1818
introJS = _introJS;
1919
this._super(introJS);
2020
},
21-
_onExit: function(){
21+
_onExit(){
2222
this._super();
2323
},
2424

25-
_onAfterChange: function(targetElement){
25+
_onAfterChange(targetElement){
2626
nextCompleted = true;
2727
this._super(targetElement);
2828
},
2929

30-
_setCurrentStep: function(step){
30+
_setCurrentStep(step){
3131
this._super(step);
3232
currentStep = this.get('currentStep');
3333
},

config/ember-try.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env node */
21
module.exports = {
32
scenarios: [
43
{

config/environment.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env node */
21
'use strict';
32

43
module.exports = function(/* environment, appConfig */) {

ember-cli-build.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env node */
21
'use strict';
32

43
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
/* eslint-env node */
21
'use strict';
32

43
const path = require('path');
4+
const resolve = require('resolve');
55
const Funnel = require('broccoli-funnel');
66
const mergeTrees = require('broccoli-merge-trees');
77

88
module.exports = {
99
name: 'ember-introjs',
1010

11-
included: function(app) {
11+
included(app) {
1212
this._super.included(app);
1313

1414
app.import('vendor/ember-introjs/intro.js', {
@@ -20,7 +20,7 @@ module.exports = {
2020
},
2121

2222
introJsPath() {
23-
return path.join(this.app.project.nodeModulesPath, 'intro.js');
23+
return path.dirname(resolve.sync('intro.js', { basedir: __dirname }))
2424
},
2525

2626
treeForVendor(tree) {

0 commit comments

Comments
 (0)