Skip to content

Commit 48a08f3

Browse files
committed
Update Ember, filer.js and idb.filesystem.js
Still need to update Ember code to fix all deprecations...
1 parent 90df380 commit 48a08f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+5091
-2009
lines changed

.editorconfig

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
root = true
66

7-
87
[*]
98
end_of_line = lf
109
charset = utf-8

.eslintrc.js

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
const eslintPluginNode = require('eslint-plugin-node');
2+
13
module.exports = {
24
root: true,
5+
parser: 'babel-eslint',
36
parserOptions: {
4-
ecmaVersion: 2017,
7+
ecmaVersion: 2018,
58
sourceType: 'module',
9+
ecmaFeatures: {
10+
legacyDecorators: true,
11+
},
612
},
713
plugins: ['ember', 'prettier'],
814
extends: ['airbnb-base', 'plugin:ember/recommended', 'prettier'],
@@ -14,12 +20,15 @@ module.exports = {
1420
'no-console': 'off',
1521
'no-underscore-dangle': 'off',
1622

17-
strict: 'off',
18-
1923
'import/no-extraneous-dependencies': 'off',
2024
'import/no-unresolved': 'off',
2125

2226
'prettier/prettier': 'error',
27+
28+
// TODO: Enable these
29+
'ember/no-jquery': 'off',
30+
'ember/no-observers': 'off',
31+
'ember/no-get': 'off',
2332
},
2433
overrides: [
2534
// node files
@@ -32,15 +41,24 @@ module.exports = {
3241
'blueprints/*/index.js',
3342
'config/**/*.js',
3443
'lib/*/index.js',
44+
'server/**/*.js',
3545
],
3646
parserOptions: {
3747
sourceType: 'script',
38-
ecmaVersion: 2015,
3948
},
4049
env: {
4150
browser: false,
4251
node: true,
4352
},
53+
plugins: ['node'],
54+
rules: {
55+
...eslintPluginNode.configs.recommended.rules,
56+
// add your custom rules and overrides for node files here
57+
58+
// this can be removed once the following is fixed
59+
// https://github.com/mysticatea/eslint-plugin-node/issues/77
60+
'node/no-unpublished-require': 'off',
61+
},
4462
},
4563
],
4664
};

.gitignore

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# See https://help.github.com/ignore-files/ for more about ignoring files.
22

33
# compiled output
4-
/dist
5-
/tmp
4+
/dist/
5+
/tmp/
66

77
# dependencies
88
/bower_components/
99
/node_modules/
1010

