Skip to content

Commit

Permalink
chore(deps): update dependency prettier to v3 (#543)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency prettier to v3

* style: prettier

* Empty commit to trigger test run

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Create or Update Pull Request Action <create-or-update-pull-request@users.noreply.github.com>
Co-authored-by: Keegan Campbell <me@kfcampbell.com>
  • Loading branch information
3 people committed Jul 6, 2023
1 parent a5a14bb commit 44d8b93
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 95 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const issueTitles = await octokit.paginate(
since: "2010-10-01",
per_page: 100,
},
(response) => response.data.map((issue) => issue.title)
(response) => response.data.map((issue) => issue.title),
);
```

Expand All @@ -110,7 +110,7 @@ const issues = await octokit.paginate(
done();
}
return response.data;
}
},
);
```

Expand Down Expand Up @@ -138,7 +138,7 @@ const parameters = {
};
for await (const response of octokit.paginate.iterator(
"GET /repos/{owner}/{repo}/issues",
parameters
parameters,
)) {
// do whatever you want with each response, break out of the loop, etc.
const issues = response.data;
Expand All @@ -157,7 +157,7 @@ const parameters = {
};
for await (const response of octokit.paginate.iterator(
octokit.rest.issues.listForRepo,
parameters
parameters,
)) {
// do whatever you want with each response, break out of the loop, etc.
const issues = response.data;
Expand Down Expand Up @@ -235,7 +235,7 @@ type DataType<T> = "data" extends keyof T ? T["data"] : unknown;
async function myPaginatePlugin<E extends keyof PaginatingEndpoints>(
octokit: Octokit,
endpoint: E,
parameters?: PaginatingEndpoints[E]["parameters"]
parameters?: PaginatingEndpoints[E]["parameters"],
): Promise<DataType<PaginatingEndpoints[E]["response"]>> {
return await composePaginateRest(octokit, endpoint, parameters);
}
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"glob": "^10.2.5",
"jest": "^29.0.0",
"npm-run-all": "^4.1.5",
"prettier": "2.8.8",
"prettier": "3.0.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions src/iterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
export function iterator(
octokit: Octokit,
route: Route | RequestInterface,
parameters?: RequestParameters
parameters?: RequestParameters,
) {
const options =
typeof route === "function"
Expand All @@ -35,7 +35,7 @@ export function iterator(
// '<https://github.com/gitapi/users/aseemk/followers?page=2>; rel="next", <https://github.com/gitapi/users/aseemk/followers?page=2>; rel="last"'
// sets `url` to undefined if "next" URL is not present or `link` header is not set
url = ((normalizedResponse.headers.link || "").match(
/<([^>]+)>;\s*rel="next"/
/<([^>]+)>;\s*rel="next"/,
) || [])[1];

return { value: normalizedResponse };
Expand Down
2 changes: 1 addition & 1 deletion src/normalize-paginated-list-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import type { OctokitResponse } from "./types";

export function normalizePaginatedListResponse(
response: OctokitResponse<any>
response: OctokitResponse<any>,
): OctokitResponse<any> {
// endpoints can respond with 204 if repository is empty
if (!response.data) {
Expand Down
8 changes: 4 additions & 4 deletions src/paginate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function paginate(
octokit: Octokit,
route: Route | RequestInterface,
parameters?: RequestParameters,
mapFn?: MapFunction
mapFn?: MapFunction,
) {
if (typeof parameters === "function") {
mapFn = parameters;
Expand All @@ -26,15 +26,15 @@ export function paginate(
iterator(octokit, route, parameters)[
Symbol.asyncIterator
]() as AsyncIterableIterator<any>,
mapFn
mapFn,
);
}

function gather(
octokit: Octokit,
results: PaginationResults,
iterator: AsyncIterableIterator<any>,
mapFn?: MapFunction
mapFn?: MapFunction,
): Promise<PaginationResults> {
return iterator.next().then((result) => {
if (result.done) {
Expand All @@ -47,7 +47,7 @@ function gather(
}

results = results.concat(
mapFn ? mapFn(result.value, done) : result.value.data
mapFn ? mapFn(result.value, done) : result.value.data,
);

if (earlyExit) {
Expand Down
2 changes: 1 addition & 1 deletion src/paginating-endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
export { paginatingEndpoints } from "./generated/paginating-endpoints";

export function isPaginatingEndpoint(
arg: unknown
arg: unknown,
): arg is keyof PaginatingEndpoints {
if (typeof arg === "string") {
return paginatingEndpoints.includes(arg as keyof PaginatingEndpoints);
Expand Down
Loading

0 comments on commit 44d8b93

Please sign in to comment.