Comparing version 1.0.3 to 1.0.4
29
index.js
@@ -31,3 +31,3 @@ #!/usr/bin/env node | ||
'a glob of files to to test the EcmaScript version against' | ||
).action((args, options, logger) => { | ||
).action((args, options, logger) => { | ||
const v = args.ecmaVersion | ||
@@ -72,7 +72,9 @@ const files = args.files | ||
const errors = [] | ||
const errFiles = [] | ||
const globOpts = { nodir: true } | ||
const acornOpts = { ecmaVersion: e, silent: true } | ||
files.forEach((pattern) => { | ||
// pattern => glob or array | ||
const globbedFiles = glob.sync(pattern) | ||
const globbedFiles = glob.sync(pattern, globOpts) | ||
@@ -82,8 +84,6 @@ globbedFiles.forEach((file) => { | ||
try { | ||
const result = acorn.parse(code, { | ||
ecmaVersion: e, | ||
silent: true, | ||
}) | ||
acorn.parse(code, acornOpts) | ||
} catch (err) { | ||
errors.push(file) | ||
logger.debug(`ES-Check: failed to parse file: ${file} \n - error: ${err}`) | ||
errFiles.push(file) | ||
} | ||
@@ -93,14 +93,13 @@ }) | ||
if (errors.length > 0) { | ||
logger.error(`ES-check: there were ${errors.length} ES version matching errors.`) | ||
errors.forEach((error) => { | ||
logger.info(`\n es-check: error in: ${error}`) | ||
if (errFiles.length > 0) { | ||
logger.error(`ES-Check: there were ${errFiles.length} ES version matching errors.`) | ||
errFiles.forEach((file) => { | ||
logger.info(`\n ES-Check: error in: ${file}`) | ||
}) | ||
process.exit(1) | ||
return | ||
} else { | ||
logger.error(`ES-check: there were no ES version matching errors! 🎉`) | ||
logger.error(`ES-Check: there were no ES version matching errors! 🎉`) | ||
} | ||
}) | ||
prog.parse(process.argv) | ||
prog.parse(argsArray) |
{ | ||
"name": "es-check", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Checks the EcamScript version of .js glob against a specified version of EcamScript with a shell command", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
'use strict' | ||
const exec = require('child_process').exec | ||
const globby = require('globby') | ||
const assert = require('assert') | ||
@@ -6,0 +5,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128433
17
3964