1111
# misc
12-
/.env
12+
/.env*
13+
/.pnp*
1314
/.sass-cache
1415
/connect.lock
15-
/coverage/*
16+
/coverage/
1617
/libpeerconnection.log
1718
/npm-debug.log*
1819
/testem.log
1920
/yarn-error.log
20-
/newrelic_agent.log
2121

2222
# ember-try
2323
/.node_modules.ember-try/

.prettierrc.json

-11
This file was deleted.

.template-lintrc.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
'use strict';
2-
31
module.exports = {
4-
extends: 'recommended',
2+
extends: 'octane',
3+
4+
// TODO: enable these
55
rules: {
6-
'no-html-comments': false,
6+
'no-action': false,
7+
'no-curly-component-invocation': false,
8+
'no-implicit-this': false,
79
'no-partial': false,
810
},
9-
ignore: [
10-
'./node_modules/**',
11-
'./vendor/**',
12-
'./tmp/**',
13-
'./dist/**',
14-
'./tests/**',
15-
],
1611
};

.watchmanconfig

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"ignore_dirs": ["tmp", "dist"]
2+
"ignore_dirs": [
3+
"tmp",
4+
"dist"
5+
]
36
}

app/app.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import Application from '@ember/application';
2+
import Resolver from 'ember-resolver';
23
import loadInitializers from 'ember-load-initializers';
3-
import Resolver from './resolver';
4+
// eslint-disable-next-line import/extensions
45
import config from './config/environment';
56

6-
const App = Application.extend({
7-
modulePrefix: config.modulePrefix,
8-
podModulePrefix: config.podModulePrefix,
9-
Resolver,
10-
});
7+
export default class App extends Application {
8+
modulePrefix = config.modulePrefix;
119

12-
loadInitializers(App, config.modulePrefix);
10+
podModulePrefix = config.podModulePrefix;
11+
12+
Resolver = Resolver;
13+
}
1314

14-
export default App;
15+
loadInitializers(App, config.modulePrefix);

app/components/file-field.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import TextField from '@ember/component/text-field';
2+
import $ from 'jquery';
23

34
export default TextField.extend({
45
type: 'file',
@@ -21,7 +22,7 @@ export default TextField.extend({
2122
// so if sender wants later to send the same file again,
2223
// the 'change' event is triggered correctly.
2324
reset() {
24-
const field = this.$();
25+
const field = $(this.element);
2526
field
2627
.wrap('<form>')
2728
.closest('form')

app/components/peer-avatar.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default Component.extend({
2626
later(
2727
this,
2828
function toggleClass() {
29-
this.$()
29+
$(this.element)
3030
.parent('.avatar')
3131
.addClass(className)
3232
.delay(2000)
@@ -36,29 +36,29 @@ export default Component.extend({
3636
.dequeue();
3737
});
3838
},
39-
250
39+
250,
4040
);
4141
},
4242

4343
init(...args) {
4444
this._super(args);
4545

4646
this.toggleTransferCompletedClass = this.toggleTransferCompletedClass.bind(
47-
this
47+
this,
4848
);
4949
},
5050

5151
didInsertElement(...args) {
5252
this._super(args);
53-
const peer = this.get('peer');
53+
const { peer } = this;
5454

5555
peer.on('didReceiveFile', this.toggleTransferCompletedClass);
5656
peer.on('didSendFile', this.toggleTransferCompletedClass);
5757
},
5858

5959
willDestroyElement(...args) {
6060
this._super(args);
61-
const peer = this.get('peer');
61+
const { peer } = this;
6262

6363
peer.off('didReceiveFile', this.toggleTransferCompletedClass);
6464
peer.off('didSendFile', this.toggleTransferCompletedClass);
@@ -67,7 +67,7 @@ export default Component.extend({
6767
// Delegate click to hidden file field in peer template
6868
click() {
6969
if (this.canSendFile()) {
70-
this.$()
70+
$(this.element)
7171
.closest('.peer')
7272
.find('input[type=file]')
7373
.click();
@@ -78,7 +78,7 @@ export default Component.extend({
7878
dragEnter(event) {
7979
this.cancelEvent(event);
8080

81-
this.$()
81+
$(this.element)
8282
.parent('.avatar')
8383
.addClass('hover');
8484
},
@@ -88,18 +88,18 @@ export default Component.extend({
8888
},
8989

9090
dragLeave() {
91-
this.$()
91+
$(this.element)
9292
.parent('.avatar')
9393
.removeClass('hover');
9494
},
9595

9696
drop(event) {
9797
this.cancelEvent(event);
98-
this.$()
98+
$(this.element)
9999
.parent('.avatar')
100100
.removeClass('hover');
101101

102-
const peer = this.get('peer');
102+
const { peer } = this;
103103
const dt = event.originalEvent.dataTransfer;
104104
const { files } = dt;
105105
const file = files[0];
@@ -124,7 +124,7 @@ export default Component.extend({
124124
},
125125

126126
canSendFile() {
127-
const peer = this.get('peer');
127+
const { peer } = this;
128128

129129
// Can't send files if another file transfer is already in progress
130130
return !(peer.get('transfer.file') || peer.get('transfer.info'));

app/components/peer-widget.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default Component.extend({
3838
actions: {
3939
// TODO: rename to something more meaningful (e.g. askIfWantToSendFile)
4040
uploadFile(data) {
41-
const peer = this.get('peer');
41+
const { peer } = this;
4242
const { file } = data;
4343

4444
// Cache the file, so that it's available
@@ -48,8 +48,8 @@ export default Component.extend({
4848
},
4949

5050
sendFileTransferInquiry() {
51-
const webrtc = this.get('webrtc');
52-
const peer = this.get('peer');
51+
const { webrtc } = this;
52+
const { peer } = this;
5353

5454
webrtc.connect(peer.get('peer.id'));
5555
peer.set('state', 'establishing_connection');
@@ -62,14 +62,14 @@ export default Component.extend({
6262
abortFileTransfer() {
6363
this._cancelFileTransfer();
6464

65-
const webrtc = this.get('webrtc');
65+
const { webrtc } = this;
6666
const connection = this.get('peer.peer.connection');
6767

6868
webrtc.sendCancelRequest(connection);
6969
},
7070

7171
acceptFileTransfer() {
72-
const peer = this.get('peer');
72+
const { peer } = this;
7373

7474
this._sendFileTransferResponse(true);
7575

@@ -80,7 +80,7 @@ export default Component.extend({
8080
},
8181

8282
rejectFileTransfer() {
83-
const peer = this.get('peer');
83+
const { peer } = this;
8484

8585
this._sendFileTransferResponse(false);
8686
peer.set('transfer.info', null);
@@ -89,7 +89,7 @@ export default Component.extend({
8989
},
9090

9191
_cancelFileTransfer() {
92-
const peer = this.get('peer');
92+
const { peer } = this;
9393

9494
peer.setProperties({
9595
'transfer.file': null,
@@ -98,8 +98,8 @@ export default Component.extend({
9898
},
9999

100100
_sendFileTransferResponse(response) {
101-
const webrtc = this.get('webrtc');
102-
const peer = this.get('peer');
101+
const { webrtc } = this;
102+
const { peer } = this;
103103
const connection = peer.get('peer.connection');
104104

105105
webrtc.sendFileResponse(connection, response);

app/components/popover-confirm.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import { computed } from '@ember/object';
33

44
export default Component.extend({
55
classNames: ['popover-confirm'],
6-
isVisible: false,
76
iconClass: computed('filename', function() {
8-
const filename = this.get('filename');
7+
const { filename } = this;
98

109
if (filename) {
1110
const regex = /\.([0-9a-z]+)$/i;

app/components/progress-bar.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Component from '@ember/component';
22
import { observer } from '@ember/object';
3+
import $ from 'jquery';
34

45
export default Component.extend({
56
tagName: 'svg',
@@ -12,13 +13,13 @@ export default Component.extend({
1213
transfer: null,
1314

1415
didInsertElement() {
15-
this.set('path', this.$().find('path'));
16+
this.set('path', $(this.element).find('path'));
1617
},
1718

1819
sendingProgressDidChange: observer('transfer.sendingProgress', function() {
1920
const progress = this.get('transfer.sendingProgress');
2021

21-
if (this.get('path')) {
22+
if (this.path) {
2223
this._calculateSVGAnim(progress);
2324
}
2425
}),
@@ -28,14 +29,14 @@ export default Component.extend({
2829
function() {
2930
const progress = this.get('transfer.receivingProgress');
3031

31-
if (this.get('path')) {
32+
if (this.path) {
3233
this._calculateSVGAnim(progress);
3334
}
34-
}
35+
},
3536
),
3637

3738
_calculateSVGAnim(progress) {
38-
const path = this.get('path');
39+
const { path } = this;
3940
if (!path) {
4041
return;
4142
}

0 commit comments

Comments
 (0)