Skip to content

Commit

Permalink
chore: remove place_id from getDetails fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoehnelt committed Dec 22, 2021
1 parent 08b55c8 commit 257e1ec
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ service.getDetails({place_id: 'foo'})
becomes

```js
service.getDetails({fields: /** TODO: Add necessary fields to the request */ ['place_id'], place_id: 'foo'})
service.getDetails({fields: /** TODO: Add necessary fields to the request */ [], place_id: 'foo'})
```

## Rules
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/place-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ const service = new google.maps.places.Autocomplete(null, {fields: ['place_id']}
🔧 Examples of code **fixed** by this rule:
```js
const service = new google.maps.places.PlacesService(); /**/ const service = new google.maps.places.PlacesService();
service.getDetails({place_id: 'foo'}) /**/ service.getDetails({fields: /** TODO: Add necessary fields to the request */ ['place_id'], place_id: 'foo'})
service.getDetails({place_id: 'foo'}) /**/ service.getDetails({fields: /** TODO: Add necessary fields to the request */ [], place_id: 'foo'})

const service = new google.maps.places.PlacesService(); /**/ const service = new google.maps.places.PlacesService();
service.getDetails({...{place_id: 'foo'}}) /**/ service.getDetails({fields: /** TODO: Add necessary fields to the request */ ['place_id'], ...{place_id: 'foo'}})
service.getDetails({...{place_id: 'foo'}}) /**/ service.getDetails({fields: /** TODO: Add necessary fields to the request */ [], ...{place_id: 'foo'}})
```

## Resources
Expand Down
4 changes: 2 additions & 2 deletions src/rules/place-fields.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ service.getDetails(buildRequest())`,
service.getDetails({place_id: 'foo'})`,
errors: [{ messageId }],
output: `const service = new google.maps.places.PlacesService();
service.getDetails({fields: /** TODO: Add necessary fields to the request */ ['place_id'], place_id: 'foo'})`,
service.getDetails({fields: /** TODO: Add necessary fields to the request */ [], place_id: 'foo'})`,
},
{
code: `const service = new google.maps.places.PlacesService();
Expand All @@ -61,7 +61,7 @@ service.getDetails(request)`,
service.getDetails({...{place_id: 'foo'}})`,
errors: [{ messageId }],
output: `const service = new google.maps.places.PlacesService();
service.getDetails({fields: /** TODO: Add necessary fields to the request */ ['place_id'], ...{place_id: 'foo'}})`,
service.getDetails({fields: /** TODO: Add necessary fields to the request */ [], ...{place_id: 'foo'}})`,
},
// Autocomplete
{
Expand Down
2 changes: 1 addition & 1 deletion src/rules/place-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default createRule({
context
.getSourceCode()
.getTokens(requestArgument)[1],
`fields: /** TODO: Add necessary fields to the request */ ['place_id'], `
`fields: /** TODO: Add necessary fields to the request */ [], `
),
];
}
Expand Down

0 comments on commit 257e1ec

Please sign in to comment.