mirror of
				https://github.com/JuanCanham/HackMyResume.git
				synced 2025-11-04 06:47:27 +00:00 
			
		
		
		
	style: fix eslint violations
This commit is contained in:
		
							
								
								
									
										19
									
								
								dist/cli/error.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								dist/cli/error.js
									
									
									
									
										vendored
									
									
								
							@@ -4,18 +4,12 @@
 | 
			
		||||
  @module cli/error
 | 
			
		||||
  @license MIT. See LICENSE.md for details.
 | 
			
		||||
  */
 | 
			
		||||
  /** Error handler for HackMyResume. All errors are handled here.
 | 
			
		||||
  @class ErrorHandler */
 | 
			
		||||
  var ErrorHandler, FCMD, FS, HMSTATUS, M2C, PATH, PKG, SyntaxErrorEx, WRAP, YAML, _defaultLog, assembleError, chalk, extend, printf;
 | 
			
		||||
  var FS, HMSTATUS, M2C, PATH, SyntaxErrorEx, WRAP, _defaultLog, assembleError, chalk, extend, printf;
 | 
			
		||||
 | 
			
		||||
  HMSTATUS = require('../core/status-codes');
 | 
			
		||||
 | 
			
		||||
  PKG = require('../../package.json');
 | 
			
		||||
 | 
			
		||||
  FS = require('fs');
 | 
			
		||||
 | 
			
		||||
  FCMD = require('../index');
 | 
			
		||||
 | 
			
		||||
  PATH = require('path');
 | 
			
		||||
 | 
			
		||||
  WRAP = require('word-wrap');
 | 
			
		||||
