Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 836 Bytes

require-js-api-loader.md

File metadata and controls

27 lines (18 loc) · 836 Bytes

require-js-api-loader

Require usage of @googlemaps/js-api-loader to dynamically load the Google Maps API.

📋 This rule is enabled in plugin:googlemaps/recommended.

Rule details

❌ Examples of incorrect code:

const script = document.createElement('script');
script.src = 'https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap';

const url = 'https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap';

✔️ Examples of correct code:

script.src = 'https://example.com'  // some other script hostname

Resources