Skip to content

Commit 9d8d308

Browse files
authored
js: Enforce uniform formatting (#1574)
We're going to commit more generated code soon that needs auto-formatting to look good. Seems like we didn't have auto-formatting set up correctly so we had some overly long lines and a mix of two-space and four-space indentation. This PR fixes that, and updates CI to error on unformatted files.
2 parents a920119 + 3e5a43e commit 9d8d308

16 files changed

+984
-972
lines changed

javascript/.prettierrc.cjs

Lines changed: 0 additions & 4 deletions
This file was deleted.

javascript/.prettierrc.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
printWidth = 90
2+
trailingComma = "es5"

javascript/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"test": "jest",
2525
"prepublishOnly": "yarn lint",
2626
"lint:eslint": "eslint --ignore-path .lintignore --ext .js,.jsx,.ts,.tsx src",
27-
"lint:prettier": "prettier --ignore-path .lintignore --write src/**.ts",
28-
"lint": "yarn run lint:prettier && yarn run lint:eslint --max-warnings=0",
27+
"lint:prettier": "prettier --ignore-path .lintignore src",
28+
"lint": "yarn run lint:prettier --check && yarn run lint:eslint --max-warnings=0",
2929
"lint:fix": "yarn run lint:prettier --write && yarn run lint:eslint --fix"
3030
},
3131
"dependencies": {
@@ -49,4 +49,4 @@
4949
"ts-jest": "^29.2.5",
5050
"typescript": "^4.0"
5151
}
52-
}
52+
}

javascript/src/api/application.ts

Lines changed: 62 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,69 @@
1-
import { ApplicationApi, ApplicationIn, ApplicationOut, ApplicationPatch, Configuration, ListResponseApplicationOut, Ordering } from "../openapi";
1+
import {
2+
ApplicationApi,
3+
ApplicationIn,
4+
ApplicationOut,
5+
ApplicationPatch,
6+
Configuration,
7+
ListResponseApplicationOut,
8+
Ordering,
9+
} from "../openapi";
210
import { PostOptions } from "../util";
311

412
export interface ApplicationListOptions {
5-
/// Limit the number of returned items
6-
limit?: number;
7-
/// The iterator returned from a prior invocation
8-
iterator?: string | null;
9-
/// The sorting order of the returned items
10-
order?: Ordering;
13+
/// Limit the number of returned items
14+
limit?: number;
15+
/// The iterator returned from a prior invocation
16+
iterator?: string | null;
17+
/// The sorting order of the returned items
18+
order?: Ordering;
1119
}
1220

1321
export class Application {
14-
private readonly api: ApplicationApi;
15-
16-
public constructor(config: Configuration) {
17-
this.api = new ApplicationApi(config);
18-
}
19-
20-
public list(options?: ApplicationListOptions): Promise<ListResponseApplicationOut> {
21-
const iterator = options?.iterator ?? undefined;
22-
return this.api.v1ApplicationList({ ...options, iterator });
23-
}
24-
25-
public create(
26-
applicationIn: ApplicationIn,
27-
options?: PostOptions
28-
): Promise<ApplicationOut> {
29-
return this.api.v1ApplicationCreate({ applicationIn, ...options });
30-
}
31-
32-
public getOrCreate(
33-
applicationIn: ApplicationIn,
34-
options?: PostOptions
35-
): Promise<ApplicationOut> {
36-
return this.api.v1ApplicationCreate({
37-
applicationIn,
38-
...options,
39-
getIfExists: true,
40-
});
41-
}
42-
43-
public get(appId: string): Promise<ApplicationOut> {
44-
return this.api.v1ApplicationGet({ appId });
45-
}
46-
47-
public update(appId: string, applicationIn: ApplicationIn): Promise<ApplicationOut> {
48-
return this.api.v1ApplicationUpdate({ appId, applicationIn });
49-
}
50-
51-
public patch(
52-
appId: string,
53-
applicationPatch: ApplicationPatch
54-
): Promise<ApplicationOut> {
55-
return this.api.v1ApplicationPatch({ appId, applicationPatch });
56-
}
57-
58-
public delete(appId: string): Promise<void> {
59-
return this.api.v1ApplicationDelete({ appId });
60-
}
22+
private readonly api: ApplicationApi;
23+
24+
public constructor(config: Configuration) {
25+
this.api = new ApplicationApi(config);
26+
}
27+
28+
public list(options?: ApplicationListOptions): Promise<ListResponseApplicationOut> {
29+
const iterator = options?.iterator ?? undefined;
30+
return this.api.v1ApplicationList({ ...options, iterator });
31+
}
32+
33+
public create(
34+
applicationIn: ApplicationIn,
35+
options?: PostOptions
36+
): Promise<ApplicationOut> {
37+
return this.api.v1ApplicationCreate({ applicationIn, ...options });
38+
}
39+
40+
public getOrCreate(
41+
applicationIn: ApplicationIn,
42+
options?: PostOptions
43+
): Promise<ApplicationOut> {
44+
return this.api.v1ApplicationCreate({
45+
applicationIn,
46+
...options,
47+
getIfExists: true,
48+
});
49+
}
50+
51+
public get(appId: string): Promise<ApplicationOut> {
52+
return this.api.v1ApplicationGet({ appId });
53+
}
54+
55+
public update(appId: string, applicationIn: ApplicationIn): Promise<ApplicationOut> {
56+
return this.api.v1ApplicationUpdate({ appId, applicationIn });
57+
}
58+
59+
public patch(
60+
appId: string,
61+
applicationPatch: ApplicationPatch
62+
): Promise<ApplicationOut> {
63+
return this.api.v1ApplicationPatch({ appId, applicationPatch });
64+
}
65+
66+
public delete(appId: string): Promise<void> {
67+
return this.api.v1ApplicationDelete({ appId });
68+
}
6169
}

javascript/src/api/authentication.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
import {
2-
Configuration,
3-
AuthenticationApi,
4-
DashboardAccessOut,
5-
AppPortalAccessOut,
6-
AppPortalAccessIn,
2+
Configuration,
3+
AuthenticationApi,
4+
DashboardAccessOut,
5+
AppPortalAccessOut,
6+
AppPortalAccessIn,
77
} from "../openapi";
88
import { PostOptions } from "../util";
99

1010
export class Authentication {
11-
private readonly api: AuthenticationApi;
11+
private readonly api: AuthenticationApi;
1212

13-
public constructor(config: Configuration) {
14-
this.api = new AuthenticationApi(config);
15-
}
13+
public constructor(config: Configuration) {
14+
this.api = new AuthenticationApi(config);
15+
}
1616

17-
public appPortalAccess(
18-
appId: string,
19-
appPortalAccessIn: AppPortalAccessIn,
20-
options?: PostOptions
21-
): Promise<AppPortalAccessOut> {
22-
return this.api.v1AuthenticationAppPortalAccess({
23-
appId,
24-
appPortalAccessIn,
25-
...options,
26-
});
27-
}
17+
public appPortalAccess(
18+
appId: string,
19+
appPortalAccessIn: AppPortalAccessIn,
20+
options?: PostOptions
21+
): Promise<AppPortalAccessOut> {
22+
return this.api.v1AuthenticationAppPortalAccess({
23+
appId,
24+
appPortalAccessIn,
25+
...options,
26+
});
27+
}
2828

29-
public dashboardAccess(
30-
appId: string,
31-
options?: PostOptions
32-
): Promise<DashboardAccessOut> {
33-
return this.api.v1AuthenticationDashboardAccess({
34-
appId,
35-
...options,
36-
});
37-
}
29+
public dashboardAccess(
30+
appId: string,
31+
options?: PostOptions
32+
): Promise<DashboardAccessOut> {
33+
return this.api.v1AuthenticationDashboardAccess({
34+
appId,
35+
...options,
36+
});
37+
}
3838

39-
public logout(options?: PostOptions): Promise<void> {
40-
return this.api.v1AuthenticationLogout({ ...options });
41-
}
39+
public logout(options?: PostOptions): Promise<void> {
40+
return this.api.v1AuthenticationLogout({ ...options });
41+
}
4242
}

javascript/src/api/background_task.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
import {
2-
Configuration,
3-
BackgroundTaskStatus,
4-
BackgroundTaskType,
5-
BackgroundTaskOut,
6-
ListResponseBackgroundTaskOut,
7-
BackgroundTasksApi,
2+
Configuration,
3+
BackgroundTaskStatus,
4+
BackgroundTaskType,
5+
BackgroundTaskOut,
6+
ListResponseBackgroundTaskOut,
7+
BackgroundTasksApi,
88
} from "../openapi";
99

1010
export interface BackgroundTaskListOptions {
11-
iterator?: string | null;
12-
limit?: number;
13-
status?: BackgroundTaskStatus;
14-
task?: BackgroundTaskType;
11+
iterator?: string | null;
12+
limit?: number;
13+
status?: BackgroundTaskStatus;
14+
task?: BackgroundTaskType;
1515
}
1616

1717
export class BackgroundTask {
18-
private readonly api: BackgroundTasksApi;
18+
private readonly api: BackgroundTasksApi;
1919

20-
public constructor(config: Configuration) {
21-
this.api = new BackgroundTasksApi(config);
22-
}
20+
public constructor(config: Configuration) {
21+
this.api = new BackgroundTasksApi(config);
22+
}
2323

24-
public listByEndpoint(
25-
options?: BackgroundTaskListOptions
26-
): Promise<ListResponseBackgroundTaskOut> {
27-
const iterator = options?.iterator ?? undefined;
28-
return this.api.listBackgroundTasks({ ...options, iterator });
29-
}
24+
public listByEndpoint(
25+
options?: BackgroundTaskListOptions
26+
): Promise<ListResponseBackgroundTaskOut> {
27+
const iterator = options?.iterator ?? undefined;
28+
return this.api.listBackgroundTasks({ ...options, iterator });
29+
}
3030

31-
public get(taskId: string): Promise<BackgroundTaskOut> {
32-
return this.api.getBackgroundTask({
33-
taskId,
34-
});
35-
}
31+
public get(taskId: string): Promise<BackgroundTaskOut> {
32+
return this.api.getBackgroundTask({
33+
taskId,
34+
});
35+
}
3636
}

0 commit comments

Comments
 (0)