Fix lint errors

Reviewed By: davidaurelio

Differential Revision: D2628366

fb-gh-sync-id: 8d849e2deb038842475e66ef641fa1d4f7b78d8f
This commit is contained in:
Christoph Pojer 2015-11-09 13:32:47 -08:00 committed by facebook-github-bot-7
parent 120bdae3f6
commit 8ff93e65d2
9 changed files with 190 additions and 192 deletions

View File

@ -22,7 +22,7 @@ class DeprecatedAssetMap {
fileWatcher, fileWatcher,
ignoreFilePath, ignoreFilePath,
helpers, helpers,
activity activity,
}) { }) {
if (roots == null || roots.length === 0) { if (roots == null || roots.length === 0) {
this._disabled = true; this._disabled = true;
@ -85,9 +85,9 @@ class DeprecatedAssetMap {
} }
_processAsset(file) { _processAsset(file) {
let ext = this._helpers.extname(file); const ext = this._helpers.extname(file);
if (this._assetExts.indexOf(ext) !== -1) { if (this._assetExts.indexOf(ext) !== -1) {
let name = assetName(file, ext); const name = assetName(file, ext);
if (this._map[name] != null) { if (this._map[name] != null) {
debug('Conflcting assets', name); debug('Conflcting assets', name);
} }

View File

@ -25,12 +25,12 @@ class HasteMap {
this._map = Object.create(null); this._map = Object.create(null);
let promises = this._fastfs.findFilesByExt('js', { let promises = this._fastfs.findFilesByExt('js', {
ignore: (file) => this._helpers.isNodeModulesDir(file) ignore: (file) => this._helpers.isNodeModulesDir(file),
}).map(file => this._processHasteModule(file)); }).map(file => this._processHasteModule(file));
promises = promises.concat( promises = promises.concat(
this._fastfs.findFilesByName('package.json', { this._fastfs.findFilesByName('package.json', {
ignore: (file) => this._helpers.isNodeModulesDir(file) ignore: (file) => this._helpers.isNodeModulesDir(file),
}).map(file => this._processHastePackage(file)) }).map(file => this._processHastePackage(file))
); );
@ -41,9 +41,9 @@ class HasteMap {
return Promise.resolve().then(() => { return Promise.resolve().then(() => {
/*eslint no-labels: 0 */ /*eslint no-labels: 0 */
if (type === 'delete' || type === 'change') { if (type === 'delete' || type === 'change') {
loop: for (let name in this._map) { loop: for (const name in this._map) {
const modulesMap = this._map[name]; const modulesMap = this._map[name];
for (let platform in modulesMap) { for (const platform in modulesMap) {
const module = modulesMap[platform]; const module = modulesMap[platform];
if (module.path === absPath) { if (module.path === absPath) {
delete modulesMap[platform]; delete modulesMap[platform];
@ -53,7 +53,7 @@ class HasteMap {
} }
if (type === 'delete') { if (type === 'delete') {
return; return null;
} }
} }

View File

@ -48,7 +48,7 @@ describe('DependencyGraph', function() {
on: function() { on: function() {
return this; return this;
}, },
isWatchman: () => Promise.resolve(false) isWatchman: () => Promise.resolve(false),
}; };
defaults = { defaults = {
@ -78,14 +78,14 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("a")' 'require("a")',
].join('\n'), ].join('\n'),
'a.js': [ 'a.js': [
'/**', '/**',
' * @providesModule a', ' * @providesModule a',
' */', ' */',
].join('\n'), ].join('\n'),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -104,7 +104,7 @@ describe('DependencyGraph', function() {
isJSON: false, isJSON: false,
isPolyfill: false, isPolyfill: false,
resolution: undefined, resolution: undefined,
resolveDependency: undefined resolveDependency: undefined,
}, },
{ {
id: 'a', id: 'a',
@ -115,7 +115,7 @@ describe('DependencyGraph', function() {
isJSON: false, isJSON: false,
isPolyfill: false, isPolyfill: false,
resolution: undefined, resolution: undefined,
resolveDependency: undefined resolveDependency: undefined,
}, },
]); ]);
}); });
@ -129,7 +129,7 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("a")' 'require("a")',
].join('\n'), ].join('\n'),
'a.js': [ 'a.js': [
'/**', '/**',
@ -141,7 +141,7 @@ describe('DependencyGraph', function() {
' * @providesModule a', ' * @providesModule a',
' */', ' */',
].join('\n'), ].join('\n'),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -180,18 +180,18 @@ describe('DependencyGraph', function() {
fs.__setMockFilesystem({ fs.__setMockFilesystem({
'root': { 'root': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'package' name: 'package',
}), }),
'index.js': [ 'index.js': [
'/**', '/**',
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("./a.json")', 'require("./a.json")',
'require("./b")' 'require("./b")',
].join('\n'), ].join('\n'),
'a.json': JSON.stringify({}), 'a.json': JSON.stringify({}),
'b.json': JSON.stringify({}), 'b.json': JSON.stringify({}),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -240,7 +240,7 @@ describe('DependencyGraph', function() {
fs.__setMockFilesystem({ fs.__setMockFilesystem({
'root': { 'root': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'package' name: 'package',
}), }),
'index.js': [ 'index.js': [
'/**', '/**',
@ -248,7 +248,7 @@ describe('DependencyGraph', function() {
' */', ' */',
'require("./package.json")', 'require("./package.json")',
].join('\n'), ].join('\n'),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -290,12 +290,12 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("image!a")' 'require("image!a")',
].join('\n'), ].join('\n'),
'imgs': { 'imgs': {
'a.png': '' 'a.png': '',
},
}, },
}
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -338,15 +338,15 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("./imgs/a.png")' 'require("./imgs/a.png")',
].join('\n'), ].join('\n'),
'imgs': { 'imgs': {
'a.png': '' 'a.png': '',
}, },
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'rootPackage' name: 'rootPackage',
}), }),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -399,9 +399,9 @@ describe('DependencyGraph', function() {
'c@2x.png': '', 'c@2x.png': '',
}, },
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'rootPackage' name: 'rootPackage',
}), }),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -478,9 +478,9 @@ describe('DependencyGraph', function() {
'c@2x.ios.png': '', 'c@2x.ios.png': '',
}, },
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'rootPackage' name: 'rootPackage',
}), }),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -551,12 +551,12 @@ describe('DependencyGraph', function() {
'require("image!a")', 'require("image!a")',
].join('\n'), ].join('\n'),
'imgs': { 'imgs': {
'a.png': '' 'a.png': '',
}, },
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'rootPackage' name: 'rootPackage',
}), }),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -617,7 +617,7 @@ describe('DependencyGraph', function() {
' */', ' */',
'require("index")', 'require("index")',
].join('\n'), ].join('\n'),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -664,11 +664,11 @@ describe('DependencyGraph', function() {
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'lol' 'main.js': 'lol',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -715,11 +715,11 @@ describe('DependencyGraph', function() {
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'lol' 'main.js': 'lol',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -767,18 +767,18 @@ describe('DependencyGraph', function() {
'sha.js': { 'sha.js': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'sha.js', name: 'sha.js',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'lol' 'main.js': 'lol',
}, },
'x.y.z': { 'x.y.z': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'x.y.z', name: 'x.y.z',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'lol' 'main.js': 'lol',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -832,8 +832,8 @@ describe('DependencyGraph', function() {
name: 'aPackage', name: 'aPackage',
}), }),
'index.js': 'lol', 'index.js': 'lol',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -881,8 +881,8 @@ describe('DependencyGraph', function() {
' * @providesModule EpicModule', ' * @providesModule EpicModule',
' */', ' */',
].join('\n'), ].join('\n'),
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -929,8 +929,8 @@ describe('DependencyGraph', function() {
lib: { lib: {
'index.js': 'lol', 'index.js': 'lol',
}, },
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -975,7 +975,7 @@ describe('DependencyGraph', function() {
lib: { lib: {
'index.js': 'lol', 'index.js': 'lol',
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1024,7 +1024,7 @@ describe('DependencyGraph', function() {
'index.js': 'lol', 'index.js': 'lol',
'main.js': 'lol', 'main.js': 'lol',
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1069,9 +1069,9 @@ describe('DependencyGraph', function() {
].join('\n'), ].join('\n'),
'aPackage': { 'aPackage': {
'package.json': 'lol', 'package.json': 'lol',
'main.js': 'lol' 'main.js': 'lol',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1109,7 +1109,7 @@ describe('DependencyGraph', function() {
' * @providesModule index', ' * @providesModule index',
' */', ' */',
].join('\n'), ].join('\n'),
} },
}); });
const _exit = process.exit; const _exit = process.exit;
@ -1140,8 +1140,8 @@ describe('DependencyGraph', function() {
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("lolomg")', 'require("lolomg")',
].join('\n') ].join('\n'),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1161,7 +1161,7 @@ describe('DependencyGraph', function() {
isPolyfill: false, isPolyfill: false,
resolution: undefined, resolution: undefined,
resolveDependency: undefined, resolveDependency: undefined,
} },
]); ]);
}); });
}); });
@ -1179,14 +1179,14 @@ describe('DependencyGraph', function() {
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'lol', 'main.js': 'lol',
'subdir': { 'subdir': {
'lolynot.js': 'lolynot' 'lolynot.js': 'lolynot',
} },
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1228,12 +1228,12 @@ describe('DependencyGraph', function() {
'symlinkedPackage': { 'symlinkedPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'lol', 'main.js': 'lol',
'subdir': { 'subdir': {
'lolynot.js': 'lolynot' 'lolynot.js': 'lolynot',
} },
}, },
'root': { 'root': {
'index.js': [ 'index.js': [
@ -1243,7 +1243,7 @@ describe('DependencyGraph', function() {
'require("aPackage/subdir/lolynot")', 'require("aPackage/subdir/lolynot")',
].join('\n'), ].join('\n'),
'aPackage': { SYMLINK: '/symlinkedPackage' }, 'aPackage': { SYMLINK: '/symlinkedPackage' },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1292,15 +1292,15 @@ describe('DependencyGraph', function() {
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'require("./subdir/lolynot")', 'main.js': 'require("./subdir/lolynot")',
'subdir': { 'subdir': {
'lolynot.js': 'require("../other")' 'lolynot.js': 'require("../other")',
},
'other.js': 'some code',
},
}, },
'other.js': 'some code'
}
}
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1376,8 +1376,8 @@ describe('DependencyGraph', function() {
}), }),
'main.js': 'some other code', 'main.js': 'some other code',
'client.js': 'some code', 'client.js': 'some code',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1431,8 +1431,8 @@ describe('DependencyGraph', function() {
}), }),
'main.js': 'some other code', 'main.js': 'some other code',
'client.js': 'some code', 'client.js': 'some code',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1486,8 +1486,8 @@ describe('DependencyGraph', function() {
}), }),
'main.js': 'some other code', 'main.js': 'some other code',
'client.js': 'some code', 'client.js': 'some code',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1541,8 +1541,8 @@ describe('DependencyGraph', function() {
}), }),
'main.js': 'some other code', 'main.js': 'some other code',
'client.js': 'some code', 'client.js': 'some code',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1611,8 +1611,8 @@ describe('DependencyGraph', function() {
}, },
'hello.js': 'hello', 'hello.js': 'hello',
'bye.js': 'bye', 'bye.js': 'bye',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1697,7 +1697,7 @@ describe('DependencyGraph', function() {
name: 'aPackage', name: 'aPackage',
browser: { browser: {
'node-package': 'browser-package', 'node-package': 'browser-package',
} },
}), }),
'index.js': 'require("node-package")', 'index.js': 'require("node-package")',
'node-package': { 'node-package': {
@ -1712,8 +1712,8 @@ describe('DependencyGraph', function() {
}), }),
'index.js': 'some browser code', 'index.js': 'some browser code',
}, },
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1782,7 +1782,7 @@ describe('DependencyGraph', function() {
}), }),
'main.js': 'bar 1 module', 'main.js': 'bar 1 module',
}, },
} },
}, },
'bar': { 'bar': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
@ -1792,7 +1792,7 @@ describe('DependencyGraph', function() {
'main.js': 'bar 2 module', 'main.js': 'bar 2 module',
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1867,12 +1867,12 @@ describe('DependencyGraph', function() {
'bar': { 'bar': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'bar', name: 'bar',
main: 'main' main: 'main',
}), }),
'main.ios.js': '', 'main.ios.js': '',
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -1943,7 +1943,7 @@ describe('DependencyGraph', function() {
'main.js': 'bar 1 module', 'main.js': 'bar 1 module',
'lol.js': '', 'lol.js': '',
}, },
} },
}, },
'bar': { 'bar': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
@ -1953,7 +1953,7 @@ describe('DependencyGraph', function() {
'main.js': 'bar 2 module', 'main.js': 'bar 2 module',
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2031,14 +2031,14 @@ describe('DependencyGraph', function() {
name: 'bar', name: 'bar',
main: 'main.js', main: 'main.js',
browser: { browser: {
'./lol': './wow' './lol': './wow',
} },
}), }),
'main.js': 'bar 1 module', 'main.js': 'bar 1 module',
'lol.js': '', 'lol.js': '',
'wow.js': '', 'wow.js': '',
}, },
} },
}, },
'bar': { 'bar': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
@ -2048,7 +2048,7 @@ describe('DependencyGraph', function() {
'main2.js': 'bar 2 module', 'main2.js': 'bar 2 module',
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2132,7 +2132,7 @@ describe('DependencyGraph', function() {
}, },
'node_modules': {}, 'node_modules': {},
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2220,7 +2220,7 @@ describe('DependencyGraph', function() {
}), }),
'main.js': 'log()', 'main.js': 'log()',
}, },
} },
}, },
'ember': { 'ember': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
@ -2235,7 +2235,7 @@ describe('DependencyGraph', function() {
].join('\n'), ].join('\n'),
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2302,7 +2302,7 @@ describe('DependencyGraph', function() {
].join('\n'), ].join('\n'),
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2357,7 +2357,7 @@ describe('DependencyGraph', function() {
'main.js': 'foo module', 'main.js': 'foo module',
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2395,12 +2395,12 @@ describe('DependencyGraph', function() {
'sha.js': { 'sha.js': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'sha.js', name: 'sha.js',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'lol' 'main.js': 'lol',
} },
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2459,7 +2459,7 @@ describe('DependencyGraph', function() {
* @providesModule a * @providesModule a
*/ */
`, `,
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2518,7 +2518,7 @@ describe('DependencyGraph', function() {
* @providesModule a * @providesModule a
*/ */
`, `,
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2565,7 +2565,7 @@ describe('DependencyGraph', function() {
'a.ios.js': '', 'a.ios.js': '',
'a.android.js': '', 'a.android.js': '',
'a.js': '', 'a.js': '',
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2625,7 +2625,7 @@ describe('DependencyGraph', function() {
'main.js': 'require("./package.json")', 'main.js': 'require("./package.json")',
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2684,7 +2684,7 @@ describe('DependencyGraph', function() {
describe('file watch updating', function() { describe('file watch updating', function() {
var triggerFileChange; var triggerFileChange;
var mockStat = { var mockStat = {
isDirectory: () => false isDirectory: () => false,
}; };
beforeEach(function() { beforeEach(function() {
@ -2713,22 +2713,22 @@ describe('DependencyGraph', function() {
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("aPackage")', 'require("aPackage")',
'require("foo")' 'require("foo")',
].join('\n'), ].join('\n'),
'foo': [ 'foo': [
'/**', '/**',
' * @providesModule foo', ' * @providesModule foo',
' */', ' */',
'require("aPackage")' 'require("aPackage")',
].join('\n'), ].join('\n'),
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2776,22 +2776,22 @@ describe('DependencyGraph', function() {
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("aPackage")', 'require("aPackage")',
'require("foo")' 'require("foo")',
].join('\n'), ].join('\n'),
'foo.js': [ 'foo.js': [
'/**', '/**',
' * @providesModule foo', ' * @providesModule foo',
' */', ' */',
'require("aPackage")' 'require("aPackage")',
].join('\n'), ].join('\n'),
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2839,22 +2839,22 @@ describe('DependencyGraph', function() {
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("aPackage")', 'require("aPackage")',
'require("foo")' 'require("foo")',
].join('\n'), ].join('\n'),
'foo.js': [ 'foo.js': [
'/**', '/**',
' * @providesModule foo', ' * @providesModule foo',
' */', ' */',
'require("aPackage")' 'require("aPackage")',
].join('\n'), ].join('\n'),
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2901,22 +2901,22 @@ describe('DependencyGraph', function() {
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("aPackage")', 'require("aPackage")',
'require("foo")' 'require("foo")',
].join('\n'), ].join('\n'),
'foo.js': [ 'foo.js': [
'/**', '/**',
' * @providesModule foo', ' * @providesModule foo',
' */', ' */',
'require("aPackage")' 'require("aPackage")',
].join('\n'), ].join('\n'),
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -2928,7 +2928,7 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule bar', ' * @providesModule bar',
' */', ' */',
'require("foo")' 'require("foo")',
].join('\n'); ].join('\n');
triggerFileChange('add', 'bar.js', root, mockStat); triggerFileChange('add', 'bar.js', root, mockStat);
@ -2993,7 +2993,7 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("image!foo")' 'require("image!foo")',
].join('\n'), ].join('\n'),
}, },
}); });
@ -3018,7 +3018,7 @@ describe('DependencyGraph', function() {
isPolyfill: false, isPolyfill: false,
resolution: undefined, resolution: undefined,
resolveDependency: undefined, resolveDependency: undefined,
} },
]); ]);
filesystem.root['foo.png'] = ''; filesystem.root['foo.png'] = '';
@ -3062,10 +3062,10 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("./foo.png")' 'require("./foo.png")',
].join('\n'), ].join('\n'),
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage' name: 'aPackage',
}), }),
}, },
}); });
@ -3088,7 +3088,7 @@ describe('DependencyGraph', function() {
isPolyfill: false, isPolyfill: false,
resolution: undefined, resolution: undefined,
resolveDependency: undefined, resolveDependency: undefined,
} },
]); ]);
filesystem.root['foo.png'] = ''; filesystem.root['foo.png'] = '';
@ -3133,22 +3133,22 @@ describe('DependencyGraph', function() {
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("aPackage")', 'require("aPackage")',
'require("foo")' 'require("foo")',
].join('\n'), ].join('\n'),
'foo.js': [ 'foo.js': [
'/**', '/**',
' * @providesModule foo', ' * @providesModule foo',
' */', ' */',
'require("aPackage")' 'require("aPackage")',
].join('\n'), ].join('\n'),
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -3166,7 +3166,7 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule bar', ' * @providesModule bar',
' */', ' */',
'require("foo")' 'require("foo")',
].join('\n'); ].join('\n');
triggerFileChange('add', 'bar.js', root, mockStat); triggerFileChange('add', 'bar.js', root, mockStat);
@ -3223,22 +3223,22 @@ describe('DependencyGraph', function() {
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'require("aPackage")', 'require("aPackage")',
'require("foo")' 'require("foo")',
].join('\n'), ].join('\n'),
'foo.js': [ 'foo.js': [
'/**', '/**',
' * @providesModule foo', ' * @providesModule foo',
' */', ' */',
'require("aPackage")' 'require("aPackage")',
].join('\n'), ].join('\n'),
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
...defaults, ...defaults,
@ -3246,7 +3246,7 @@ describe('DependencyGraph', function() {
}); });
return getOrderedDependenciesAsJSON(dgraph, '/root/index.js').then(function() { return getOrderedDependenciesAsJSON(dgraph, '/root/index.js').then(function() {
triggerFileChange('change', 'aPackage', '/root', { triggerFileChange('change', 'aPackage', '/root', {
isDirectory: function(){ return true; } isDirectory: () => true,
}); });
return getOrderedDependenciesAsJSON(dgraph, '/root/index.js').then(function(deps) { return getOrderedDependenciesAsJSON(dgraph, '/root/index.js').then(function(deps) {
expect(deps) expect(deps)
@ -3302,11 +3302,11 @@ describe('DependencyGraph', function() {
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -3366,12 +3366,12 @@ describe('DependencyGraph', function() {
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
'browser.js': 'browser', 'browser.js': 'browser',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -3429,12 +3429,12 @@ describe('DependencyGraph', function() {
'aPackage': { 'aPackage': {
'package.json': JSON.stringify({ 'package.json': JSON.stringify({
name: 'aPackage', name: 'aPackage',
main: 'main.js' main: 'main.js',
}), }),
'main.js': 'main', 'main.js': 'main',
'browser.js': 'browser', 'browser.js': 'browser',
} },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -3492,10 +3492,10 @@ describe('DependencyGraph', function() {
}), }),
'main.js': 'bar 1 module', 'main.js': 'bar 1 module',
}, },
}
}, },
}, },
} },
},
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -3593,7 +3593,7 @@ describe('DependencyGraph', function() {
'browser.js': 'foo module', 'browser.js': 'foo module',
}, },
}, },
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -3648,14 +3648,14 @@ describe('DependencyGraph', function() {
'/**', '/**',
' * @providesModule index', ' * @providesModule index',
' */', ' */',
'System.import("a")' 'System.import("a")',
].join('\n'), ].join('\n'),
'a.js': [ 'a.js': [
'/**', '/**',
' * @providesModule a', ' * @providesModule a',
' */', ' */',
].join('\n'), ].join('\n'),
} },
}); });
var dgraph = new DependencyGraph({ var dgraph = new DependencyGraph({
@ -3667,7 +3667,7 @@ describe('DependencyGraph', function() {
.then(response => response.finalize()) .then(response => response.finalize())
.then(({ asyncDependencies }) => { .then(({ asyncDependencies }) => {
expect(asyncDependencies).toEqual([ expect(asyncDependencies).toEqual([
['/root/a.js'] ['/root/a.js'],
]); ]);
}); });
}); });

View File

@ -145,7 +145,7 @@ class Module {
*/ */
const blockCommentRe = /\/\*(.|\n)*?\*\//g; const blockCommentRe = /\/\*(.|\n)*?\*\//g;
const lineCommentRe = /\/\/.+(\n|$)/g; const lineCommentRe = /\/\/.+(\n|$)/g;
function extractRequires(code /*: string*/) /*: Array<string>*/ { function extractRequires(code) {
var deps = { var deps = {
sync: [], sync: [],
async: [], async: [],

View File

@ -51,7 +51,7 @@ describe('Module', () => {
fs.__setMockFilesystem({ fs.__setMockFilesystem({
'root': { 'root': {
'index.js': 'System.import("dep1")', 'index.js': 'System.import("dep1")',
} },
}); });
return expectAsyncDependenciesToEqual([['dep1']]); return expectAsyncDependenciesToEqual([['dep1']]);
@ -61,7 +61,7 @@ describe('Module', () => {
fs.__setMockFilesystem({ fs.__setMockFilesystem({
'root': { 'root': {
'index.js': 'System.import(\'dep1\')', 'index.js': 'System.import(\'dep1\')',
} },
}); });
return expectAsyncDependenciesToEqual([['dep1']]); return expectAsyncDependenciesToEqual([['dep1']]);
@ -74,7 +74,7 @@ describe('Module', () => {
'System.import("dep1")', 'System.import("dep1")',
'System.import("dep2")', 'System.import("dep2")',
].join('\n'), ].join('\n'),
} },
}); });
return expectAsyncDependenciesToEqual([ return expectAsyncDependenciesToEqual([
@ -87,7 +87,7 @@ describe('Module', () => {
fs.__setMockFilesystem({ fs.__setMockFilesystem({
'root': { 'root': {
'index.js': 'System.import(\n"dep1"\n)', 'index.js': 'System.import(\n"dep1"\n)',
} },
}); });
return expectAsyncDependenciesToEqual([['dep1']]); return expectAsyncDependenciesToEqual([['dep1']]);

View File

@ -142,7 +142,7 @@ class Fastfs extends EventEmitter {
} }
matches(dir, pattern) { matches(dir, pattern) {
let dirFile = this._getFile(dir); const dirFile = this._getFile(dir);
if (!dirFile.isDir) { if (!dirFile.isDir) {
throw new Error(`Expected file ${dirFile.path} to be a directory`); throw new Error(`Expected file ${dirFile.path} to be a directory`);
} }
@ -154,7 +154,7 @@ class Fastfs extends EventEmitter {
_getRoot(filePath) { _getRoot(filePath) {
for (let i = 0; i < this._roots.length; i++) { for (let i = 0; i < this._roots.length; i++) {
let possibleRoot = this._roots[i]; const possibleRoot = this._roots[i];
if (isDescendant(possibleRoot.path, filePath)) { if (isDescendant(possibleRoot.path, filePath)) {
return possibleRoot; return possibleRoot;
} }
@ -264,7 +264,7 @@ class File {
/*eslint consistent-this:0*/ /*eslint consistent-this:0*/
let file = this; let file = this;
for (let i = 0; i < parts.length; i++) { for (let i = 0; i < parts.length; i++) {
let fileName = parts[i]; const fileName = parts[i];
if (!fileName) { if (!fileName) {
continue; continue;
} }

View File

@ -8,8 +8,6 @@
*/ */
'use strict'; 'use strict';
const path = require('path');
const SUPPORTED_PLATFORM_EXTS = ['android', 'ios', 'web']; const SUPPORTED_PLATFORM_EXTS = ['android', 'ios', 'web'];
const re = new RegExp( const re = new RegExp(