Skip to content

Commit 6a0029c

Browse files
Ron RadtkeRon Radtke
authored andcommitted
Just some linting
1 parent b2620a1 commit 6a0029c

33 files changed

+9078
-2249
lines changed

.eslintrc

Lines changed: 0 additions & 64 deletions
This file was deleted.

.eslintrc.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
root: true,
3+
rules: {
4+
'prettier/prettier': 0,
5+
"eqeqeq": 2,
6+
"comma-dangle": 0,
7+
"curly": 0,
8+
"no-console": 1,
9+
"no-debugger": 1,
10+
"no-extra-semi": 2,
11+
"no-extra-parens": 1,
12+
"no-extra-boolean-cast": 1,
13+
"no-cond-assign": 2,
14+
"no-irregular-whitespace": 2,
15+
"no-undef": 0,
16+
"no-unused-vars": 0,
17+
"semi": 2,
18+
"semi-spacing": 2,
19+
"valid-jsdoc": [
20+
1,
21+
{
22+
"requireReturn": false,
23+
"requireParamDescription": false,
24+
"requireReturnDescription": false
25+
}
26+
],
27+
"radix": 0
28+
},
29+
"parser": "babel-eslint"
30+
};

android.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Use of this source code is governed by a MIT-style license that can be
33
// found in the LICENSE file.
44

5-
import { NativeModules, Platform } from 'react-native'
5+
import { NativeModules, Platform } from 'react-native';
66

7-
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil
7+
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil;
88

