Skip to content

Commit

Permalink
tools: fix eslint usage for Node.js 8 and before
Browse files Browse the repository at this point in the history
IDEs like vscode use older Node.js versions that do not yet support
the new try catch syntax. This makes sure eslint continues to work
in these IDEs as before.

PR-URL: nodejs#24753
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
BridgeAR authored and refack committed Jan 10, 2019
1 parent e167a9e commit 7058267
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ Module._findPath = (request, paths, isMain) => {
if (!r && hacks.includes(request)) {
try {
return require.resolve(`./tools/node_modules/${request}`);
} catch {
// Keep the variable in place to ensure that ESLint started by older Node.js
// versions work as expected.
// eslint-disable-next-line no-unused-vars
} catch (e) {
return require.resolve(
`./tools/node_modules/eslint/node_modules/${request}`);
}
Expand Down

0 comments on commit 7058267

Please sign in to comment.