@@ -26,15 +20,15 @@
 | 
			
		||||
 | 
			
		||||
  extend = require('extend');
 | 
			
		||||
 | 
			
		||||
  YAML = require('yamljs');
 | 
			
		||||
 | 
			
		||||
  printf = require('printf');
 | 
			
		||||
 | 
			
		||||
  SyntaxErrorEx = require('../utils/syntax-error-ex');
 | 
			
		||||
 | 
			
		||||
  require('string.prototype.startswith');
 | 
			
		||||
 | 
			
		||||
  ErrorHandler = module.exports = {
 | 
			
		||||
  /** Error handler for HackMyResume. All errors are handled here.
 | 
			
		||||
  @class ErrorHandler */
 | 
			
		||||
  module.exports = {
 | 
			
		||||
    init: function(debug, assert, silent) {
 | 
			
		||||
      this.debug = debug;
 | 
			
		||||
      this.assert = assert;
 | 
			
		||||
@@ -94,7 +88,7 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  _defaultLog = function() {
 | 
			
		||||
    return console.log.apply(console.log, arguments);
 | 
			
		||||
    return console.log.apply(console.log, arguments); // eslint-disable-line no-console
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  assembleError = function(ex) {
 | 
			
		||||
@@ -185,6 +179,7 @@
 | 
			
		||||
        break;
 | 
			
		||||
      case HMSTATUS.readError:
 | 
			
		||||
        if (!ex.quiet) {
 | 
			
		||||
          // eslint-disable-next-line no-console
 | 
			
		||||
          console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
 | 
			
		||||
        }
 | 
			
		||||
        msg = ex.inner.toString();
 | 
			
		||||
@@ -215,6 +210,7 @@
 | 
			
		||||
        break;
 | 
			
		||||
      case HMSTATUS.parseError:
 | 
			
		||||
        if (SyntaxErrorEx.is(ex.inner)) {
 | 
			
		||||
          // eslint-disable-next-line no-console
 | 
			
		||||
          console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
 | 
			
		||||
          se = new SyntaxErrorEx(ex, ex.raw);
 | 
			
		||||
          if ((se.line != null) && (se.col != null)) {
 | 
			
		||||
@@ -243,6 +239,7 @@
 | 
			
		||||
      case HMSTATUS.invalidOptionsFile:
 | 
			
		||||
        msg = M2C(this.msgs.invalidOptionsFile.msg[0]);
 | 
			
		||||
        if (SyntaxErrorEx.is(ex.inner)) {
 | 
			
		||||
          // eslint-disable-next-line no-console
 | 
			
		||||
          console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
 | 
			
		||||
          se = new SyntaxErrorEx(ex, ex.raw);
 | 
			
		||||
          if ((se.line != null) && (se.col != null)) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								dist/cli/main.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								dist/cli/main.js
									
									
									
									
										vendored
									
									
								
							@@ -15,15 +15,8 @@
 | 
			
		||||
  - Need to accept JSON inputs from the command line.
 | 
			
		||||
  */
 | 
			
		||||
  /* Simple logging placeholder. */
 | 
			
		||||
  /*
 | 
			
		||||
  A callable implementation of the HackMyResume CLI. Encapsulates the command
 | 
			
		||||
  line interface as a single method accepting a parameter array.
 | 
			
		||||
  @alias module:cli/main.main
 | 
			
		||||
  @param rawArgs {Array} An array of command-line parameters. Will either be
 | 
			
		||||
  process.argv (in production) or custom parameters (in test).
 | 
			
		||||
  */
 | 
			
		||||
  /* Split multiple command-line filenames by the 'TO' keyword */
 | 
			
		||||
  var Command, EXTEND, FS, HME, HMR, HMSTATUS, M2C, OUTPUT, PAD, PATH, PKG, StringUtils, _, _err, _exitCallback, _opts, _out, _title, chalk, execute, executeFail, executeSuccess, initOptions, initialize, loadOptions, logMsg, main, printf, safeLoadJSON, splitSrcDest;
 | 
			
		||||
  var Command, EXTEND, FS, HMR, HMSTATUS, M2C, OUTPUT, PAD, PATH, PKG, _, _err, _exitCallback, _opts, _out, _title, chalk, execute, executeFail, executeSuccess, initOptions, initialize, loadOptions, logMsg, printf, safeLoadJSON, splitSrcDest;
 | 
			
		||||
 | 
			
		||||
  HMR = require('../index');
 | 
			
		||||
 | 
			
		||||
@@ -39,12 +32,9 @@
 | 
			
		||||
 | 
			
		||||
  HMSTATUS = require('../core/status-codes');
 | 
			
		||||
 | 
			
		||||
  HME = require('../core/event-codes');
 | 
			
		||||
 | 
			
		||||
  safeLoadJSON = require('../utils/safe-json-loader');
 | 
			
		||||
 | 
			
		||||
  StringUtils = require('../utils/string.js');
 | 
			
		||||
 | 
			
		||||
  //StringUtils = require '../utils/string.js'
 | 
			
		||||
  _ = require('underscore');
 | 
			
		||||
 | 
			
		||||
  OUTPUT = require('./out');
 | 
			
		||||
@@ -67,7 +57,14 @@
 | 
			
		||||
 | 
			
		||||
  _exitCallback = null;
 | 
			
		||||
 | 
			
		||||
  main = module.exports = function(rawArgs, exitCallback) {
 | 
			
		||||
  /*
 | 
			
		||||
  A callable implementation of the HackMyResume CLI. Encapsulates the command
 | 
			
		||||
  line interface as a single method accepting a parameter array.
 | 
			
		||||
  @alias module:cli/main.main
 | 
			
		||||
  @param rawArgs {Array} An array of command-line parameters. Will either be
 | 
			
		||||
  process.argv (in production) or custom parameters (in test).
 | 
			
		||||
  */
 | 
			
		||||
  module.exports = function(rawArgs, exitCallback) {
 | 
			
		||||
    var args, initInfo, program;
 | 
			
		||||
    initInfo = initialize(rawArgs, exitCallback);
 | 
			
		||||
    if (initInfo === null) {
 | 
			
		||||
@@ -96,13 +93,15 @@
 | 
			
		||||
      execute.call(this, sources, [], this.opts(), logMsg);
 | 
			
		||||
    });
 | 
			
		||||
    // Create the PEEK command
 | 
			
		||||
    program.command('peek').arguments('<sources...>').description('Peek at a resume field or section').action(function(sources, sectionOrField) {
 | 
			
		||||
    //.action(( sources, sectionOrField ) ->
 | 
			
		||||
    program.command('peek').arguments('<sources...>').description('Peek at a resume field or section').action(function(sources) {
 | 
			
		||||
      var dst;
 | 
			
		||||
      dst = (sources && sources.length > 1) ? [sources.pop()] : [];
 | 
			
		||||
      execute.call(this, sources, dst, this.opts(), logMsg);
 | 
			
		||||
    });
 | 
			
		||||
    // Create the BUILD command
 | 
			
		||||
    program.command('build').alias('generate').option('-t --theme <theme>', 'Theme name or path').option('-n --no-prettify', 'Disable HTML prettification', true).option('-c --css <option>', 'CSS linking / embedding').option('-p --pdf <engine>', 'PDF generation engine').option('--no-sort', 'Sort resume sections by date', false).option('--tips', 'Display theme tips and warnings.', false).option('--private', 'Include resume fields marked as private', false).option('--no-escape', "Turn off encoding in Handlebars themes.", false).description('Generate resume to multiple formats').action(function(sources, targets, options) {
 | 
			
		||||
    //.action(( sources, targets, options ) ->
 | 
			
		||||
    program.command('build').alias('generate').option('-t --theme <theme>', 'Theme name or path').option('-n --no-prettify', 'Disable HTML prettification', true).option('-c --css <option>', 'CSS linking / embedding').option('-p --pdf <engine>', 'PDF generation engine').option('--no-sort', 'Sort resume sections by date', false).option('--tips', 'Display theme tips and warnings.', false).option('--private', 'Include resume fields marked as private', false).option('--no-escape', 'Turn off encoding in Handlebars themes.', false).description('Generate resume to multiple formats').action(function() {
 | 
			
		||||
      var x;
 | 
			
		||||
      x = splitSrcDest.call(this);
 | 
			
		||||
      execute.call(this, x.src, x.dst, this.opts(), logMsg);
 | 
			
		||||
@@ -166,7 +165,7 @@
 | 
			
		||||
      }, true);
 | 
			
		||||
    }
 | 
			
		||||
    // Override the .missingArgument behavior
 | 
			
		||||
    Command.prototype.missingArgument = function(name) {
 | 
			
		||||
    Command.prototype.missingArgument = function(/* unused */) {
 | 
			
		||||
      if (this.name() !== 'help') {
 | 
			
		||||
        _err.err({
 | 
			
		||||
          verb: this.name(),
 | 
			
		||||
@@ -277,7 +276,7 @@
 | 
			
		||||
    prom.then(executeSuccess, executeFail);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  executeSuccess = function(obj) {};
 | 
			
		||||
  executeSuccess = function(/*obj*/) {};
 | 
			
		||||
 | 
			
		||||
  // Can't call _exitCallback here (process.exit) when PDF is running in BK
 | 
			
		||||
  //_exitCallback 0; return
 | 
			
		||||
@@ -363,6 +362,7 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  logMsg = function() {
 | 
			
		||||
    // eslint-disable-next-line no-console
 | 
			
		||||
    return _opts.silent || console.log.apply(console.log, arguments);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								dist/cli/out.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								dist/cli/out.js
									
									
									
									
										vendored
									
									
								
							@@ -4,7 +4,7 @@
 | 
			
		||||
  @license MIT. See LICENSE.md for details.
 | 
			
		||||
  @module cli/out
 | 
			
		||||
  */
 | 
			
		||||
  var EXTEND, FS, HANDLEBARS, HME, LO, M2C, OutputHandler, PATH, YAML, _, chalk, dbgStyle, pad, printf;
 | 
			
		||||
  var EXTEND, FS, HANDLEBARS, HME, M2C, OutputHandler, PATH, YAML, _, chalk, dbgStyle, pad, printf;
 | 
			
		||||
 | 
			
		||||
  chalk = require('chalk');
 | 
			
		||||
 | 
			
		||||
@@ -16,8 +16,6 @@
 | 
			
		||||
 | 
			
		||||
  PATH = require('path');
 | 
			
		||||
 | 
			
		||||
  LO = require('lodash');
 | 
			
		||||
 | 
			
		||||
  FS = require('fs');
 | 
			
		||||
 | 
			
		||||
  EXTEND = require('extend');
 | 
			
		||||
@@ -32,7 +30,7 @@
 | 
			
		||||
 | 
			
		||||
  dbgStyle = 'cyan';
 | 
			
		||||
 | 
			
		||||
  module.exports = OutputHandler = class OutputHandler {
 | 
			
		||||
  OutputHandler = class OutputHandler {
 | 
			
		||||
    constructor(opts) {
 | 
			
		||||
      this.init(opts);
 | 
			
		||||
      return;
 | 
			
		||||
@@ -43,16 +41,15 @@
 | 
			
		||||
      this.msgs = YAML.load(PATH.join(__dirname, 'msg.yml')).events;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    log(msg) {
 | 
			
		||||
    log() {
 | 
			
		||||
      var finished;
 | 
			
		||||
      msg = msg || '';
 | 
			
		||||
      printf = require('printf');
 | 
			
		||||
      finished = printf.apply(printf, arguments);
 | 
			
		||||
      return this.opts.silent || console.log(finished);
 | 
			
		||||
      return this.opts.silent || console.log(finished); // eslint-disable-line no-console
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    do(evt) {
 | 
			
		||||
      var L, WRAP, adj, info, msg, msgs, numFormats, output, rawTpl, sty, style, suffix, template, that, themeName, tot;
 | 
			
		||||
      var L, adj, info, msg, msgs, numFormats, output, rawTpl, sty, style, suffix, template, that, themeName, tot;
 | 
			
		||||
      that = this;
 | 
			
		||||
      L = function() {
 | 
			
		||||
        return that.log.apply(that, arguments);
 | 
			
		||||
@@ -84,7 +81,6 @@
 | 
			
		||||
          if (evt.cmd === 'build') {
 | 
			
		||||
            themeName = this.theme.name.toUpperCase();
 | 
			
		||||
            if (this.opts.tips && (this.theme.message || this.theme.render)) {
 | 
			
		||||
              WRAP = require('word-wrap');
 | 
			
		||||
              if (this.theme.message) {
 | 
			
		||||
                L(M2C(this.msgs.afterBuild.msg[0], 'cyan'), themeName);
 | 
			
		||||
                return L(M2C(this.theme.message, 'white'));
 | 
			
		||||
@@ -157,7 +153,7 @@
 | 
			
		||||
          evt.schema = evt.schema.replace('jars', 'JSON Resume').toUpperCase();
 | 
			
		||||
          L(M2C(msgs[0], 'white') + chalk[style].bold(adj), evt.file, evt.schema);
 | 
			
		||||
          if (evt.violations) {
 | 
			
		||||
            _.each(evt.violations, function(err, idx) {
 | 
			
		||||
            _.each(evt.violations, function(err) {
 | 
			
		||||
              L(chalk.yellow.bold('--> ') + chalk.yellow(err.field.replace('data.', 'resume.').toUpperCase() + ' ' + err.message));
 | 
			
		||||
            }, this);
 | 
			
		||||
          }
 | 
			
		||||
@@ -172,6 +168,7 @@
 | 
			
		||||
          }
 | 
			
		||||
          // If the key was present, print it
 | 
			
		||||
          if (evt.target !== void 0 && !evt.error) {
 | 
			
		||||
            // eslint-disable-next-line no-console
 | 
			
		||||
            return console.dir(evt.target, {
 | 
			
		||||
              depth: null,
 | 
			
		||||
              colors: true
 | 
			
		||||
@@ -186,6 +183,8 @@
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  module.exports = OutputHandler;
 | 
			
		||||
 | 
			
		||||
}).call(this);
 | 
			
		||||
 | 
			
		||||
//# sourceMappingURL=out.js.map
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user