Fix lint in local-cli

Reviewed By: cpojer

Differential Revision: D4166993

fbshipit-source-id: 9a8249175d98b42d7557817846d8c09c9769485e
This commit is contained in:
Ovidiu Viorel Iepure 2016-11-14 11:12:24 -08:00 committed by Facebook Github Bot
parent eeba5eb774
commit 24d2bbfbab
30 changed files with 193 additions and 45 deletions

View File

@ -1,5 +1,14 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
// beeper@1.1.0 has a return statement outside of a function
// and therefore doesn't parse. Let's mock it so that we can
// run the tests.
module.exports = function () {};

View File

@ -13,6 +13,7 @@ jest.autoMockOff();
var path = require('path');
var fs = require('fs');
// eslint-disable-next-line improperly-disabled-jasmine-tests
xdescribe('React Yeoman Generators', function() {
describe('react:react', function() {
var assert;
@ -44,7 +45,7 @@ xdescribe('React Yeoman Generators', function() {
jest.runAllTicks();
jest.runOnlyPendingTimers();
return generated;
}, "generation", 750);
}, 'generation', 750);
});
it('creates files', function() {
@ -87,7 +88,7 @@ xdescribe('React Yeoman Generators', function() {
var stat = fs.statSync('android');
expect(stat.isDirectory()).toBe(true);
})
});
});
describe('react:android', function () {
@ -123,7 +124,7 @@ xdescribe('React Yeoman Generators', function() {
jest.runAllTicks();
jest.runOnlyPendingTimers();
return generated;
}, "generation", 750);
}, 'generation', 750);
});
it('creates files', function () {
@ -203,7 +204,7 @@ xdescribe('React Yeoman Generators', function() {
jest.runAllTicks();
jest.runOnlyPendingTimers();
return generated;
}, "generation", 750);
}, 'generation', 750);
});
it('creates files', function() {

View File

@ -8,8 +8,8 @@
*/
'use strict';
var generate = require('../generate/generate');
var fs = require('fs');
var generate = require('../generate/generate');
function android(argv, config, args) {
return generate([
@ -29,9 +29,9 @@ module.exports = {
try {
return JSON.parse(
fs.readFileSync('package.json', 'utf8')
).name
).name;
} catch (e) {
return 'unknown-app-name'
return 'unknown-app-name';
}
},
}],

View File

@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const log = require('../util/log').out('bundle');
const Promise = require('promise');

View File

@ -6,10 +6,11 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const buildBundle = require('./buildBundle');
const outputBundle = require('./output/bundle');
const bundleCommandLineArgs = require('./bundleCommandLineArgs');
const outputBundle = require('./output/bundle');
/**
* Builds the bundle starting to look for dependencies at the given entry path.

View File

@ -8,8 +8,8 @@
*/
'use strict';
const path = require('path');
const assetPathUtils = require('./assetPathUtils');
const path = require('path');
function getAssetDestPathAndroid(asset, scale) {
const androidFolder = assetPathUtils.getAndroidDrawableFolderName(asset, scale);

View File

@ -9,6 +9,7 @@
'use strict';
const Promise = require('promise');
const meta = require('./meta');
const writeFile = require('./writeFile');

View File

@ -8,14 +8,15 @@
*/
'use strict';
const mkdirp = require('mkdirp');
const path = require('path');
const MAGIC_UNBUNDLE_NUMBER = require('./magic-number');
const Promise = require('promise');
const buildSourceMapWithMetaData = require('./build-unbundle-sourcemap-with-metadata');
const mkdirp = require('mkdirp');
const path = require('path');
const writeFile = require('../writeFile');
const writeSourceMap = require('./write-sourcemap');
const MAGIC_UNBUNDLE_NUMBER = require('./magic-number');
const {joinModules} = require('./util');
const MAGIC_UNBUNDLE_FILENAME = 'UNBUNDLE'; // must not start with a dot, as that won't go into the apk

View File

@ -8,13 +8,14 @@
*/
'use strict';
const MAGIC_UNBUNDLE_FILE_HEADER = require('./magic-number');
const Promise = require('promise');
const buildSourceMapWithMetaData = require('./build-unbundle-sourcemap-with-metadata');
const fs = require('fs');
const Promise = require('promise');
const writeSourceMap = require('./write-sourcemap');
const {joinModules} = require('./util');
const MAGIC_UNBUNDLE_FILE_HEADER = require('./magic-number');
const {joinModules} = require('./util');
const SIZEOF_UINT32 = 4;
/**

View File

@ -8,8 +8,8 @@
*/
'use strict';
const asIndexedFile = require('./as-indexed-file');
const asAssets = require('./as-assets');
const asIndexedFile = require('./as-indexed-file');
function buildBundle(packagerClient, requestOptions) {
return packagerClient.buildBundle({

View File

@ -9,6 +9,7 @@
'use strict';
const Promise = require('promise');
const writeFile = require('../writeFile');
function writeSourcemap(fileName, contents, log) {

View File

@ -8,9 +8,10 @@
*/
'use strict';
const fs = require('fs');
const Promise = require('promise');
const fs = require('fs');
function writeFile(file, data, encoding) {
return new Promise((resolve, reject) => {
fs.writeFile(

View File

@ -26,6 +26,7 @@ var md5_hash_hex;
// MD5 hash function for Node.js. To port this to other platforms, provide an
// alternate code path for defining the md5_hash_hex function.
var crypto = require('crypto');
// eslint-disable-next-line no-shadow
md5_hash_hex = function md5_hash_hex(data, input_encoding) {
var md5sum = crypto.createHash('md5');
md5sum.update(data, input_encoding);
@ -59,11 +60,12 @@ exports.is_signed = is_signed;
function sign(file_data) {
var first_time = file_data.indexOf(TOKEN) !== -1;
if (!first_time) {
if (is_signed(file_data))
if (is_signed(file_data)) {
file_data = file_data.replace(PATTERN, signing_token());
else
} else {
throw exports.TokenNotFoundError;
}
}
var signature = md5_hash_hex(file_data, 'utf8');
var signed_data = file_data.replace(TOKEN, 'SignedSource<<' + signature + '>>');
return { first_time: first_time, signed_data: signed_data };
@ -78,8 +80,9 @@ exports.sign = sign;
// it contains an invalid signature.
function verify_signature(file_data) {
var match = PATTERN.exec(file_data);
if (!match)
if (!match) {
return exports.SIGN_UNSIGNED;
}
// Replace the signature with the TOKEN, then hash and see if it matches
// the value in the file. For backwards compatibility, also try with
// OLDTOKEN if that doesn't match.
@ -88,9 +91,10 @@ function verify_signature(file_data) {
token = TOKENS[k];
with_token = file_data.replace(PATTERN, '@' + 'generated ' + token);
actual_md5 = md5_hash_hex(with_token, 'utf8');
if (expected_md5 === actual_md5)
if (expected_md5 === actual_md5) {
return exports.SIGN_OK;
}
}
return exports.SIGN_INVALID;
}
exports.verify_signature = verify_signature;

View File

@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const bundleWithOutput = require('./bundle').withOutput;
const bundleCommandLineArgs = require('./bundleCommandLineArgs');

View File

@ -1,3 +1,13 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const fs = require('fs');
const path = require('path');

View File

@ -1,3 +1,13 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const glob = require('glob');
const path = require('path');

View File

@ -1,6 +1,16 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const path = require('path');
/**
* Gets package's class name (class that implements ReactPackage)

View File

@ -1,10 +1,18 @@
const path = require('path');
const fs = require('fs');
const glob = require('glob');
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const findAndroidAppFolder = require('./findAndroidAppFolder');
const findManifest = require('./findManifest');
const readManifest = require('./readManifest');
const findPackageClassName = require('./findPackageClassName');
const path = require('path');
const readManifest = require('./readManifest');
const getPackageName = (manifest) => manifest.attr.package;

View File

@ -1,3 +1,13 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const fs = require('fs');
const xml = require('xmldoc');

View File

@ -1,3 +1,13 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const glob = require('glob');
const path = require('path');
@ -13,8 +23,8 @@ const findAssetsInFolder = (folder) =>
module.exports = function findAssets(folder, assets) {
return (assets || [])
.map(assetsFolder => path.join(folder, assetsFolder))
.reduce((assets, assetsFolder) =>
assets.concat(findAssetsInFolder(assetsFolder)),
.reduce((_assets, assetsFolder) =>
_assets.concat(findAssetsInFolder(assetsFolder)),
[]
);
};

View File

@ -1,8 +1,17 @@
const path = require('path');
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const android = require('./android');
const ios = require('./ios');
const findAssets = require('./findAssets');
const ios = require('./ios');
const path = require('path');
const wrapCommands = require('./wrapCommands');
const getRNPMConfig = (folder) =>

View File

@ -1,3 +1,13 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const glob = require('glob');
const path = require('path');

View File

@ -1,5 +1,15 @@
const path = require('path');
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const findProject = require('./findProject');
const path = require('path');
/**
* For libraries specified without an extension, add '.tbd' for those that

View File

@ -1,9 +1,19 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const makeCommand = require('../makeCommand');
module.exports = function wrapCommands(commands) {
const mappedCommands = {};
Object.keys(commands || []).forEach((k) =>
mappedCommands[k] = makeCommand(commands[k])
);
Object.keys(commands || []).forEach((k) => {
mappedCommands[k] = makeCommand(commands[k]);
});
return mappedCommands;
};

View File

@ -1,3 +1,13 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const path = require('path');
const union = require('lodash').union;
const uniq = require('lodash').uniq;

View File

@ -1,5 +1,15 @@
const path = require('path');
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const findPlugins = require('./findPlugins');
const path = require('path');
const flatten = require('lodash').flatten;
const attachPackage = (command, pkg) => Array.isArray(command)

View File

@ -1,3 +1,13 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const spawn = require('child_process').spawn;
module.exports = function makeCommand(command) {

View File

@ -8,7 +8,6 @@
*/
'use strict';
var fs = require('fs');
var path = require('path');
var yeoman = require('yeoman-environment');

View File

@ -8,8 +8,8 @@
*/
'use strict';
var path = require('path');
var fs = require('fs');
var path = require('path');
function copyAndReplace(src, dest, replacements) {
if (fs.lstatSync(src).isDirectory()) {

View File

@ -9,10 +9,10 @@
'use strict';
const chalk = require('chalk');
const findSymlinksPaths = require('./findSymlinksPaths');
const formatBanner = require('./formatBanner');
const path = require('path');
const runServer = require('./runServer');
const findSymlinksPaths = require('./findSymlinksPaths');
const NODE_MODULES = path.resolve(__dirname, '..', '..', '..');
/**