#3673·jshint

jshint throws a DeprecationWarning - Passing invalid argument types to fs.existsSync is deprecated

Author: DinoChiesaCreated Mar 1, 2026Updated Mar 1, 2026

The stacktrace is:

(node:1524) [DEP0187] DeprecationWarning: Passing invalid argument types to fs.existsSync is deprecated
    at Object.existsSync (node:fs:281:15)
    at exports.exists (/home/me/dev/myproj/node_modules/jshint/src/fs-utils.js:13:13)
    at getHomeDir (/home/me/dev/myproj/node_modules/jshint/src/cli.js:111:17)
    at findConfig (/home/me/dev/myproj/node_modules/jshint/src/cli.js:82:14)
    at Object.getConfig (/home/me/dev/myproj/node_modules/jshint/src/cli.js:518:52)
    ...

It is apparently in the cli.js logic that is resolving the home directory.

This seems to throw only on Linux.

Diagnosis showed this code:

function getHomeDir() {
  var homePath = "";
  var environment = global.process.env;
  var paths = [
    environment.USERPROFILE,
    environment.HOME,
    environment.HOMEPATH,
    environment.HOMEDRIVE + environment.HOMEPATH
  ];

  while (paths.length) {
    homePath = paths.shift();
    if (fsUtils.exists(homePath)) {
      return homePath;
    }
  }
}

fsUtils.exists() eventually calls fs.existsSync which triggers the DeprecationWarning. This will happen when environment.USERPROFILE does not exist ...which is typical on Linux.