Skip to content

Commit

Permalink
fix(eslint-plugin): [unbound-method] fix crash due to missing Intl (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eeeee committed May 25, 2020
1 parent 014341b commit f2fa82c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/eslint-plugin/src/rules/unbound-method.ts
Expand Up @@ -82,6 +82,11 @@ const SUPPORTED_GLOBALS = [
'Intl',
] as const;
const nativelyBoundMembers = SUPPORTED_GLOBALS.map(namespace => {
if (!(namespace in global)) {
// node.js might not have namespaces like Intl depending on compilation options
// https://nodejs.org/api/intl.html#intl_options_for_building_node_js
return [];
}
const object = global[namespace];
return Object.getOwnPropertyNames(object)
.filter(
Expand Down

0 comments on commit f2fa82c

Please sign in to comment.