Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

avn-nvm jshint failures #66

Closed
duckontheweb opened this issue Nov 12, 2017 · 8 comments
Closed

avn-nvm jshint failures #66

duckontheweb opened this issue Nov 12, 2017 · 8 comments

Comments

@duckontheweb
Copy link
Contributor

Please describe your issue clearly and also include all details below.

Details

  • node v4.8.6

I'm getting a number of jshint failures when running the tests for avn-nvm, all of them in /index.js (see below for full details). Would you like me to clean these up before submitting any PRs related to #43?

xpects valid type instead of  String  at ./index.js :
    15 | * @private
    16 | * @function
    17 | * @param { String } command
-------------------^
    18 | * @return { Promise }
    19 | */

Expects valid type instead of  Promise  at ./index.js :
    16 | * @function
    17 | * @param { String } command
    18 | * @return { Promise }
--------------------^
    19 | */
    20 |var nvmCommand = function(command) {

Missing space before opening round brace at ./index.js :
    18 | * @return { Promise }
    19 | */
    20 |var nvmCommand = function(command) {
---------------------------------^
    21 |  return new Promise(function(resolve, reject) {
    22 |    var stdout, stderr;

Missing space before opening round brace at ./index.js :
    19 | */
    20 |var nvmCommand = function(command) {
    21 |  return new Promise(function(resolve, reject) {
-------------------------------------^
    22 |    var stdout, stderr;
    23 |    var cmd = child.spawn(process.env.SHELL,

Missing space before opening round brace at ./index.js :
    24 |      ['-c', 'source $NVM_DIR/nvm.sh; nvm ' + command]);
    25 |
    26 |    cmd.stdout.pipe(concat(function(data) {
-------------------------------------------^
    27 |      stdout = data;
    28 |    }));

Missing space before opening round brace at ./index.js :
    28 |    }));
    29 |
    30 |    cmd.stderr.pipe(concat(function(data) {
-------------------------------------------^
    31 |      stderr = data;
    32 |    }));

Missing space before opening round brace at ./index.js :
    32 |    }));
    33 |
    34 |    cmd.on('close', function(code) {
------------------------------------^
    35 |      if (code === 0) { resolve({ stdout: stdout, stderr: stderr }); }
    36 |      else {

Missing space before opening round brace at ./index.js :
    50 | * @return {Array.<String>}
    51 | */
    52 |var parseVersions = function(output) {
------------------------------------^
    53 |  var string = output.stdout.toString()
    54 |    .replace(/\x1b[^m]*m/g, '')

Missing space before opening round brace at ./index.js :
    55 |    .replace(/^->/gm, '');
    56 |  return string.split('\n')
    57 |  .map(function(line) { return line.trim(); })
-----------------------^
    58 |  .filter(function(line) { return line && !line.match(/current|system|->/); });
    59 |};

Missing space before opening round brace at ./index.js :
    56 |  return string.split('\n')
    57 |  .map(function(line) { return line.trim(); })
    58 |  .filter(function(line) { return line && !line.match(/current|system|->/); });
--------------------------^
    59 |};
    60 |

Missing space before opening round brace at ./index.js :
    66 | * @return {Promise}
    67 | */
    68 |var listVersions = function() {
-----------------------------------^
    69 |  // find all of the versions of node installed by nvm.
    70 |  return Promise.resolve()

Missing space before opening round brace at ./index.js :
    69 |  // find all of the versions of node installed by nvm.
    70 |  return Promise.resolve()
    71 |  .then(function() { return nvmCommand('list'); })
------------------------^
    72 |  .then(parseVersions);
    73 |};

Missing space before opening round brace at ./index.js :
    80 | * @return {Promise}
    81 | */
    82 |var versionName = function(version) {
----------------------------------^
    83 |  var match = version.match(VERSION_REGEX);
    84 |  return match ? match[1] : null;

Missing space before opening round brace at ./index.js :
    93 | * @return {String}
    94 | */
    95 |var versionNumber = function(version) {
------------------------------------^
    96 |  var match = version.match(VERSION_REGEX);
    97 |  return match ? match[2] : version;

Missing space before opening round brace at ./index.js :
   105 | * @return {String}
   106 | */
   107 |var findVersion = function(versions, matching) {
----------------------------------^
   108 |  var highestMatch = null;
   109 |

Missing space before opening round brace at ./index.js :
   111 |  var mNumber = versionNumber(matching);
   112 |
   113 |  versions.forEach(function(v) {
-----------------------------------^
   114 |    var vName = versionName(v);
   115 |    var vNumber = versionNumber(v);

Missing space before opening round brace at ./index.js :
   131 | * @return {Promise}
   132 | */
   133 |var installedVersion = function(matching) {
---------------------------------------^
   134 |  return Promise.resolve()
   135 |  .then(function() { return listVersions(); })

Missing space before opening round brace at ./index.js :
   133 |var installedVersion = function(matching) {
   134 |  return Promise.resolve()
   135 |  .then(function() { return listVersions(); })
------------------------^
   136 |  .then(function(versions) {
   137 |    return findVersion(versions, matching);

Missing space before opening round brace at ./index.js :
   134 |  return Promise.resolve()
   135 |  .then(function() { return listVersions(); })
   136 |  .then(function(versions) {
------------------------^
   137 |    return findVersion(versions, matching);
   138 |  });

Missing space before opening round brace at ./index.js :
   145 | * @return {Promise}
   146 | */
   147 |var match = function(version) {
----------------------------^
   148 |  return Promise.resolve()
   149 |  .then(function() { return installedVersion(version); })

Missing space before opening round brace at ./index.js :
   147 |var match = function(version) {
   148 |  return Promise.resolve()
   149 |  .then(function() { return installedVersion(version); })
------------------------^
   150 |  .then(function(use) {
   151 |    var command = util.format('nvm use %s > /dev/null;', use);

Missing space before opening round brace at ./index.js :
   148 |  return Promise.resolve()
   149 |  .then(function() { return installedVersion(version); })
   150 |  .then(function(use) {
------------------------^
   151 |    var command = util.format('nvm use %s > /dev/null;', use);
   152 |    var result = { version: use, command: command };
@ljharb
Copy link

ljharb commented Nov 13, 2017

(avn may want to move to eslint; jshint isn't up to par anymore)

@duckontheweb
Copy link
Contributor Author

Sorry, I misinterpreted this. It's actually jscs that is raising the errors.

@duckontheweb
Copy link
Contributor Author

It looks like all of the issues being caught by jscs run counter to the overall coding style of that plugin. Since jshint is running against this code already, maybe it makes sense to just turn off jscs and only use jshint (or update to eslint).

@ljharb
Copy link

ljharb commented Nov 15, 2017

jscs is also deprecated; its team and rules were absorbed into eslint over a year ago.

@duckontheweb
Copy link
Contributor Author

@wbyoung if this is something you want to do I can put in another PR once I’m done with the alias work

Sent with GitHawk

wbyoung added a commit to wbyoung/avn-nvm that referenced this issue Nov 18, 2017
This fixes the failures in noted in wbyoung/avn#66, but is really just a
temporary solution before moving to ESLint.
@wbyoung
Copy link
Owner

wbyoung commented Nov 18, 2017

@duckontheweb yes, it'd be great to have avn, avn-nvm, and avn-n updated to ESLint. Along the same lines, I've also been thinking about using babel to allow async/await and clean up the code base.

If you're interested in making those changes, the help would be much appreciated! 😄

@duckontheweb
Copy link
Contributor Author

Definitely. I'll open up separate issues for each of these.

@wbyoung
Copy link
Owner

wbyoung commented Nov 20, 2017

Resolved by wbyoung/avn-nvm@fd47799, but @duckontheweb is also working on transitioning to ESLint.

See #67.

@wbyoung wbyoung closed this as completed Nov 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants