Skip to content

Commit

Permalink
chore(deps): update dependency prettier to v3 (#2062)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Lim <[email protected]>
  • Loading branch information
renovate[bot] and niclim authored Jul 7, 2023
1 parent 1306a4a commit cbef9d1
Show file tree
Hide file tree
Showing 55 changed files with 3,984 additions and 4,258 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ jobs:
- name: Install Task
run: curl -sL https://taskfile.dev/install.sh | sudo bash -s -- -b /usr/local/bin/

- name: Lint
run: task default lint

- name: Test
run: task default test
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
projects/optic/src/__tests__/integration/workspaces
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"semi": true,
"singleQuote": true,
"arrowParens": "always"
"arrowParens": "always",
"trailingComma": "es5"
}
5 changes: 5 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ tasks:
cmds:
- yarn workspaces foreach -pv --no-private run clean

lint:
desc: Lint
cmds:
- yarn run lint

test:
desc: Test
cmds:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"scripts": {
"release": "gh release create --target=$(git branch --show-current) v$(node -e \"process.stdout.write(require('./package.json').version)\")",
"version": "yarn workspaces foreach -v version",
"prepare": "husky install"
"prepare": "husky install",
"lint": "prettier --check 'projects/*/src/**/*.(js|jsx|ts|tsx|json|css)'"
},
"devDependencies": {
"@types/prettier": "^2",
"husky": "^8.0.0",
"lint-staged": "^13.1.0",
"prettier": "^2.8.1"
"prettier": "^3.0.0"
},
"lint-staged": {
"**/*.+(js|jsx|ts|tsx|json|css)": [
Expand Down
2 changes: 1 addition & 1 deletion projects/json-pointer-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@types/node": "^18.0.0",
"babel-jest": "^29.3.1",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"prettier": "^3.0.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion projects/json-pointer-helpers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import jsonPointerHelpers from "./json-pointers/json-pointer-helpers";
import jsonPointerHelpers from './json-pointers/json-pointer-helpers';
export { jsonPointerHelpers };
2 changes: 1 addition & 1 deletion projects/openapi-io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@types/semver": "^7.3.10",
"babel-jest": "^29.3.1",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"prettier": "^3.0.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion projects/openapi-io/src/write/yaml-roundtrip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function applyOperationsToYamlString(
}
});

return doc.toString({collectionStyle: 'block'});
return doc.toString({ collectionStyle: 'block' });
}

function insert<T>(arr: T[], index: number, item: any) {
Expand Down
2 changes: 1 addition & 1 deletion projects/openapi-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@types/node": "^18.0.0",
"babel-jest": "^29.3.1",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"prettier": "^3.0.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.0"
Expand Down
4 changes: 3 additions & 1 deletion projects/openapi-utilities/src/diff/array-identifiers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const isParameterObject = (value: any): value is { name: string; in: string } =>
export const isParameterObject = (
value: any
): value is { name: string; in: string } =>
typeof value === 'object' &&
!Array.isArray(value) &&
value !== null &&
Expand Down
2 changes: 1 addition & 1 deletion projects/openapi-utilities/src/diff/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type StackItem<T extends JSONObject | JSONArray = JSONObject | JSONArray> = [
{
value: T;
path: string;
}
},
];

export function typeofDiff(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IFact } from "../sdk/types";
import { IFact } from '../sdk/types';

