Skip to content

Commit

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

* npm run lint:fix

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Keegan Campbell <[email protected]>
  • Loading branch information
renovate[bot] and kfcampbell authored Jul 6, 2023
1 parent bc2ff68 commit 76f81e8
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type listUserReposParameters =
type listUserReposResponse = Endpoints["GET /repos/{owner}/{repo}"]["response"];

async function listRepos(
options: listUserReposParameters
options: listUserReposParameters,
): listUserReposResponse["data"] {
// ...
}
Expand Down
27 changes: 21 additions & 6 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 @@ -39,7 +39,7 @@
"lodash.set": "^4.3.2",
"npm-run-all": "^4.1.5",
"pascal-case": "^3.1.1",
"prettier": "^2.0.0",
"prettier": "^3.0.0",
"semantic-release": "^21.0.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"sort-keys": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-endpoints/fetch-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ async function main() {
path.resolve(__dirname, "generated", "endpoints.json"),
prettier.format(JSON.stringify(endpoints), {
parser: "json",
})
}),
);
}
12 changes: 6 additions & 6 deletions scripts/update-endpoints/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ const ENDPOINTS_PATH = resolve(
process.cwd(),
"src",
"generated",
"Endpoints.ts"
"Endpoints.ts",
);
const ENDPOINTS_TEMPLATE_PATH = resolve(
process.cwd(),
"scripts",
"update-endpoints",
"templates",
"endpoints.ts.template"
"endpoints.ts.template",
);

const template = Handlebars.compile(
readFileSync(ENDPOINTS_TEMPLATE_PATH, "utf8")
readFileSync(ENDPOINTS_TEMPLATE_PATH, "utf8"),
);

const endpointsByRoute = {};
Expand All @@ -46,15 +46,15 @@ async function run() {
const { alias, name } = parameter;
const deprecatedRoute = route.replace(
new RegExp(`\\{${alias}\\}`),
`{${name}}`
`{${name}}`,
);

endpointsByRoute[deprecatedRoute] = Object.assign(
{},
endpointsByRoute[route],
{
deprecated: `"${name}" is now "${alias}"`,
}
},
);
}
}
Expand All @@ -65,7 +65,7 @@ async function run() {

writeFileSync(
ENDPOINTS_PATH,
prettier.format(result, { parser: "typescript" })
prettier.format(result, { parser: "typescript" }),
);
console.log(`${ENDPOINTS_PATH} updated.`);
}
Expand Down
11 changes: 6 additions & 5 deletions src/AuthInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { Route } from "./Route";
*/
export interface AuthInterface<
AuthOptions extends any[],
Authentication extends any
Authentication extends any,
> {
(...args: AuthOptions): Promise<Authentication>;

Expand All @@ -24,9 +24,10 @@ export interface AuthInterface<
*
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<T = any>(request: RequestInterface, options: EndpointOptions): Promise<
OctokitResponse<T>
>;
<T = any>(
request: RequestInterface,
options: EndpointOptions,
): Promise<OctokitResponse<T>>;

/**
* Sends a request using the passed `request` instance
Expand All @@ -37,7 +38,7 @@ export interface AuthInterface<
<T = any>(
request: RequestInterface,
route: Route,
parameters?: RequestParameters
parameters?: RequestParameters,
): Promise<OctokitResponse<T>>;
};
}
16 changes: 8 additions & 8 deletions src/EndpointInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface EndpointInterface<D extends object = object> {
<O extends RequestParameters = RequestParameters>(
options: O & { method?: string } & ("url" extends keyof D
? { url?: string }
: { url: string })
: { url: string }),
): RequestOptions & Pick<D & O, keyof RequestOptions>;

/**
Expand All @@ -27,10 +27,10 @@ export interface EndpointInterface<D extends object = object> {
R extends Route,
P extends RequestParameters = R extends keyof Endpoints
? Endpoints[R]["parameters"] & RequestParameters
: RequestParameters
: RequestParameters,
>(
route: keyof Endpoints | R,
parameters?: P
parameters?: P,
): (R extends keyof Endpoints ? Endpoints[R]["request"] : RequestOptions) &
Pick<P, keyof RequestOptions>;

Expand All @@ -43,7 +43,7 @@ export interface EndpointInterface<D extends object = object> {
* Returns a new `endpoint` interface with new defaults
*/
defaults: <O extends RequestParameters = RequestParameters>(
newDefaults: O
newDefaults: O,
) => EndpointInterface<D & O>;

merge: {
Expand All @@ -59,10 +59,10 @@ export interface EndpointInterface<D extends object = object> {
R extends Route,
P extends RequestParameters = R extends keyof Endpoints
? Endpoints[R]["parameters"] & RequestParameters
: RequestParameters
: RequestParameters,
>(
route: keyof Endpoints | R,
parameters?: P
parameters?: P,
): D &
(R extends keyof Endpoints
? Endpoints[R]["request"] & Endpoints[R]["parameters"]
Expand All @@ -76,7 +76,7 @@ export interface EndpointInterface<D extends object = object> {
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<P extends RequestParameters = RequestParameters>(
options: P
options: P,
): EndpointDefaults & D & P;

/**
Expand All @@ -94,6 +94,6 @@ export interface EndpointInterface<D extends object = object> {
* @param {object} options `method`, `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
parse: <O extends EndpointDefaults = EndpointDefaults>(
options: O
options: O,
) => RequestOptions & Pick<O, keyof RequestOptions>;
}
6 changes: 3 additions & 3 deletions src/RequestInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface RequestInterface<D extends object = object> {
<T = any, O extends RequestParameters = RequestParameters>(
options: O & { method?: string } & ("url" extends keyof D
? { url?: string }
: { url: string })
: { url: string }),
): Promise<OctokitResponse<T>>;

/**
Expand All @@ -27,7 +27,7 @@ export interface RequestInterface<D extends object = object> {
route: keyof Endpoints | R,
options?: R extends keyof Endpoints
? Endpoints[R]["parameters"] & RequestParameters
: RequestParameters
: RequestParameters,
): R extends keyof Endpoints
? Promise<Endpoints[R]["response"]>
: Promise<OctokitResponse<any>>;
Expand All @@ -36,7 +36,7 @@ export interface RequestInterface<D extends object = object> {
* Returns a new `request` with updated route and parameters
*/
defaults: <O extends RequestParameters = RequestParameters>(
newDefaults: O
newDefaults: O,
) => RequestInterface<D & O>;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/StrategyInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { AuthInterface } from "./AuthInterface";
export interface StrategyInterface<
StrategyOptions extends any[],
AuthOptions extends any[],
Authentication extends object
Authentication extends object,
> {
(...args: StrategyOptions): AuthInterface<AuthOptions, Authentication>;
}

0 comments on commit 76f81e8

Please sign in to comment.