Skip to content

Commit 7a4bb7e

Browse files
committed
fix(tools): migrate noImportCycles from nursery to suspicious (biome 2.4.6)
1 parent 32916fb commit 7a4bb7e

8 files changed

Lines changed: 32 additions & 57 deletions

File tree

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"license": "Apache-2.0",
1010
"name": "r5n-clis",
1111
"packageManager": "bun@1.3.3",
12+
"private": true,
1213
"scripts": {
1314
"build": "bun --filter '*' build",
1415
"clean": "bun --filter '*' clean; rm -rf node_modules; bun install",
@@ -29,11 +30,5 @@
2930
"type-check:go": "bun --elide-lines=0 --filter '*' type-check:go"
3031
},
3132
"version": "0.0.0",
32-
"workspaces": {
33-
"packages": [
34-
"packages/*",
35-
"tools"
36-
]
37-
},
38-
"private": true
33+
"workspaces": { "packages": ["packages/*", "tools"] }
3934
}

packages/sisyphus/src/commands/actions/init.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import { dirname } from "node:path";
44
import { args, color, confirm, Exit, log, multiselect, note } from "@r5n/cli-core";
55
import { BaseCommand, type Ctx } from "../../base-command";
66
import { detectProvider } from "../../providers";
7-
import { createCiGenerator, GitHubCiGenerator, GitLabCiGenerator, WORKFLOW_CONFIGS, type WorkflowType } from "./CiGenerator";
7+
import {
8+
createCiGenerator,
9+
GitHubCiGenerator,
10+
GitLabCiGenerator,
11+
WORKFLOW_CONFIGS,
12+
type WorkflowType,
13+
} from "./CiGenerator";
814

915
const PROVIDER_LABELS = { bitbucket: "Bitbucket Pipelines", github: "GitHub Actions", gitlab: "GitLab CI" };
1016