export const FactsMock = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ export function resolveJsonPointerInYamlAst(

if (isEmpty) return node;

const found: YAMLNode | undefined = decoded.reduce((current, path) => {
if (!current) return undefined;
const node: YAMLNode = current.key ? current.value : current;
const isNumericalKey =
!isNaN(Number(path)) && (node as any).hasOwnProperty('items');

if (isNumericalKey) {
return (node as YAMLSequence).items[Number(path)];
} else {
const field = node.mappings.find(
(i: YAMLMapping) => i.key.value === path
);
return field;
}
}, node as YAMLNode | undefined);
const found: YAMLNode | undefined = decoded.reduce(
(current, path) => {
if (!current) return undefined;
const node: YAMLNode = current.key ? current.value : current;
const isNumericalKey =
!isNaN(Number(path)) && (node as any).hasOwnProperty('items');

if (isNumericalKey) {
return (node as YAMLSequence).items[Number(path)];
} else {
const field = node.mappings.find(
(i: YAMLMapping) => i.key.value === path
);
return field;
}
},
node as YAMLNode | undefined
);

return found;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function factsToChangelog(past: IFact[], current: IFact[]): IChange[] {
location: added.location,
added: added.value,
changeType: ChangeType.Added,
} as IChange)
}) as IChange
);

const removedChanges = removed.map(
Expand All @@ -63,7 +63,7 @@ export function factsToChangelog(past: IFact[], current: IFact[]): IChange[] {
before: removed.value,
},
changeType: ChangeType.Removed,
} as IChange)
}) as IChange
);