99
/**
1010
* Send an intent to open the file.
@@ -16,37 +16,37 @@ const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil
1616
function actionViewIntent(path, mime, chooserTitle) {
1717
if(typeof chooserTitle === 'undefined') chooserTitle = null;
1818
if(Platform.OS === 'android')
19-
return ReactNativeBlobUtil.actionViewIntent(path, mime, chooserTitle)
19+
return ReactNativeBlobUtil.actionViewIntent(path, mime, chooserTitle);
2020
else
21-
return Promise.reject('ReactNativeBlobUtil.android.actionViewIntent only supports Android.')
21+
return Promise.reject('ReactNativeBlobUtil.android.actionViewIntent only supports Android.');
2222
}
2323

2424
function getContentIntent(mime) {
2525
if(Platform.OS === 'android')
26-
return ReactNativeBlobUtil.getContentIntent(mime)
26+
return ReactNativeBlobUtil.getContentIntent(mime);
2727
else
28-
return Promise.reject('ReactNativeBlobUtil.android.getContentIntent only supports Android.')
28+
return Promise.reject('ReactNativeBlobUtil.android.getContentIntent only supports Android.');
2929
}
3030

3131
function addCompleteDownload(config) {
3232
if(Platform.OS === 'android')
33-
return ReactNativeBlobUtil.addCompleteDownload(config)
33+
return ReactNativeBlobUtil.addCompleteDownload(config);
3434
else
35-
return Promise.reject('ReactNativeBlobUtil.android.addCompleteDownload only supports Android.')
35+
return Promise.reject('ReactNativeBlobUtil.android.addCompleteDownload only supports Android.');
3636
}
3737

3838
function getSDCardDir() {
3939
if(Platform.OS === 'android')
40-
return ReactNativeBlobUtil.getSDCardDir()
40+
return ReactNativeBlobUtil.getSDCardDir();
4141
else
42-
return Promise.reject('ReactNativeBlobUtil.android.getSDCardDir only supports Android.')
42+
return Promise.reject('ReactNativeBlobUtil.android.getSDCardDir only supports Android.');
4343
}
4444

4545
function getSDCardApplicationDir() {
4646
if(Platform.OS === 'android')
47-
return ReactNativeBlobUtil.getSDCardApplicationDir()
47+
return ReactNativeBlobUtil.getSDCardApplicationDir();
4848
else
49-
return Promise.reject('ReactNativeBlobUtil.android.getSDCardApplicationDir only supports Android.')
49+
return Promise.reject('ReactNativeBlobUtil.android.getSDCardApplicationDir only supports Android.');
5050
}
5151

5252

@@ -56,4 +56,4 @@ export default {
5656
addCompleteDownload,
5757
getSDCardDir,
5858
getSDCardApplicationDir,
59-
}
59+
};

android/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
android.enableJetifier=true
2-
android.useAndroidX=true
1+
android.enableJetifier=true;
2+
android.useAndroidX=true;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
22
<string name="app_name">react-native-blob-util</string>
3-
</resources>
3+
</resources>;

class/ReactNativeBlobUtilFile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {
77
NativeModules,
88
DeviceEventEmitter,
99
NativeAppEventEmitter,
10-
} from 'react-native'
10+
} from 'react-native';
1111

12-
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil
13-
const emitter = DeviceEventEmitter
12+
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil;
13+
const emitter = DeviceEventEmitter;
1414

1515
export default class ReactNativeBlobUtilFile {
1616

class/ReactNativeBlobUtilReadStream.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import {
66
NativeModules,
77
DeviceEventEmitter,
88
NativeAppEventEmitter,
9-
} from 'react-native'
10-
import UUID from '../utils/uuid'
9+
} from 'react-native';
10+
import UUID from '../utils/uuid';
1111

12-
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil
13-
const emitter = DeviceEventEmitter
12+
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil;
13+
const emitter = DeviceEventEmitter;
1414

1515
export default class ReactNativeBlobUtilReadStream {
1616

@@ -22,61 +22,61 @@ export default class ReactNativeBlobUtilReadStream {
2222

2323
constructor(path:string, encoding:string, bufferSize?:?number, tick:number) {
2424
if(!path)
25-
throw Error('ReactNativeBlobUtil could not open file stream with empty `path`')
26-
this.encoding = encoding || 'utf8'
27-
this.bufferSize = bufferSize
28-
this.path = path
29-
this.closed = false
30-
this.tick = tick
31-
this._onData = () => {}
32-
this._onEnd = () => {}
33-
this._onError = () => {}
34-
this.streamId = 'RNFBRS'+ UUID()
25+
throw Error('ReactNativeBlobUtil could not open file stream with empty `path`');
26+
this.encoding = encoding || 'utf8';
27+
this.bufferSize = bufferSize;
28+
this.path = path;
29+
this.closed = false;
30+
this.tick = tick;
31+
this._onData = () => {};
32+
this._onEnd = () => {};
33+
this._onError = () => {};
34+
this.streamId = 'RNFBRS'+ UUID();
3535

3636
// register for file stream event
3737
let subscription = emitter.addListener(this.streamId, (e) => {
38-
let {event, code, detail} = e
38+
let {event, code, detail} = e;
3939
if(this._onData && event === 'data') {
40-
this._onData(detail)
41-
return
40+
this._onData(detail);
41+
return;
4242
}
4343
else if (this._onEnd && event === 'end') {
44-
this._onEnd(detail)
44+
this._onEnd(detail);
4545
}
4646
else {
47-
const err = new Error(detail)
48-
err.code = code || 'EUNSPECIFIED'
47+
const err = new Error(detail);
48+
err.code = code || 'EUNSPECIFIED';
4949
if(this._onError)
50-
this._onError(err)
50+
this._onError(err);
5151
else
52-
throw err
52+
throw err;
5353
}
5454
// when stream closed or error, remove event handler
5555
if (event === 'error' || event === 'end') {
56-
subscription.remove()
57-
this.closed = true
56+
subscription.remove();
57+
this.closed = true;
5858
}
59-
})
59+
});
6060

6161
}
6262

6363
open() {
6464
if(!this.closed)
65-
ReactNativeBlobUtil.readStream(this.path, this.encoding, this.bufferSize || 10240 , this.tick || -1, this.streamId)
65+
ReactNativeBlobUtil.readStream(this.path, this.encoding, this.bufferSize || 10240 , this.tick || -1, this.streamId);
6666
else
67-
throw new Error('Stream closed')
67+
throw new Error('Stream closed');
6868
}
6969

7070
onData(fn:() => void) {
71-
this._onData = fn
71+
this._onData = fn;
7272
}
7373

7474
onError(fn) {
75-
this._onError = fn
75+
this._onError = fn;
7676
}
7777

7878
onEnd (fn) {
79-
this._onEnd = fn
79+
this._onEnd = fn;
8080
}
8181

8282
}

class/ReactNativeBlobUtilSession.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,69 +6,69 @@ import {
66
NativeModules,
77
DeviceEventEmitter,
88
NativeAppEventEmitter,
9-
} from 'react-native'
9+
} from 'react-native';
1010

11-
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil
11+
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil;
1212

13-
let sessions = {}
13+
let sessions = {};
1414

1515
export default class ReactNativeBlobUtilSession {
1616

1717
name : string;
1818

1919
static getSession(name:string):any {
20-
return sessions[name]
20+
return sessions[name];
2121
}
2222

2323
static setSession(name:string, val:any) {
24-
sessions[name] = val
24+
sessions[name] = val;
2525
}
2626

2727
static removeSession(name:string) {
28-
delete sessions[name]
28+
delete sessions[name];
2929
}
3030

3131
constructor(name:string, list:Array<string>) {
32-
this.name = name
32+
this.name = name;
3333
if(!sessions[name]) {
3434
if(Array.isArray(list))
35-
sessions[name] = list
35+
sessions[name] = list;
3636
else
37-
sessions[name] = []
37+
sessions[name] = [];
3838
}
3939
}
4040

4141
add(path:string):ReactNativeBlobUtilSession {
42-
sessions[this.name].push(path)
43-
return this
42+
sessions[this.name].push(path);
43+
return this;
4444
}
4545

4646
remove(path:string):ReactNativeBlobUtilSession {
47-
let list = sessions[this.name]
47+
let list = sessions[this.name];
4848
for(let i of list) {
4949
if(list[i] === path) {
50-
sessions[this.name].splice(i, 1)
50+
sessions[this.name].splice(i, 1);
5151
break;
5252
}
5353
}
54-
return this
54+
return this;
5555
}
5656

5757
list():Array<string> {
58-
return sessions[this.name]
58+
return sessions[this.name];
5959
}
6060

6161
dispose():Promise {
6262
return new Promise((resolve, reject) => {
6363
ReactNativeBlobUtil.removeSession(sessions[this.name], (err) => {
6464
if(err)
65-
reject(new Error(err))
65+
reject(new Error(err));
6666
else {
67-
delete sessions[this.name]
68-
resolve()
67+
delete sessions[this.name];
68+
resolve();
6969
}
70-
})
71-
})
70+
});
71+
});
7272
}
7373

7474
}

0 commit comments

Comments
 (0)