@@ -80,7 +86,7 @@ export class ActionsInitCommand extends BaseCommand {
8086

8187
if (generator instanceof GitHubCiGenerator) {
8288
log.info(
83-
`\n${color.yellow("Note:")} Enable ${color.bold("\"Allow GitHub Actions to create and approve pull requests\"")}`,
89+
`\n${color.yellow("Note:")} Enable ${color.bold('"Allow GitHub Actions to create and approve pull requests"')}`,
8490
);
8591
log.info(color.dim("Settings → Actions → General → Workflow permissions"));
8692
log.info("");

packages/sisyphus/src/domain/Commit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class Commit {
130130
const commits: Commit[] = [];
131131

132132
for (let i = 0; i < segments.length; i += 2) {
133-
const fields = segments[i]!.split(FIELD_SEPARATOR);
133+
const fields = segments[i]?.split(FIELD_SEPARATOR);
134134
if (fields.length < 3) continue;
135135

136136
const [hash, subject, author] = fields;

packages/sisyphus/src/providers/GitHubProvider.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ export class GitHubProvider extends GitProvider {
133133

134134
async getPrCommits(number: number): Promise<string[]> {
135135
try {
136-
const result =
137-
await Bun.$`gh api ${this.apiPath}/pulls/${number}/commits --jq '.[].sha'`.quiet();
136+
const result = await Bun.$`gh api ${this.apiPath}/pulls/${number}/commits --jq '.[].sha'`.quiet();
138137
return result.stdout.toString().trim().split("\n").filter(Boolean);
139138
} catch {
140139
return [];
@@ -143,8 +142,7 @@ export class GitHubProvider extends GitProvider {
143142

144143
async getPrFiles(number: number): Promise<string[]> {
145144
try {
146-
const result =
147-
await Bun.$`gh api ${this.apiPath}/pulls/${number}/files --jq '.[].filename'`.quiet();
145+
const result = await Bun.$`gh api ${this.apiPath}/pulls/${number}/files --jq '.[].filename'`.quiet();
148146
return result.stdout.toString().trim().split("\n").filter(Boolean);
149147
} catch {
150148
return [];

packages/sisyphus/src/providers/GitLabProvider.ts

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ export class GitLabProvider extends GitProvider {
6060
if (options.head) params.set("source_branch", options.head);
6161
if (options.label) params.set("labels", options.label);
6262

63-
const mrs = await this.api<GitLabMrResponse[]>(
64-
`/projects/${this.projectPath}/merge_requests?${params}`,
65-
);
63+
const mrs = await this.api<GitLabMrResponse[]>(`/projects/${this.projectPath}/merge_requests?${params}`);
6664

6765
if (!mrs[0]) return null;
6866
return this.mapMrResponse(mrs[0]);
@@ -83,10 +81,10 @@ export class GitLabProvider extends GitProvider {
8381
body.labels = options.labels.join(",");
8482
}
8583

86-
const data = await this.api<GitLabMrResponse>(
87-
`/projects/${this.projectPath}/merge_requests`,
88-
{ body: JSON.stringify(body), method: "POST" },
89-
);
84+
const data = await this.api<GitLabMrResponse>(`/projects/${this.projectPath}/merge_requests`, {
85+
body: JSON.stringify(body),
86+
method: "POST",
87+
});
9088

9189
return this.mapMrResponse(data);
9290
}
@@ -96,17 +94,15 @@ export class GitLabProvider extends GitProvider {
9694
if (options.title) body.title = options.title;
9795
if (options.body) body.description = options.body;
9896

99-
await this.api(
100-
`/projects/${this.projectPath}/merge_requests/${number}`,
101-
{ body: JSON.stringify(body), method: "PUT" },
102-
);
97+
await this.api(`/projects/${this.projectPath}/merge_requests/${number}`, {
98+
body: JSON.stringify(body),
99+
method: "PUT",
100+
});
103101
}
104102

105103
async getPr(number: number): Promise<PullRequest> {
106104
try {
107-
const data = await this.api<GitLabMrResponse>(
108-
`/projects/${this.projectPath}/merge_requests/${number}`,
109-
);
105+
const data = await this.api<GitLabMrResponse>(`/projects/${this.projectPath}/merge_requests/${number}`);
110106
return this.mapMrResponse(data);
111107
} catch {
112108
throw new Exit(`Failed to fetch MR !${number}`, "Make sure the MR exists and you have access");
@@ -119,9 +115,7 @@ export class GitLabProvider extends GitProvider {
119115
const branch = result.stdout.toString().trim();
120116

121117
const params = new URLSearchParams({ per_page: "1", source_branch: branch, state: "opened" });
122-
const mrs = await this.api<GitLabMrResponse[]>(
123-
`/projects/${this.projectPath}/merge_requests?${params}`,
124-
);
118+
const mrs = await this.api<GitLabMrResponse[]>(`/projects/${this.projectPath}/merge_requests?${params}`);
125119

126120
if (!mrs[0]) throw new Error("No MR found");
127121
return this.mapMrResponse(mrs[0]);
@@ -158,29 +152,20 @@ export class GitLabProvider extends GitProvider {
158152
if (options?.description) body.description = options.description;
159153
if (options?.color) body.color = `#${options.color}`;
160154

161-
await this.api(`/projects/${this.projectPath}/labels`, {
162-
body: JSON.stringify(body),
163-
method: "POST",
164-
});
155+
await this.api(`/projects/${this.projectPath}/labels`, { body: JSON.stringify(body), method: "POST" });
165156
} catch {}
166157
}
167158

168159
async createRelease(options: CreateReleaseOptions): Promise<void> {
169160
await this.api(`/projects/${this.projectPath}/releases`, {
170-
body: JSON.stringify({
171-
description: options.notes,
172-
name: options.title,
173-
tag_name: options.tag,
174-
}),
161+
body: JSON.stringify({ description: options.notes, name: options.title, tag_name: options.tag }),
175162
method: "POST",
176163
});
177164
}
178165

179166
async deleteRelease(tag: string): Promise<void> {
180167
try {
181-
await this.api(`/projects/${this.projectPath}/releases/${encodeURIComponent(tag)}`, {
182-
method: "DELETE",
183-
});
168+
await this.api(`/projects/${this.projectPath}/releases/${encodeURIComponent(tag)}`, { method: "DELETE" });
184169
} catch {}
185170
}
186171

@@ -204,11 +189,7 @@ export class GitLabProvider extends GitProvider {
204189
private async api<T>(path: string, options?: RequestInit): Promise<T> {
205190
const response = await fetch(`${this.apiUrl}${path}`, {
206191
...options,
207-
headers: {
208-
"Content-Type": "application/json",
209-
...this.authHeader,
210-
...options?.headers,
211-
},
192+
headers: { "Content-Type": "application/json", ...this.authHeader, ...options?.headers },
212193
});
213194

214195
if (!response.ok) {

packages/sisyphus/src/services/ChangelogGenerator.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ export class ChangelogGenerator {
177177
const date = this.getDate();
178178
const packageList = packages.map((p) => `${p.name}@${p.newVersion ?? p.version}`).join(", ");
179179

180-
return this.config.rootHeader
181-
.replace("{date}", () => date)
182-
.replace("{packages}", () => packageList);
180+
return this.config.rootHeader.replace("{date}", () => date).replace("{packages}", () => packageList);
183181
}
184182

185183
private formatRootStoneContent(stone: Stone): string {

packages/sisyphus/src/services/GitRemoteParser.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getRemoteUrl, parseRemoteUrl, type Provider, type RemoteInfo } from "../providers";
1+
import { getRemoteUrl, type Provider, parseRemoteUrl, type RemoteInfo } from "../providers";
22

33
const COMMIT_PATH: Record<Provider, string> = { bitbucket: "commits", github: "commit", gitlab: "-/commit" };
44
const PROVIDER_DOMAIN: Record<Provider, string> = {
@@ -31,10 +31,7 @@ export class GitRemoteParser {
3131
const commitPath = COMMIT_PATH[info.provider];
3232
const baseUrl = `https://${domain}/${info.owner}/${info.repo}`;
3333

34-
this.cached = {
35-
...info,
36-
commitUrl: (hash: string) => `${baseUrl}/${commitPath}/${hash}`,
37-
};
34+
this.cached = { ...info, commitUrl: (hash: string) => `${baseUrl}/${commitPath}/${hash}` };
3835
return this.cached;
3936
}
4037
}

tools/biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"useSelfClosingElements": "error",
7979
"useSingleVarDeclarator": "error"
8080
},
81-
"suspicious": { "noExplicitAny": "off", "noReactSpecificProps": "off", "noImportCycles": "on" }
81+
"suspicious": { "noExplicitAny": "off", "noImportCycles": "on", "noReactSpecificProps": "off" }
8282
}
8383
},
8484
"root": false

0 commit comments

Comments
 (0)