const changedChanges = updated.map((past) => {
Expand Down
2 changes: 1 addition & 1 deletion projects/openapi-utilities/src/utilities/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const initSentry = (sentryUrl: string | undefined, version: string) => {

export const wrapActionHandlerWithSentry = <
Args extends any[],
Return extends any
Return extends any,
>(
fn: (...args: Args) => Promise<Return>
): ((...args: Args) => Promise<Return>) => {
Expand Down
2 changes: 1 addition & 1 deletion projects/optic-ci/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"dotenv": "^16.0.3",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"prettier": "^3.0.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.0"
Expand Down
5 changes: 4 additions & 1 deletion projects/optic-ci/src/cli/clients/gitlab-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import urljoin from 'url-join';
import { JsonHttpClient } from './JsonHttpClient';

export class GitlabClient extends JsonHttpClient {
constructor(private baseUrl: string, private authToken: string) {
constructor(
private baseUrl: string,
private authToken: string
) {
super();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest, test, expect, describe } from '@jest/globals'
import { jest, test, expect, describe } from '@jest/globals';
import { parseJsonComparisonInput } from '../input-generators';
import { loadFile } from '../../utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, describe } from '@jest/globals'
import { test, expect, describe } from '@jest/globals';
import { applyGlobFilters } from '../input-generators';

describe('applyGlobFilters', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest, test, expect, beforeEach, afterEach } from '@jest/globals'
import { jest, test, expect, beforeEach, afterEach } from '@jest/globals';

import { v4 as uuidv4 } from 'uuid';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, afterAll } from '@jest/globals'
import { test, expect, afterAll } from '@jest/globals';
import { UserError } from '@useoptic/openapi-utilities';
import { getContextFromCircleCiEnvironment } from '../circle-ci';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest, test, expect, afterAll } from '@jest/globals'
import { jest, test, expect, afterAll } from '@jest/globals';
import fs from 'fs/promises';
import { UserError } from '@useoptic/openapi-utilities';
import { getContextFromGithubEnvironment } from '../github-actions';
Expand Down Expand Up @@ -63,21 +63,22 @@ test('get head sha from github context', async () => {
process.env.GITHUB_SHA = 'asdasd';
process.env.GITHUB_REPOSITORY = 'optidev/monorail';
process.env.GITHUB_HEAD_REF = 'feature-1';
mockReadFile.mockImplementation(() =>
Promise.resolve(
Buffer.from(
JSON.stringify({
pull_request: {
head: {
user: {
login: 'lou',
mockReadFile.mockImplementation(
() =>
Promise.resolve(
Buffer.from(
JSON.stringify({
pull_request: {
head: {
user: {
login: 'lou',
},
sha: '7d3736f2b38af7f69fd51e43465fd74375aaca2d',
},
sha: '7d3736f2b38af7f69fd51e43465fd74375aaca2d',
},
},
})
)
) as any
})
)
) as any
);

expect(await getContextFromGithubEnvironment()).toEqual({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, afterAll } from '@jest/globals'
import { test, expect, afterAll } from '@jest/globals';
import { getContextFromGitlabEnvironment } from '../gitlab-ci';

const originalEnv = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const registerCreateContext = (cli: Command, hideCommand: boolean) => {
async ({
provider,
}: {
provider: typeof SUPPORTED_GITHUB_CI_PROVIDERS[number];
provider: (typeof SUPPORTED_GITHUB_CI_PROVIDERS)[number];
}) => {
console.warn(
'[DEPRECATION WARNING] - This command will be deprecated in the future, please use `create-github-context` instead'
Expand Down Expand Up @@ -86,7 +86,7 @@ export const registerCreateGithubContext = (
async ({
provider,
}: {
provider: typeof SUPPORTED_GITHUB_CI_PROVIDERS[number];
provider: (typeof SUPPORTED_GITHUB_CI_PROVIDERS)[number];
}) => {
if (!provider) {
throw new UserError('Cannot create context without a provider');
Expand All @@ -105,7 +105,7 @@ export const registerCreateGithubContext = (
};

const createContext = async (
provider: typeof SUPPORTED_GITHUB_CI_PROVIDERS[number]
provider: (typeof SUPPORTED_GITHUB_CI_PROVIDERS)[number]
) => {
let normalizedContext: NormalizedCiContext;
if (provider === 'github') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const registerCreateGitlabContext = (
async ({
provider,
}: {
provider: typeof SUPPORTED_GITLAB_CI_PROVIDERS[number];
provider: (typeof SUPPORTED_GITLAB_CI_PROVIDERS)[number];
}) => {
if (!provider) {
throw new UserError('Cannot create context without a provider');
Expand All @@ -59,7 +59,7 @@ export const registerCreateGitlabContext = (
};

const createContext = (
provider: typeof SUPPORTED_GITLAB_CI_PROVIDERS[number]
provider: (typeof SUPPORTED_GITLAB_CI_PROVIDERS)[number]
) => {
let normalizedContext: NormalizedCiContext;
if (provider === 'gitlab') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest, test, expect, describe } from '@jest/globals'
import { jest, test, expect, describe } from '@jest/globals';
import {
readAndValidateCircleCiContext,
readAndValidateGithubContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest, test, expect, describe } from '@jest/globals'
import { jest, test, expect, describe } from '@jest/globals';
import { ChangeType, IChange } from '@useoptic/openapi-utilities';
import { newExemptionsCount } from '../count-exemptions';

Expand Down
2 changes: 1 addition & 1 deletion projects/optic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"bent": "^7.3.12",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"prettier": "^3.0.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.0"
Expand Down
8 changes: 5 additions & 3 deletions projects/optic/src/commands/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,11 @@ const logEndpointsChanges = (
);
return changeType === 'added' || changeType === 'removed'
? `${changeType} \`${param?.name}\` ${param?.in} parameter`
: `${changeType} \`${param?.name}\` ${
param?.in
} parameter ${getChangeDescription(segments.slice(5), spec, segments)}`;
: `${changeType} \`${param?.name}\` ${param?.in} parameter ${getChangeDescription(
segments.slice(5),
spec,
segments
)}`;
};

const getRequestBodyChange = (
Expand Down
2 changes: 1 addition & 1 deletion projects/optic/src/commands/oas/coverage/api-coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ApiCoverageCounter {
Object.entries(methods || {}).forEach((entry) => {
const [method, operation] = entry as [
OpenAPIV3.HttpMethods,
OpenAPIV3.OperationObject
OpenAPIV3.OperationObject,
];

if (Object.values(OpenAPIV3.HttpMethods).includes(method)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import invariant from 'ts-invariant';
import { Result, Ok, Err } from 'ts-results';

export const applyPatch: SpecFileReconciler<Config> = async function applyPatch<
Config
Config,
>(
filePath: string,
fileContents: string,
Expand Down
Loading

0 comments on commit cbef9d1

Please sign in to comment.