Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency prettier to v3 #656

Merged
merged 5 commits into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 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 @@ -44,7 +44,7 @@
"lodash.upperfirst": "^4.3.1",
"mustache": "^4.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",
"sort-keys": "^4.2.0",
"string-to-jsdoc-comment": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-endpoints/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async function generateRoutes() {

writeFileSync(
ROUTES_PATH,
prettier.format(
await prettier.format(
`import type { EndpointsDefaultsAndDecorations } from "../types";
const Endpoints: EndpointsDefaultsAndDecorations = ${JSON.stringify(
sortKeys(newRoutes, { deep: true })
Expand Down
6 changes: 3 additions & 3 deletions scripts/update-endpoints/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ async function generateRoutes() {

for (const endpoint of endpoints) {
const path = `docs/${endpoint.scope}/${endpoint.id}.md`;
outputFileSync(path, template(endpoint));
outputFileSync(path, await template(endpoint));
console.log(`${path} written`);
}
}

function template(endpoint) {
async function template(endpoint) {
const deprecationNotice = endpoint.isDeprecated
? "**This method is deprecated.**"
: "";
Expand Down Expand Up @@ -96,7 +96,7 @@ ${parameters}

See also: [GitHub Developer Guide documentation](${endpoint.documentationUrl}).`;

return prettier.format(content, {
return await prettier.format(content, {
parser: "markdown",
});
}
2 changes: 1 addition & 1 deletion scripts/update-endpoints/fetch-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async function main() {

writeFileSync(
path.resolve(__dirname, "generated", "endpoints.json"),
prettier.format(JSON.stringify(endpoints), {
await prettier.format(JSON.stringify(endpoints), {
parser: "json",
})
);
Expand Down
4 changes: 2 additions & 2 deletions scripts/update-endpoints/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function generateTypes() {
}`);
}

const methodTypesSource = prettier.format(
const methodTypesSource = await prettier.format(
[
`import type { EndpointInterface, RequestInterface } from "@octokit/types";`,
`import type { RestEndpointMethodTypes } from "./parameters-and-response-types";`,
Expand All @@ -93,7 +93,7 @@ async function generateTypes() {
parser: "typescript",
}
);
const parametersAndResponsesTypes = prettier.format(
const parametersAndResponsesTypes = await prettier.format(
[
`import type { Endpoints, RequestParameters } from "@octokit/types";`,
"",
Expand Down
12 changes: 6 additions & 6 deletions src/endpoints-to-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ for (const [scope, endpoints] of Object.entries(ENDPOINTS)) {
method,
url,
},
defaults
defaults,
);

if (!endpointMethodsMap.has(scope)) {
Expand Down Expand Up @@ -63,7 +63,7 @@ const handler = {
scope,
methodName,
endpointDefaults,
decorations
decorations,
);
} else {
cache[methodName] = octokit.request.defaults(endpointDefaults);
Expand All @@ -88,7 +88,7 @@ function decorate(
scope: string,
methodName: string,
defaults: EndpointOptions,
decorations: EndpointDecorations
decorations: EndpointDecorations,
) {
const requestWithDefaults = octokit.request.defaults(defaults);

Expand All @@ -111,7 +111,7 @@ function decorate(
if (decorations.renamed) {
const [newScope, newMethodName] = decorations.renamed;
octokit.log.warn(
`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`
`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`,
);
}
if (decorations.deprecated) {
Expand All @@ -123,11 +123,11 @@ function decorate(
const options = requestWithDefaults.endpoint.merge(...args);

for (const [name, alias] of Object.entries(
decorations.renamedParameters
decorations.renamedParameters,
)) {
if (name in options) {
octokit.log.warn(
`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`
`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`,
);
if (!(alias in options)) {
options[alias] = options[name];
Expand Down
2 changes: 1 addition & 1 deletion test/issues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("https://github.com/octokit/plugin-rest-endpoint-methods.js/issues/83",
},
},
},
}
},
);

const MyOctokit = Octokit.plugin(restEndpointMethods);
Expand Down
10 changes: 5 additions & 5 deletions test/rest-endpoint-methods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("REST API endpoint methods", () => {
body: {
name: "my-new-repo",
},
}
},
);

const MyOctokit = Octokit.plugin(restEndpointMethods);
Expand Down Expand Up @@ -61,7 +61,7 @@ describe("REST API endpoint methods", () => {
expect(body).toEqual("# Hello, world!");
return true;
},
}
},
);

const MyOctokit = Octokit.plugin(restEndpointMethods);
Expand Down Expand Up @@ -98,7 +98,7 @@ describe("REST API endpoint methods", () => {
expect(body).toEqual("test 1, 2");
return true;
},
}
},
);

const MyOctokit = Octokit.plugin(restEndpointMethods);
Expand Down Expand Up @@ -134,7 +134,7 @@ describe("REST API endpoint methods", () => {
{ ok: true },
{
body: ["myci1", "myci2"],
}
},
);

const MyOctokit = Octokit.plugin(restEndpointMethods);
Expand Down Expand Up @@ -187,7 +187,7 @@ describe("REST API endpoint methods", () => {
body: {
name: "my-new-repo",
},
}
},
);

const MyOctokit = Octokit.plugin(legacyRestEndpointMethods);
Expand Down
4 changes: 2 additions & 2 deletions test/typescript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("Smoke test", () => {
return updateLabel(options);

async function updateLabel(
_: RestEndpointMethodTypes["issues"]["updateLabel"]["parameters"]
_: RestEndpointMethodTypes["issues"]["updateLabel"]["parameters"],
): Promise<RestEndpointMethodTypes["issues"]["updateLabel"]["response"]> {
return {
headers: {},
Expand Down Expand Up @@ -47,7 +47,7 @@ describe("Smoke test", () => {

expect(requestOptions.method).toEqual("GET");
expect(requestOptions.url).toEqual(
"https://api.github.com/repos/foo/bar/contents/path%2Fto%2Fbinary%2Ffile"
"https://api.github.com/repos/foo/bar/contents/path%2Fto%2Fbinary%2Ffile",
);
});

Expand Down