Skip to content

Commit 7058267

Browse files
BridgeARrefack
authored andcommitted
tools: fix eslint usage for Node.js 8 and before
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>
1 parent e167a9e commit 7058267

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

.eslintrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ Module._findPath = (request, paths, isMain) => {
1717
if (!r && hacks.includes(request)) {
1818
try {
1919
return require.resolve(`./tools/node_modules/${request}`);
20-
} catch {
20+
// Keep the variable in place to ensure that ESLint started by older Node.js
21+
// versions work as expected.
22+
// eslint-disable-next-line no-unused-vars
23+
} catch (e) {
2124
return require.resolve(
2225
`./tools/node_modules/eslint/node_modules/${request}`);
2326
}

0 commit comments

Comments
 (0)