Skip to content

Commit 9b8cdcc

Browse files
authored
Merge pull request #97 from bustle/ember-update
Upgrade to ember 3.28
2 parents 735b221 + 008d6a5 commit 9b8cdcc

31 files changed

+4193
-1277
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# misc
1414
/coverage/
1515
!.*
16+
.*/
17+
.eslintcache
1618

1719
# ember-try
1820
/.node_modules.ember-try/

.eslintrc.js

+32-36
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,54 @@ module.exports = {
77
ecmaVersion: 2018,
88
sourceType: 'module',
99
ecmaFeatures: {
10-
legacyDecorators: true
11-
}
10+
legacyDecorators: true,
11+
},
1212
},
13-
plugins: [
14-
"ember"
15-
],
13+
plugins: ['ember'],
1614
extends: [
17-
"eslint:recommended",
18-
"plugin:ember/recommended"
15+
'eslint:recommended',
16+
'plugin:ember/recommended',
17+
'plugin:prettier/recommended',
1918
],
2019
env: {
21-
browser: true
22-
},
23-
rules: {
24-
'ember/no-jquery': 'error'
20+
browser: true,
2521
},
22+
rules: {},
2623
overrides: [
2724
// node files
2825
{
2926
files: [
30-
".eslintrc.js",
31-
".template-lintrc.js",
32-
"ember-cli-build.js",
33-
"./index.js",
34-
"testem.js",
35-
"blueprints/*/index.js",
36-
"config/**/*.js",
37-
"tests/dummy/config/**/*.js",
38-
"fastboot-tests/index-test.js"
27+
'.eslintrc.js',
28+
'.prettierrc.js',
29+
'.template-lintrc.js',
30+
'ember-cli-build.js',
31+
'./index.js',
32+
'testem.js',
33+
'blueprints/*/index.js',
34+
'config/**/*.js',
35+
'tests/dummy/config/**/*.js',
36+
'fastboot-tests/index-test.js',
3937
],
4038
excludedFiles: [
41-
"addon/**",
42-
"addon-test-support/**",
43-
"app/**",
44-
"tests/dummy/app/**"
39+
'addon/**',
40+
'addon-test-support/**',
41+
'app/**',
42+
'tests/dummy/app/**',
4543
],
4644
parserOptions: {
47-
sourceType: "script"
45+
sourceType: 'script',
4846
},
4947
env: {
5048
browser: false,
5149
node: true,
52-
mocha: true
5350
},
54-
plugins: ["node"],
55-
rules: Object.assign(
56-
{},
57-
require("eslint-plugin-node").configs.recommended.rules,
58-
{
59-
// add your custom rules and overrides for node files here
60-
}
61-
)
62-
}
63-
]
51+
plugins: ['node'],
52+
extends: ['plugin:node/recommended'],
53+
},
54+
{
55+
// Test files:
56+
files: ['tests/**/*-test.{js,ts}'],
57+
extends: ['plugin:qunit/recommended'],
58+
},
59+
],
6460
};

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/.env*
1313
/.pnp*
1414
/.sass-cache
15+
/.eslintcache
1516
/connect.lock
1617
/coverage/
1718
/libpeerconnection.log

.npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
/.editorconfig
1111
/.ember-cli
1212
/.env*
13+
/.eslintcache
1314
/.eslintignore
1415
/.eslintrc.js
1516
/.git/
1617
/.gitignore
18+
/.prettierignore
19+
/.prettierrc.js
1720
/.template-lintrc.js
1821
/.travis.yml
1922
/.watchmanconfig
@@ -23,6 +26,7 @@
2326
/ember-cli-build.js
2427
/testem.js
2528
/tests/
29+
/yarn-error.log
2630
/yarn.lock
2731
.gitkeep
2832
/fastboot-tests/

.prettierignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# unconventional js
2+
/blueprints/*/files/
3+
/vendor/
4+
5+
# compiled output
6+
/dist/
7+
/tmp/
8+
9+
# dependencies
10+
/bower_components/
11+
/node_modules/
12+
13+
# misc
14+
/coverage/
15+
!.*
16+
.eslintcache
17+
18+
# ember-try
19+
/.node_modules.ember-try/
20+
/bower.json.ember-try
21+
/package.json.ember-try

.prettierrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
module.exports = {
4+
singleQuote: true,
5+
};

.template-lintrc.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
'use strict';
22

33
module.exports = {
4-
extends: 'octane',
4+
extends: 'recommended',
55
rules: {
66
'no-curly-component-invocation': {
7-
allow: [
8-
'ember-wormhole'
9-
]
10-
}
11-
}
7+
allow: ['ember-wormhole'],
8+
},
9+
},
1210
};

CONTRIBUTING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88

99
## Linting
1010

11-
* `npm run lint:hbs`
12-
* `npm run lint:js`
13-
* `npm run lint:js -- --fix`
11+
* `npm run lint`
12+
* `npm run lint:fix`
1413

1514
## Running tests
1615

addon/components/render-mobiledoc/component.js

+43-32
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,26 @@ import { RENDER_TYPE } from 'ember-mobiledoc-dom-renderer';
77
import { getDocument } from 'ember-mobiledoc-dom-renderer/utils/document';
88
import assign from 'ember-mobiledoc-dom-renderer/utils/polyfilled-assign';
99

10-
const {
11-
uuid
12-
} = Ember;
13-
14-
const ADD_CARD_HOOK = 'addComponentCard';
15-
const REMOVE_CARD_HOOK = 'removeComponentCard';
16-
const ADD_ATOM_HOOK = 'addComponentAtom';
17-
const REMOVE_ATOM_HOOK = 'removeComponentAtom';
18-
const CARD_TAG_NAME = 'div';
19-
const ATOM_TAG_NAME = 'span';
20-
const UUID_PREFIX = '__rendered-mobiledoc-entity-';
10+
const { uuid } = Ember;
11+
12+
const ADD_CARD_HOOK = 'addComponentCard';
13+
const REMOVE_CARD_HOOK = 'removeComponentCard';
14+
const ADD_ATOM_HOOK = 'addComponentAtom';
15+
const REMOVE_ATOM_HOOK = 'removeComponentAtom';
16+
const CARD_TAG_NAME = 'div';
17+
const ATOM_TAG_NAME = 'span';
18+
const UUID_PREFIX = '__rendered-mobiledoc-entity-';
2119
export const CARD_ELEMENT_CLASS = '__rendered-mobiledoc-card';
2220
export const ATOM_ELEMENT_CLASS = '__rendered-mobiledoc-atom';
2321

2422
const CARD_HOOKS = {
25-
ADD: ADD_CARD_HOOK,
26-
REMOVE: REMOVE_CARD_HOOK
23+
ADD: ADD_CARD_HOOK,
24+
REMOVE: REMOVE_CARD_HOOK,
2725
};
2826

2927
const ATOM_HOOKS = {
30-
ADD: ADD_ATOM_HOOK,
31-
REMOVE: REMOVE_ATOM_HOOK
28+
ADD: ADD_ATOM_HOOK,
29+
REMOVE: REMOVE_ATOM_HOOK,
3230
};
3331

3432
function rendererFor(type) {
@@ -40,9 +38,9 @@ function rendererFor(type) {
4038
hookNames = ATOM_HOOKS;
4139
}
4240

43-
return function({env, options}) {
41+
return function ({ env, options }) {
4442
let { onTeardown } = env;
45-
let addHook = options[hookNames.ADD];
43+
let addHook = options[hookNames.ADD];
4644
let removeHook = options[hookNames.REMOVE];
4745

4846
let { entity, element } = addHook(...arguments);
@@ -56,15 +54,15 @@ function createComponentCard(name) {
5654
return {
5755
name,
5856
type: RENDER_TYPE,
59-
render: rendererFor('card')
57+
render: rendererFor('card'),
6058
};
6159
}
6260

6361
function createComponentAtom(name) {
6462
return {
6563
name,
6664
type: RENDER_TYPE,
67-
render: rendererFor('atom')
65+
render: rendererFor('atom'),
6866
};
6967
}
7068

@@ -94,6 +92,7 @@ export default class extends Component {
9492
get renderedMobiledoc() {
9593
if (this._teardownRender) {
9694
this._teardownRender();
95+
// eslint-disable-next-line ember/no-side-effects
9796
this._teardownRender = null;
9897
}
9998

@@ -109,6 +108,7 @@ export default class extends Component {
109108
let wrapper = this._createElement(dom, 'div');
110109
wrapper.appendChild(result);
111110

111+
// eslint-disable-next-line ember/no-side-effects
112112
this._teardownRender = teardown;
113113
return wrapper;
114114
}
@@ -120,9 +120,12 @@ export default class extends Component {
120120
atoms: this.mdcAtoms,
121121
};
122122
[
123-
'mobiledoc', 'sectionElementRenderer', 'markupElementRenderer',
124-
'unknownCardHandler', 'unknownAtomHandler'
125-
].forEach(option => {
123+
'mobiledoc',
124+
'sectionElementRenderer',
125+
'markupElementRenderer',
126+
'unknownCardHandler',
127+
'unknownAtomHandler',
128+
].forEach((option) => {
126129
let value = this.args[option];
127130
if (value) {
128131
options[option] = value;
@@ -131,31 +134,39 @@ export default class extends Component {
131134

132135
let passedOptions = this.args.cardOptions;
133136
let cardOptions = this._cardOptions;
134-
cardOptions = passedOptions ? assign(passedOptions, cardOptions) : cardOptions;
137+
cardOptions = passedOptions
138+
? assign(passedOptions, cardOptions)
139+
: cardOptions;
135140
options.cardOptions = cardOptions;
136141
return options;
137142
}
138143

139144
get _cardOptions() {
140145
return {
141-
[ADD_CARD_HOOK]: ({env, options, payload}) => {
146+
[ADD_CARD_HOOK]: ({ env, options, payload }) => {
142147
let { name: cardName, dom } = env;
143-
let classNames = [CARD_ELEMENT_CLASS, `${CARD_ELEMENT_CLASS}-${cardName}`];
148+
let classNames = [
149+
CARD_ELEMENT_CLASS,
150+
`${CARD_ELEMENT_CLASS}-${cardName}`,
151+
];
144152
let element = this._createElement(dom, CARD_TAG_NAME, classNames);
145153
let componentName = this.cardNameToComponentName(cardName);
146154

147155
let card = {
148156
componentName,
149157
destinationElement: element,
150158
payload,
151-
options
159+
options,
152160
};
153161
this.addCard(card);
154162
return { entity: card, element };
155163
},
156-
[ADD_ATOM_HOOK]: ({env, options, value, payload}) => {
164+
[ADD_ATOM_HOOK]: ({ env, options, value, payload }) => {
157165
let { name: atomName, dom } = env;
158-
let classNames = [ATOM_ELEMENT_CLASS, `${ATOM_ELEMENT_CLASS}-${atomName}`];
166+
let classNames = [
167+
ATOM_ELEMENT_CLASS,
168+
`${ATOM_ELEMENT_CLASS}-${atomName}`,
169+
];
159170
let element = this._createElement(dom, ATOM_TAG_NAME, classNames);
160171
let componentName = this.atomNameToComponentName(atomName);
161172

@@ -164,13 +175,13 @@ export default class extends Component {
164175
destinationElement: element,
165176
payload,
166177
value,
167-
options
178+
options,
168179
};
169180
this.addAtom(atom);
170181
return { entity: atom, element };
171182
},
172183
[REMOVE_CARD_HOOK]: (card) => this.removeCard(card),
173-
[REMOVE_ATOM_HOOK]: (atom) => this.removeAtom(atom)
184+
[REMOVE_ATOM_HOOK]: (atom) => this.removeAtom(atom),
174185
};
175186
}
176187

@@ -193,7 +204,7 @@ export default class extends Component {
193204

194205
// @private
195206

196-
_componentCards = A();
207+
_componentCards = A();
197208
_componentAtoms = A();
198209

199210
addCard(card) {
@@ -220,7 +231,7 @@ export default class extends Component {
220231
return `${UUID_PREFIX}${uuid()}`;
221232
}
222233

223-
_createElement(dom, tagName, classNames=[]) {
234+
_createElement(dom, tagName, classNames = []) {
224235
let el = dom.createElement(tagName);
225236
el.setAttribute('id', this.generateUuid());
226237
el.setAttribute('class', classNames.join(' '));

0 commit comments

Comments
 (0)