Skip to content

Commit

Permalink
[react-packager] Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Amjad Masad committed Feb 26, 2015
1 parent 9aa322f commit 9d884a2
Show file tree
Hide file tree
Showing 34 changed files with 203 additions and 258 deletions.
7 changes: 4 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
"Map": true,
"module": false,
"process": false,
"Promise": false,
"Promise": true,
"requestAnimationFrame": true,
"require": false,
"Set": true,
"setImmediate": true,
"setInterval": false,
"setTimeout": false,
"window": false,
"XMLHttpRequest": false
"XMLHttpRequest": false,
"pit": false
},

"rules": {
Expand Down Expand Up @@ -148,7 +149,7 @@
"no-multi-spaces": 0,
"brace-style": 0, // enforce one true brace style (off by default)
"camelcase": 0, // require camel case names
"consistent-this": 1, // enforces consistent naming when capturing the current execution context (off by default)
"consistent-this": [1, "self"], // enforces consistent naming when capturing the current execution context (off by default)
"eol-last": 1, // enforce newline at the end of file, with no multiple empty lines
"func-names": 0, // require function expressions to have a name (off by default)
"func-style": 0, // enforces use of function declarations or expressions (off by default)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native",
"version": "0.0.1",
"version": "0.1.0",
"description": "Build native apps with React!",
"repository": {
"type": "git",
Expand Down
86 changes: 0 additions & 86 deletions packager/react-packager/.jshintrc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

jest.autoMockOff();

describe('Activity', function() {
Expand Down
2 changes: 2 additions & 0 deletions packager/react-packager/src/Activity/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var COLLECTION_PERIOD = 1000;

var _endedEvents = Object.create(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

function ModuleDescriptor(fields) {
if (!fields.id) {
throw new Error('Missing required fields id');
Expand Down Expand Up @@ -28,7 +30,7 @@ ModuleDescriptor.prototype.toJSON = function() {
id: this.id,
path: this.path,
dependencies: this.dependencies
}
};
};

module.exports = ModuleDescriptor;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ jest
.dontMock('../docblock')
.setMock('../../../ModuleDescriptor', function(data) {return data;});

var q = require('q');

describe('DependencyGraph', function() {
var DependencyGraph;
var fileWatcher;
Expand Down Expand Up @@ -46,7 +44,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand Down Expand Up @@ -75,7 +76,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand Down Expand Up @@ -105,7 +109,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand Down Expand Up @@ -135,7 +142,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand Down Expand Up @@ -175,7 +185,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/somedir/somefile.js'))
.toEqual([
Expand Down Expand Up @@ -216,7 +229,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand Down Expand Up @@ -245,7 +261,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand Down Expand Up @@ -280,7 +299,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand Down Expand Up @@ -320,7 +342,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand Down Expand Up @@ -360,7 +385,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
expect(dgraph.getOrderedDependencies('/root/index.js'))
.toEqual([
Expand All @@ -386,7 +414,6 @@ describe('DependencyGraph', function() {
});

describe('file watch updating', function() {
var fileWatcher;
var triggerFileChange;

beforeEach(function() {
Expand Down Expand Up @@ -428,7 +455,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
filesystem.root['index.js'] =
filesystem.root['index.js'].replace('require("foo")', '');
Expand Down Expand Up @@ -476,7 +506,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
filesystem.root['index.js'] =
filesystem.root['index.js'].replace('require("foo")', '');
Expand Down Expand Up @@ -524,7 +557,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
delete filesystem.root.foo;
triggerFileChange('delete', 'foo.js', root);
Expand Down Expand Up @@ -571,7 +607,10 @@ describe('DependencyGraph', function() {
}
});

var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
filesystem.root['bar.js'] = [
'/**',
Expand Down Expand Up @@ -679,7 +718,7 @@ describe('DependencyGraph', function() {

pit('should ignore directory updates', function() {
var root = '/root';
var filesystem = fs.__setMockFilesystem({
fs.__setMockFilesystem({
'root': {
'index.js': [
'/**',
Expand All @@ -703,7 +742,10 @@ describe('DependencyGraph', function() {
}
}
});
var dgraph = new DependencyGraph({roots: [root], fileWatcher: fileWatcher});
var dgraph = new DependencyGraph({
roots: [root],
fileWatcher: fileWatcher
});
return dgraph.load().then(function() {
triggerFileChange('change', 'aPackage', '/root', {
isDirectory: function(){ return true; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

'use strict';

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

Expand All @@ -35,7 +36,8 @@ var commentStartRe = /^\/\*\*?/;
var commentEndRe = /\*\/$/;
var wsRe = /[\t ]+/g;
var stringStartRe = /(\r?\n|^) *\*/g;
var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
var multilineRe =
/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;

/**
Expand All @@ -51,15 +53,15 @@ function parse(docblock) {

// Normalize multi-line directives
var prev = '';
while (prev != docblock) {
while (prev !== docblock) {
prev = docblock;
docblock = docblock.replace(multilineRe, "\n$1 $2\n");
docblock = docblock.replace(multilineRe, '\n$1 $2\n');
}
docblock = docblock.trim();

var result = [];
var match;
while (match = propertyRe.exec(docblock)) {
while ((match = propertyRe.exec(docblock))) {
result.push([match[1], match[2]]);
}

Expand Down
Loading

0 comments on commit 9d884a2

Please sign in to comment.