Skip to content

Commit 9d884a2

Browse files
author
Amjad Masad
committed
[react-packager] Fix lint errors
1 parent 9aa322f commit 9d884a2

34 files changed

+203
-258
lines changed

.eslintrc

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@
2121
"Map": true,
2222
"module": false,
2323
"process": false,
24-
"Promise": false,
24+
"Promise": true,
2525
"requestAnimationFrame": true,
2626
"require": false,
2727
"Set": true,
2828
"setImmediate": true,
2929
"setInterval": false,
3030
"setTimeout": false,
3131
"window": false,
32-
"XMLHttpRequest": false
32+
"XMLHttpRequest": false,
33+
"pit": false
3334
},
3435

3536
"rules": {
@@ -148,7 +149,7 @@
148149
"no-multi-spaces": 0,
149150
"brace-style": 0, // enforce one true brace style (off by default)
150151
"camelcase": 0, // require camel case names
151-
"consistent-this": 1, // enforces consistent naming when capturing the current execution context (off by default)
152+
"consistent-this": [1, "self"], // enforces consistent naming when capturing the current execution context (off by default)
152153
"eol-last": 1, // enforce newline at the end of file, with no multiple empty lines
153154
"func-names": 0, // require function expressions to have a name (off by default)
154155
"func-style": 0, // enforces use of function declarations or expressions (off by default)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Build native apps with React!",
55
"repository": {
66
"type": "git",

packager/react-packager/.jshintrc

-86
This file was deleted.

packager/react-packager/src/Activity/__tests__/Activity-test.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
jest.autoMockOff();
24

35
describe('Activity', function() {

packager/react-packager/src/Activity/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
var COLLECTION_PERIOD = 1000;
24

35
var _endedEvents = Object.create(null);

packager/react-packager/src/DependencyResolver/ModuleDescriptor.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
function ModuleDescriptor(fields) {
24
if (!fields.id) {
35
throw new Error('Missing required fields id');
@@ -28,7 +30,7 @@ ModuleDescriptor.prototype.toJSON = function() {
2830
id: this.id,
2931
path: this.path,
3032
dependencies: this.dependencies
31-
}
33+
};
3234
};
3335

3436
module.exports = ModuleDescriptor;

packager/react-packager/src/DependencyResolver/haste/DependencyGraph/__tests__/DependencyGraph-test.js

+61-19
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ jest
99
.dontMock('../docblock')
1010
.setMock('../../../ModuleDescriptor', function(data) {return data;});
1111

12-
var q = require('q');
13-
1412
describe('DependencyGraph', function() {
1513
var DependencyGraph;
1614
var fileWatcher;
@@ -46,7 +44,10 @@ describe('DependencyGraph', function() {
4644
}
4745
});
4846

49-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
47+
var dgraph = new DependencyGraph({
48+
roots: [root],
49+
fileWatcher: fileWatcher
50+
});
5051
return dgraph.load().then(function() {
5152
expect(dgraph.getOrderedDependencies('/root/index.js'))
5253
.toEqual([
@@ -75,7 +76,10 @@ describe('DependencyGraph', function() {
7576
}
7677
});
7778

78-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
79+
var dgraph = new DependencyGraph({
80+
roots: [root],
81+
fileWatcher: fileWatcher
82+
});
7983
return dgraph.load().then(function() {
8084
expect(dgraph.getOrderedDependencies('/root/index.js'))
8185
.toEqual([
@@ -105,7 +109,10 @@ describe('DependencyGraph', function() {
105109
}
106110
});
107111

108-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
112+
var dgraph = new DependencyGraph({
113+
roots: [root],
114+
fileWatcher: fileWatcher
115+
});
109116
return dgraph.load().then(function() {
110117
expect(dgraph.getOrderedDependencies('/root/index.js'))
111118
.toEqual([
@@ -135,7 +142,10 @@ describe('DependencyGraph', function() {
135142
}
136143
});
137144

138-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
145+
var dgraph = new DependencyGraph({
146+
roots: [root],
147+
fileWatcher: fileWatcher
148+
});
139149
return dgraph.load().then(function() {
140150
expect(dgraph.getOrderedDependencies('/root/index.js'))
141151
.toEqual([
@@ -175,7 +185,10 @@ describe('DependencyGraph', function() {
175185
}
176186
});
177187

178-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
188+
var dgraph = new DependencyGraph({
189+
roots: [root],
190+
fileWatcher: fileWatcher
191+
});
179192
return dgraph.load().then(function() {
180193
expect(dgraph.getOrderedDependencies('/root/somedir/somefile.js'))
181194
.toEqual([
@@ -216,7 +229,10 @@ describe('DependencyGraph', function() {
216229
}
217230
});
218231

219-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
232+
var dgraph = new DependencyGraph({
233+
roots: [root],
234+
fileWatcher: fileWatcher
235+
});
220236
return dgraph.load().then(function() {
221237
expect(dgraph.getOrderedDependencies('/root/index.js'))
222238
.toEqual([
@@ -245,7 +261,10 @@ describe('DependencyGraph', function() {
245261
}
246262
});
247263

248-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
264+
var dgraph = new DependencyGraph({
265+
roots: [root],
266+
fileWatcher: fileWatcher
267+
});
249268
return dgraph.load().then(function() {
250269
expect(dgraph.getOrderedDependencies('/root/index.js'))
251270
.toEqual([
@@ -280,7 +299,10 @@ describe('DependencyGraph', function() {
280299
}
281300
});
282301

283-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
302+
var dgraph = new DependencyGraph({
303+
roots: [root],
304+
fileWatcher: fileWatcher
305+
});
284306
return dgraph.load().then(function() {
285307
expect(dgraph.getOrderedDependencies('/root/index.js'))
286308
.toEqual([
@@ -320,7 +342,10 @@ describe('DependencyGraph', function() {
320342
}
321343
});
322344

323-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
345+
var dgraph = new DependencyGraph({
346+
roots: [root],
347+
fileWatcher: fileWatcher
348+
});
324349
return dgraph.load().then(function() {
325350
expect(dgraph.getOrderedDependencies('/root/index.js'))
326351
.toEqual([
@@ -360,7 +385,10 @@ describe('DependencyGraph', function() {
360385
}
361386
});
362387

363-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
388+
var dgraph = new DependencyGraph({
389+
roots: [root],
390+
fileWatcher: fileWatcher
391+
});
364392
return dgraph.load().then(function() {
365393
expect(dgraph.getOrderedDependencies('/root/index.js'))
366394
.toEqual([
@@ -386,7 +414,6 @@ describe('DependencyGraph', function() {
386414
});
387415

388416
describe('file watch updating', function() {
389-
var fileWatcher;
390417
var triggerFileChange;
391418

392419
beforeEach(function() {
@@ -428,7 +455,10 @@ describe('DependencyGraph', function() {
428455
}
429456
});
430457

431-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
458+
var dgraph = new DependencyGraph({
459+
roots: [root],
460+
fileWatcher: fileWatcher
461+
});
432462
return dgraph.load().then(function() {
433463
filesystem.root['index.js'] =
434464
filesystem.root['index.js'].replace('require("foo")', '');
@@ -476,7 +506,10 @@ describe('DependencyGraph', function() {
476506
}
477507
});
478508

479-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
509+
var dgraph = new DependencyGraph({
510+
roots: [root],
511+
fileWatcher: fileWatcher
512+
});
480513
return dgraph.load().then(function() {
481514
filesystem.root['index.js'] =
482515
filesystem.root['index.js'].replace('require("foo")', '');
@@ -524,7 +557,10 @@ describe('DependencyGraph', function() {
524557
}
525558
});
526559

527-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
560+
var dgraph = new DependencyGraph({
561+
roots: [root],
562+
fileWatcher: fileWatcher
563+
});
528564
return dgraph.load().then(function() {
529565
delete filesystem.root.foo;
530566
triggerFileChange('delete', 'foo.js', root);
@@ -571,7 +607,10 @@ describe('DependencyGraph', function() {
571607
}
572608
});
573609

574-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
610+
var dgraph = new DependencyGraph({
611+
roots: [root],
612+
fileWatcher: fileWatcher
613+
});
575614
return dgraph.load().then(function() {
576615
filesystem.root['bar.js'] = [
577616
'/**',
@@ -679,7 +718,7 @@ describe('DependencyGraph', function() {
679718

680719
pit('should ignore directory updates', function() {
681720
var root = '/root';
682-
var filesystem = fs.__setMockFilesystem({
721+
fs.__setMockFilesystem({
683722
'root': {
684723
'index.js': [
685724
'/**',
@@ -703,7 +742,10 @@ describe('DependencyGraph', function() {
703742
}
704743
}
705744
});
706-
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
745+
var dgraph = new DependencyGraph({
746+
roots: [root],
747+
fileWatcher: fileWatcher
748+
});
707749
return dgraph.load().then(function() {
708750
triggerFileChange('change', 'aPackage', '/root', {
709751
isDirectory: function(){ return true; }

packager/react-packager/src/DependencyResolver/haste/DependencyGraph/docblock.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
'use strict';
1718

1819
var docblockRe = /^\s*(\/\*\*(.|\r?\n)*?\*\/)/;
1920

@@ -35,7 +36,8 @@ var commentStartRe = /^\/\*\*?/;
3536
var commentEndRe = /\*\/$/;
3637
var wsRe = /[\t ]+/g;
3738
var stringStartRe = /(\r?\n|^) *\*/g;
38-
var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
39+
var multilineRe =
40+
/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
3941
var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
4042

4143
/**
@@ -51,15 +53,15 @@ function parse(docblock) {
5153

5254
// Normalize multi-line directives
5355
var prev = '';
54-
while (prev != docblock) {
56+
while (prev !== docblock) {
5557
prev = docblock;
56-
docblock = docblock.replace(multilineRe, "\n$1 $2\n");
58+
docblock = docblock.replace(multilineRe, '\n$1 $2\n');
5759
}
5860
docblock = docblock.trim();
5961

6062
var result = [];
6163
var match;
62-
while (match = propertyRe.exec(docblock)) {
64+
while ((match = propertyRe.exec(docblock))) {
6365
result.push([match[1], match[2]]);
6466
}
6567

0 commit comments

Comments
 (0)