Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Intl to globals in @react-native-community/eslint-config #27076

Closed
StasD opened this issue Oct 31, 2019 · 0 comments
Closed

Add Intl to globals in @react-native-community/eslint-config #27076

StasD opened this issue Oct 31, 2019 · 0 comments
Labels
Bug Resolution: Locked This issue was locked by the bot.

Comments

@StasD
Copy link

StasD commented Oct 31, 2019

In this package: https://github.com/facebook/react-native/tree/master/packages/eslint-config-react-native-community
you probably need to add Intl to globals as eslint complains about its use and for whatever reason it is not included by default. For now, I added it to my own config file.

React Native version:
System:
OS: macOS 10.15
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Memory: 152.51 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.13.0 - /usr/local/bin/node
Yarn: 1.19.1 - /usr/local/bin/yarn
npm: 6.12.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 27, 28, 29
Build Tools: 27.0.3, 28.0.3, 29.0.2
System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.3 => 0.61.3

Steps To Reproduce

  1. I'm getting Intl underlined by the editor with this comment: 'Intl' is not defined. eslint(no-undef)

In a function e.g.

function formatPrice(localeCode, currency, price) {
  if (typeof price === 'number' && isFinite(price)) {
    return new Intl.NumberFormat(localeCode, {style: 'currency', currency}).format(price);
  }

  return '';
}

Describe what you expected to happen:

There should be no complains by eslint when I use Intl.

I also raised this issue on ESLint's github: eslint/eslint#12515

@StasD StasD added the Bug label Oct 31, 2019
facebook-github-bot pushed a commit that referenced this issue Nov 4, 2019
Summary:
Fix `'Intl' is not defined. eslint(no-undef)` warning by eslint: see #27076
Pull Request resolved: #27082

Differential Revision: D18298548

Pulled By: cpojer

fbshipit-source-id: c07af711086d79d214bfbbe2bba6f396628c96c1
@StasD StasD closed this as completed Nov 4, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Oct 2, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants