Lint JS files w/out extension too (#453)

Prior to this change, JS files without extension had not been linted.

To match them, we need a combination of positive and negative globbing
that does not mix well with the existing file selection for linting. Thus, we use
npm-run-all to run two ESLint invocations unconditionally in sequence
while still preserving the error code.

* Lint JS w/out extension too
* Fix newly surfaced linting errors
* Make use of npm-run-all for test script too
This commit is contained in:
Raphael von der Grün 2018-06-18 23:48:02 +02:00 committed by GitHub
parent 2c3db19310
commit 393dad6349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 87 additions and 84 deletions

View File

@ -25,5 +25,3 @@ android_sdk.print_newest_available_sdk_target().done(null, function(err) {
console.error(err);
process.exit(2);
});

View File

@ -24,7 +24,8 @@ var check_reqs = require('./templates/cordova/lib/check_reqs');
check_reqs.run().done(
function success () {
console.log('Looks like your environment fully supports cordova-android development!');
}, function fail(err) {
},
function fail (err) {
console.log(err);
process.exit(2);
}

View File

@ -25,8 +25,9 @@ var nopt = require('nopt');
var path = require('path');
// Support basic help commands
if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0)
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) >= 0) {
require('./lib/build').help();
}
// Do some basic argument parsing
var buildOpts = nopt({

View File

@ -19,12 +19,12 @@
under the License.
*/
var device = require('./device'),
args = process.argv;
var device = require('./device');
var args = process.argv;
if (args.length > 2) {
var install_target;
if (args[2].substring(0, 9) == '--target=') {
if (args[2].substring(0, 9) === '--target=') {
install_target = args[2].substring(9, args[2].length);
device.install(install_target).done(null, function (err) {
console.error('ERROR: ' + err);

View File

@ -19,12 +19,12 @@
under the License.
*/
var emulator = require('./emulator'),
args = process.argv;
var emulator = require('./emulator');
var args = process.argv;
var install_target;
if (args.length > 2) {
if (args[2].substring(0, 9) == '--target=') {
if (args[2].substring(0, 9) === '--target=') {
install_target = args[2].substring(9, args[2].length);
} else {
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');

View File

@ -19,12 +19,12 @@
under the License.
*/
var emulator = require('./emulator'),
args = process.argv;
var emulator = require('./emulator');
var args = process.argv;
var install_target;
if (args.length > 2) {
if (args[2].substring(0, 9) == '--target=') {
if (args[2].substring(0, 9) === '--target=') {
install_target = args[2].substring(9, args[2].length);
} else {
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
@ -36,4 +36,3 @@ emulator.start(install_target).done(null, function(err) {
console.error('ERROR: ' + err);
process.exit(2);
});

View File

@ -19,9 +19,9 @@
under the License.
*/
var log = require('./lib/log'),
reqs = require('./lib/check_reqs'),
args = process.argv;
var log = require('./lib/log');
var reqs = require('./lib/check_reqs');
var args = process.argv;
// Usage support for when args are given
if (args.length > 2) {

View File

@ -24,8 +24,9 @@ var nopt = require('nopt');
var path = require('path');
// Support basic help commands
if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0)
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
require('./lib/run').help();
}
// Do some basic argument parsing
var runOpts = nopt({

View File

@ -20,7 +20,7 @@
*/
// Coho updates this line:
var VERSION = "7.2.0-dev";
var VERSION = '7.2.0-dev';
module.exports.version = VERSION;

View File

@ -19,12 +19,14 @@
"apache"
],
"scripts": {
"test": "npm run eslint && npm run unit-tests && npm run java-unit-tests && npm run e2e-tests",
"test": "run-s eslint unit-tests java-unit-tests e2e-tests",
"unit-tests": "jasmine --config=spec/unit/jasmine.json",
"cover": "istanbul cover --root bin --print detail jasmine -- --config=spec/unit/jasmine.json",
"e2e-tests": "jasmine --config=spec/e2e/jasmine.json",
"java-unit-tests": "node test/run_java_unit_tests.js",
"eslint": "eslint bin spec test"
"eslint": "run-s -c eslint:*",
"eslint:scripts": "eslint bin spec test",
"eslint:bins": "eslint 'bin/**/*' --ignore-pattern '**/*.*' --ignore-pattern '**/gitignore'"
},
"author": "Apache Software Foundation",
"license": "Apache-2.0",
@ -56,6 +58,7 @@
"eslint-plugin-standard": "^3.0.1",
"istanbul": "^0.4.2",
"jasmine": "~2.6.0",
"npm-run-all": "^4.1.3",
"promise-matchers": "~0",
"rewire": "^2.1.3"
},