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: #24753
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
BridgeAR committed Dec 5, 2018
1 parent 807c108 commit 09cd2ec
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 09cd2ec

Please sign in to comment.