Skip to content

Commit cbef9d1

Browse files
chore(deps): update dependency prettier to v3 (#2062)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Nicholas Lim <[email protected]>
1 parent 1306a4a commit cbef9d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3984
-4258
lines changed

.github/workflows/test.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ jobs:
2020
- name: Install Task
2121
run: curl -sL https://taskfile.dev/install.sh | sudo bash -s -- -b /usr/local/bin/
2222

23+
- name: Lint
24+
run: task default lint
25+
2326
- name: Test
2427
run: task default test

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
projects/optic/src/__tests__/integration/workspaces

.prettierrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"semi": true,
33
"singleQuote": true,
4-
"arrowParens": "always"
4+
"arrowParens": "always",
5+
"trailingComma": "es5"
56
}

Taskfile.yml

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ tasks:
2929
cmds:
3030
- yarn workspaces foreach -pv --no-private run clean
3131

32+
lint:
33+
desc: Lint
34+
cmds:
35+
- yarn run lint
36+
3237
test:
3338
desc: Test
3439
cmds:

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
"scripts": {
1717
"release": "gh release create --target=$(git branch --show-current) v$(node -e \"process.stdout.write(require('./package.json').version)\")",
1818
"version": "yarn workspaces foreach -v version",
19-
"prepare": "husky install"
19+
"prepare": "husky install",
20+
"lint": "prettier --check 'projects/*/src/**/*.(js|jsx|ts|tsx|json|css)'"
2021
},
2122
"devDependencies": {
22-
"@types/prettier": "^2",
2323
"husky": "^8.0.0",
2424
"lint-staged": "^13.1.0",
25-
"prettier": "^2.8.1"
25+
"prettier": "^3.0.0"
2626
},
2727
"lint-staged": {
2828
"**/*.+(js|jsx|ts|tsx|json|css)": [

projects/json-pointer-helpers/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@types/node": "^18.0.0",
2626
"babel-jest": "^29.3.1",
2727
"jest": "^29.3.1",
28-
"prettier": "^2.8.1",
28+
"prettier": "^3.0.0",
2929
"ts-jest": "^29.0.3",
3030
"ts-node": "^10.9.1",
3131
"typescript": "^5.0.0"
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import jsonPointerHelpers from "./json-pointers/json-pointer-helpers";
1+
import jsonPointerHelpers from './json-pointers/json-pointer-helpers';
22
export { jsonPointerHelpers };

projects/openapi-io/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@types/semver": "^7.3.10",
3232
"babel-jest": "^29.3.1",
3333
"jest": "^29.3.1",
34-
"prettier": "^2.8.1",
34+
"prettier": "^3.0.0",
3535
"ts-jest": "^29.0.3",
3636
"ts-node": "^10.9.1",
3737
"typescript": "^5.0.0"

projects/openapi-io/src/write/yaml-roundtrip.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function applyOperationsToYamlString(
5959
}
6060
});
6161

62-
return doc.toString({collectionStyle: 'block'});
62+
return doc.toString({ collectionStyle: 'block' });
6363
}
6464

6565
function insert<T>(arr: T[], index: number, item: any) {

projects/openapi-utilities/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@types/node": "^18.0.0",
3333
"babel-jest": "^29.3.1",
3434
"jest": "^29.3.1",
35-
"prettier": "^2.8.1",
35+
"prettier": "^3.0.0",
3636
"ts-jest": "^29.0.3",
3737
"ts-node": "^10.9.1",
3838
"typescript": "^5.0.0"

projects/openapi-utilities/src/diff/array-identifiers.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export const isParameterObject = (value: any): value is { name: string; in: string } =>
1+
export const isParameterObject = (
2+
value: any
3+
): value is { name: string; in: string } =>
24
typeof value === 'object' &&
35
!Array.isArray(value) &&
46
value !== null &&

projects/openapi-utilities/src/diff/diff.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type StackItem<T extends JSONObject | JSONArray = JSONObject | JSONArray> = [
4848
{
4949
value: T;
5050
path: string;
51-
}
51+
},
5252
];
5353

5454
export function typeofDiff(

projects/openapi-utilities/src/openapi3/__tests__/fact-mock.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IFact } from "../sdk/types";
1+
import { IFact } from '../sdk/types';
22

33
export const FactsMock = [
44
{

projects/openapi-utilities/src/openapi3/implementations/openapi3/sourcemap-reader.ts

+18-15
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,24 @@ export function resolveJsonPointerInYamlAst(
2525

2626
if (isEmpty) return node;
2727

28-
const found: YAMLNode | undefined = decoded.reduce((current, path) => {
29-
if (!current) return undefined;
30-
const node: YAMLNode = current.key ? current.value : current;
31-
const isNumericalKey =
32-
!isNaN(Number(path)) && (node as any).hasOwnProperty('items');
33-
34-
if (isNumericalKey) {
35-
return (node as YAMLSequence).items[Number(path)];
36-
} else {
37-
const field = node.mappings.find(
38-
(i: YAMLMapping) => i.key.value === path
39-
);
40-
return field;
41-
}
42-
}, node as YAMLNode | undefined);
28+
const found: YAMLNode | undefined = decoded.reduce(
29+
(current, path) => {
30+
if (!current) return undefined;
31+
const node: YAMLNode = current.key ? current.value : current;
32+
const isNumericalKey =
33+
!isNaN(Number(path)) && (node as any).hasOwnProperty('items');
34+
35+
if (isNumericalKey) {
36+
return (node as YAMLSequence).items[Number(path)];
37+
} else {
38+
const field = node.mappings.find(
39+
(i: YAMLMapping) => i.key.value === path
40+
);
41+
return field;
42+
}
43+
},
44+
node as YAMLNode | undefined
45+
);
4346

4447
return found;
4548
}

projects/openapi-utilities/src/openapi3/sdk/facts-to-changelog.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function factsToChangelog(past: IFact[], current: IFact[]): IChange[] {
5252
location: added.location,
5353
added: added.value,
5454
changeType: ChangeType.Added,
55-
} as IChange)
55+
}) as IChange
5656
);
5757

5858
const removedChanges = removed.map(
@@ -63,7 +63,7 @@ export function factsToChangelog(past: IFact[], current: IFact[]): IChange[] {
6363
before: removed.value,
6464
},
6565
changeType: ChangeType.Removed,
66-
} as IChange)
66+
}) as IChange
6767
);
6868

