-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(README): add per rule docs (#26)
- Loading branch information
Showing
14 changed files
with
377 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
docPath: "docs/rules/{name}.md", | ||
rulePath: "src/rules/{name}.ts", | ||
testPath: "src/rules/{name}.test.ts", | ||
// fixCodeExamples doesn't work with ESLint 8.0.0 https://github.com/wikimedia/eslint-docgen/issues/126 | ||
fixCodeExamples: false, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
node_modules | ||
dist/ | ||
.npmrc | ||
**/docs | ||
|
||
# Logs | ||
logs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[//]: # (This file is generated by eslint-docgen. Do not edit it directly.) | ||
|
||
# no-api-keys | ||
|
||
Avoid placing API keys in source code. Instead use build tools that insert the API key using environment variables similar to: | ||
|
||
```js | ||
const apiKey = process.env.GOOGLE_MAPS_API_KEY; | ||
``` | ||
|
||
This pattern enables use of development keys and prevents use of production keys that may have higher quotas. | ||
|
||
📋 This rule is enabled in `plugin:googlemaps/recommended`. | ||
|
||
## Rule details | ||
|
||
❌ Examples of **incorrect** code: | ||
```js | ||
const apiKey = "AIza00000000000000000000000000000000000"; | ||
``` | ||
|
||
✔️ Examples of **correct** code: | ||
```js | ||
const apiKey = process.env.GOOGLE_MAPS_API_KEY; | ||
const apiKey = "YOUR_API_KEY"; | ||
const apiKey = "AIzaSomeStringThatDoesntMatch"; | ||
``` | ||
|
||
## Resources | ||
|
||
* [Rule source](/src/rules/no-api-keys.ts) | ||
* [Test source](/src/rules/no-api-keys.test.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[//]: # (This file is generated by eslint-docgen. Do not edit it directly.) | ||
|
||
# place-fields | ||
|
||
Use the `fields` option to limit the fields returned by the API and costs. Request to the Places API are billed by the fields that are returned. See [data-skus](https://developers.google.com/maps/documentation/places/web-service/usage-and-billing#data-skus) for more details. | ||
> **Note**: This rule is not exhaustive and ignores `Autocomplete.setFields()`. | ||
📋 This rule is enabled in `plugin:googlemaps/recommended`. | ||
|
||
## Rule details | ||
|
||
❌ Examples of **incorrect** code: | ||
```js | ||
const service = new google.maps.places.PlacesService(); | ||
const request = {place_id: 'foo'}; | ||
service.getDetails(request) | ||
|
||
const service = new google.maps.places.PlacesService(); | ||
service.getDetails({}) | ||
|
||
const service = new google.maps.places.PlacesService(); | ||
service.getDetails({...{bar: 'foo'}}) | ||
|
||
const service = new google.maps.places.Autocomplete(null, {}); | ||
const service = new google.maps.places.Autocomplete(null); | ||
``` | ||
|
||
✔️ Examples of **correct** code: | ||
```js | ||
const service = new google.maps.places.PlacesService(); | ||
const request = {place_id: 'foo', fields: ['place_id']}; | ||
service.getDetails(request) | ||
|
||
const service = new google.maps.places.PlacesService(); | ||
service.getDetails({place_id: 'foo', fields: ['place_id']}) | ||
|
||
const service = new google.maps.places.PlacesService(); | ||
service.getDetails({...{place_id: 'foo', fields: ['place_id']}}) | ||
|
||
const service = new google.maps.places.PlacesService(); | ||
service.getDetails({...{place_id: 'foo', 'fields': ['place_id']}}) | ||
|
||
const service = new google.maps.places.PlacesService(); | ||
const buildRequest = () => {}; | ||
service.getDetails(buildRequest()) | ||
|
||
const service = new google.maps.places.Autocomplete(null, {fields: ['place_id']}); | ||
``` | ||
|
||
## Resources | ||
|
||
* [Rule source](/src/rules/place-fields.ts) | ||
* [Test source](/src/rules/place-fields.test.ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.