ESLint plugin with rules specific to Google Maps Platform JavaScript API.
Available via npm as the package eslint-plugin-googlemaps.
npm i -D eslint-plugin-googlemaps
To use rules provided by the plugin, use the following:
eslintrc.json
:
{
"extends": ["plugin:googlemaps:recommended"]
"plugins": ["googlemaps"],
}
Some rules are fixable with eslint --fix
. For example the place-fields rule.
service.getDetails({place_id: 'foo'})
becomes
service.getDetails({fields: /** TODO: Add necessary fields to the request */ [], place_id: 'foo'})
Rule | Description | Configurations | Type |
---|---|---|---|
no-api-keys | Keep API keys out of code. | ||
place-fields | Always use place fields. | ||
require-js-api-loader | Require @googlemaps/js-api-loader. |