6969
const changedChanges = updated.map((past) => {

projects/openapi-utilities/src/utilities/sentry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const initSentry = (sentryUrl: string | undefined, version: string) => {
1919

2020
export const wrapActionHandlerWithSentry = <
2121
Args extends any[],
22-
Return extends any
22+
Return extends any,
2323
>(
2424
fn: (...args: Args) => Promise<Return>
2525
): ((...args: Args) => Promise<Return>) => {

projects/optic-ci/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
3939
"dotenv": "^16.0.3",
4040
"jest": "^29.3.1",
41-
"prettier": "^2.8.1",
41+
"prettier": "^3.0.0",
4242
"ts-jest": "^29.0.3",
4343
"ts-node": "^10.9.1",
4444
"typescript": "^5.0.0"

projects/optic-ci/src/cli/clients/gitlab-client.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import urljoin from 'url-join';
44
import { JsonHttpClient } from './JsonHttpClient';
55

66
export class GitlabClient extends JsonHttpClient {
7-
constructor(private baseUrl: string, private authToken: string) {
7+
constructor(
8+
private baseUrl: string,
9+
private authToken: string
10+
) {
811
super();
912
}
1013

projects/optic-ci/src/cli/commands/bulk-compare/__tests__/bulk-compare.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, test, expect, describe } from '@jest/globals'
1+
import { jest, test, expect, describe } from '@jest/globals';
22
import { parseJsonComparisonInput } from '../input-generators';
33
import { loadFile } from '../../utils';
44

projects/optic-ci/src/cli/commands/bulk-compare/__tests__/input-generators.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect, describe } from '@jest/globals'
1+
import { test, expect, describe } from '@jest/globals';
22
import { applyGlobFilters } from '../input-generators';
33

44
describe('applyGlobFilters', () => {

projects/optic-ci/src/cli/commands/compare/__tests__/upload.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, test, expect, beforeEach, afterEach } from '@jest/globals'
1+
import { jest, test, expect, beforeEach, afterEach } from '@jest/globals';
22

33
import { v4 as uuidv4 } from 'uuid';
44

projects/optic-ci/src/cli/commands/create-context/context-readers/github/__tests__/circle-ci.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect, afterAll } from '@jest/globals'
1+
import { test, expect, afterAll } from '@jest/globals';
22
import { UserError } from '@useoptic/openapi-utilities';
33
import { getContextFromCircleCiEnvironment } from '../circle-ci';
44

projects/optic-ci/src/cli/commands/create-context/context-readers/github/__tests__/github-actions.test.ts

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, test, expect, afterAll } from '@jest/globals'
1+
import { jest, test, expect, afterAll } from '@jest/globals';
22
import fs from 'fs/promises';
33
import { UserError } from '@useoptic/openapi-utilities';
44
import { getContextFromGithubEnvironment } from '../github-actions';
@@ -63,21 +63,22 @@ test('get head sha from github context', async () => {
6363
process.env.GITHUB_SHA = 'asdasd';
6464
process.env.GITHUB_REPOSITORY = 'optidev/monorail';
6565
process.env.GITHUB_HEAD_REF = 'feature-1';
66-
mockReadFile.mockImplementation(() =>
67-
Promise.resolve(
68-
Buffer.from(
69-
JSON.stringify({
70-
pull_request: {
71-
head: {
72-
user: {
73-
login: 'lou',
66+
mockReadFile.mockImplementation(
67+
() =>
68+
Promise.resolve(
69+
Buffer.from(
70+
JSON.stringify({
71+
pull_request: {
72+
head: {
73+
user: {
74+
login: 'lou',
75+
},
76+
sha: '7d3736f2b38af7f69fd51e43465fd74375aaca2d',
7477
},
75-
sha: '7d3736f2b38af7f69fd51e43465fd74375aaca2d',
7678
},
77-
},
78-
})
79-
)
80-
) as any
79+
})
80+
)
81+
) as any
8182
);
8283

8384
expect(await getContextFromGithubEnvironment()).toEqual({

projects/optic-ci/src/cli/commands/create-context/context-readers/gitlab/__tests__/gitlab-ci.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect, afterAll } from '@jest/globals'
1+
import { test, expect, afterAll } from '@jest/globals';
22
import { getContextFromGitlabEnvironment } from '../gitlab-ci';
33

44
const originalEnv = {

projects/optic-ci/src/cli/commands/create-context/create-github-context.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const registerCreateContext = (cli: Command, hideCommand: boolean) => {
3535
async ({
3636
provider,
3737
}: {
38-
provider: typeof SUPPORTED_GITHUB_CI_PROVIDERS[number];
38+
provider: (typeof SUPPORTED_GITHUB_CI_PROVIDERS)[number];
3939
}) => {
4040
console.warn(
4141
'[DEPRECATION WARNING] - This command will be deprecated in the future, please use `create-github-context` instead'
@@ -86,7 +86,7 @@ export const registerCreateGithubContext = (
8686
async ({
8787
provider,
8888
}: {
89-
provider: typeof SUPPORTED_GITHUB_CI_PROVIDERS[number];
89+
provider: (typeof SUPPORTED_GITHUB_CI_PROVIDERS)[number];
9090
}) => {
9191
if (!provider) {
9292
throw new UserError('Cannot create context without a provider');
@@ -105,7 +105,7 @@ export const registerCreateGithubContext = (
105105
};
106106

107107
const createContext = async (
108-
provider: typeof SUPPORTED_GITHUB_CI_PROVIDERS[number]
108+
provider: (typeof SUPPORTED_GITHUB_CI_PROVIDERS)[number]
109109
) => {
110110
let normalizedContext: NormalizedCiContext;
111111
if (provider === 'github') {

projects/optic-ci/src/cli/commands/create-context/create-gitlab-context.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const registerCreateGitlabContext = (
4040
async ({
4141
provider,
4242
}: {
43-
provider: typeof SUPPORTED_GITLAB_CI_PROVIDERS[number];
43+
provider: (typeof SUPPORTED_GITLAB_CI_PROVIDERS)[number];
4444
}) => {
4545
if (!provider) {
4646
throw new UserError('Cannot create context without a provider');
@@ -59,7 +59,7 @@ export const registerCreateGitlabContext = (
5959
};
6060

6161
const createContext = (
62-
provider: typeof SUPPORTED_GITLAB_CI_PROVIDERS[number]
62+
provider: (typeof SUPPORTED_GITLAB_CI_PROVIDERS)[number]
6363
) => {
6464
let normalizedContext: NormalizedCiContext;
6565
if (provider === 'gitlab') {

projects/optic-ci/src/cli/commands/utils/__tests__/context-parsers.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, test, expect, describe } from '@jest/globals'
1+
import { jest, test, expect, describe } from '@jest/globals';
22
import {
33
readAndValidateCircleCiContext,
44
readAndValidateGithubContext,

projects/optic-ci/src/cli/commands/utils/__tests__/count-exemptions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, test, expect, describe } from '@jest/globals'
1+
import { jest, test, expect, describe } from '@jest/globals';
22
import { ChangeType, IChange } from '@useoptic/openapi-utilities';
33
import { newExemptionsCount } from '../count-exemptions';
44

projects/optic/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
5151
"bent": "^7.3.12",
5252
"jest": "^29.3.1",
53-
"prettier": "^2.8.1",
53+
"prettier": "^3.0.0",
5454
"ts-jest": "^29.0.3",
5555
"ts-node": "^10.9.1",
5656
"typescript": "^5.0.0"

projects/optic/src/commands/history.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,11 @@ const logEndpointsChanges = (
300300
);
301301
return changeType === 'added' || changeType === 'removed'
302302
? `${changeType} \`${param?.name}\` ${param?.in} parameter`
303-
: `${changeType} \`${param?.name}\` ${
304-
param?.in
305-
} parameter ${getChangeDescription(segments.slice(5), spec, segments)}`;
303+
: `${changeType} \`${param?.name}\` ${param?.in} parameter ${getChangeDescription(
304+
segments.slice(5),
305+
spec,
306+
segments
307+
)}`;
306308
};
307309

308310
const getRequestBodyChange = (

projects/optic/src/commands/oas/coverage/api-coverage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class ApiCoverageCounter {
2323
Object.entries(methods || {}).forEach((entry) => {
2424
const [method, operation] = entry as [
2525
OpenAPIV3.HttpMethods,
26-
OpenAPIV3.OperationObject
26+
OpenAPIV3.OperationObject,
2727
];
2828

2929
if (Object.values(OpenAPIV3.HttpMethods).includes(method)) {

projects/optic/src/commands/oas/specs/files/reconcilers/stringify.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import invariant from 'ts-invariant';
66
import { Result, Ok, Err } from 'ts-results';
77

88
export const applyPatch: SpecFileReconciler<Config> = async function applyPatch<
9-
Config
9+
Config,
1010
>(
1111
filePath: string,
1212
fileContents: string,

0 commit comments

Comments
 (0)