Skip to content

Commit

Permalink
ci: update configuration of Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Nov 21, 2024
1 parent 82e12a3 commit ef62d44
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 179 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/differential-shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Differential ShellCheck
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

permissions:
contents: read
Expand Down
7 changes: 3 additions & 4 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
semi: true
overrides:
- files: "**/*.{ts,js}"
options:
trailingComma: all
trailingComma: "es5"
tabWidth: 2
semi: true
singleQuote: true
quoteProps: as-needed
quoteProps: "as-needed"
bracketSpacing: true
bracketSameLine: true
arrowParens: avoid
arrowParens: "avoid"
2 changes: 1 addition & 1 deletion itest/bugzilla-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default <Environment>{
['exec', 'integration', '/usr/local/bin/restore-db'],
{
stdio: 'inherit',
},
}
);

Check warning on line 25 in itest/bugzilla-environment.ts

View check run for this annotation

Codecov / codecov/patch

itest/bugzilla-environment.ts#L24-L25

Added lines #L24 - L25 were not covered by tests
spawnSync(path.join(__dirname, 'stop_container.sh'), {
stdio: 'inherit',
Expand Down
8 changes: 4 additions & 4 deletions itest/test/attachments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ beforeAll(async () => {
api = new BugzillaAPI(
'http://localhost:8088/bugzilla/',
'[email protected]',
'adminpass',
'adminpass'
);

bugs.push(await api.createBug(bug));
Expand Down Expand Up @@ -64,7 +64,7 @@ beforeAll(async () => {
file_name: 'image.png',
data: Buffer.from('This is not a image.'),
content_type: 'image/png',
})),
}))
);

expect(attachments).toBeDefined();
Expand Down Expand Up @@ -199,7 +199,7 @@ test(`Edit single attachment`, async () => {
is_patch: true,
// is_private: true,
summary: 'new summary',
}),
})
).resolves.toEqual([
{
changes: new Map([
Expand Down Expand Up @@ -233,7 +233,7 @@ test('Edit multiple attachments', async () => {
is_patch: true,
// is_private: true,
summary: 'new summary',
}),
})
).resolves.toEqual([
{
changes: expect.anything(),
Expand Down
2 changes: 1 addition & 1 deletion itest/test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('Authenticated access', async () => {
let api = new BugzillaAPI(
'http://localhost:8088/bugzilla/',
'[email protected]',
'adminpass',
'adminpass'
);

await expect(api.version()).resolves.toBe('5.1.2');
Expand Down
18 changes: 9 additions & 9 deletions itest/test/bugs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ beforeEach(async () => {
api = new BugzillaAPI(
'http://localhost:8088/bugzilla/',
'[email protected]',
'adminpass',
'adminpass'
);

bugs.push(await api.createBug(bug));
Expand All @@ -40,7 +40,7 @@ beforeEach(async () => {
platform: 'Macintosh',
priority: 'High',
severity: 'normal',
}),
})
);

expect(bugs).toBeDefined();
Expand Down Expand Up @@ -149,7 +149,7 @@ test('Fetch bugs', async () => {
]);

await expect(api.quicksearch('ALL')).resolves.toEqual(
expect.arrayContaining(result),
expect.arrayContaining(result)
);
});

Expand All @@ -161,7 +161,7 @@ test('Update bug', async () => {
blocks: { set: [bugs[1] as number] },
comment: { comment: 'New comment', is_private: false },
severity: 'normal',
}),
})
).resolves.toEqual([
{
alias: [],
Expand All @@ -181,7 +181,7 @@ test('Update multiple bugs', async () => {
id_or_alias: bugs[0] as number,
ids: [bugs[0] as number, bugs[1] as number],
severity: 'normal',
}),
})
).resolves.toEqual([
{
alias: [],
Expand All @@ -208,27 +208,27 @@ test('Get history of bug', async () => {

test('Use of advance searching', async () => {
const expected = await api.advancedSearch(
'http://localhost:8088/bugzilla/buglist.cgi?email1=admin%40nowhere.com&severity=normal',
'http://localhost:8088/bugzilla/buglist.cgi?email1=admin%40nowhere.com&severity=normal'
);

expected.forEach(bug => {
expect(bug).toEqual(
expect.objectContaining({
severity: 'normal',
creator: '[email protected]',
}),
})
);
});

await expect(
api.advancedSearch('email1=admin%40nowhere.com&severity=normal'),
api.advancedSearch('email1=admin%40nowhere.com&severity=normal')
).resolves.toEqual(expected);

await expect(
api.advancedSearch({
email1: '[email protected]',
severity: 'normal',
}),
})
).resolves.toEqual(expected);
});

Expand Down
4 changes: 2 additions & 2 deletions itest/test/comments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ beforeEach(async () => {
api = new BugzillaAPI(
'http://localhost:8088/bugzilla/',
'[email protected]',
'adminpass',
'adminpass'
);

bugs.push(await api.createBug(bug));
Expand All @@ -38,7 +38,7 @@ test('Create comment', async () => {
await expect(
api.createComment(bugs[0] as number, 'First comment!', {
is_private: false,
}),
})
).resolves.not.toThrow();
});

Expand Down
2 changes: 1 addition & 1 deletion scripts/post-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function main() {
i,
0,
`# [Next](https://github.com/${matches[1]}/compare/v${manifest.version}...main)`,
'',
''
);
break;
}
Expand Down
44 changes: 22 additions & 22 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ export default class BugzillaAPI {
instance: URL | string,
username: string,
password: string,
restrictLogin?: boolean,
restrictLogin?: boolean
);
public constructor(
instance: URL | string,
user?: string,
password?: string,
restrictLogin: boolean = false,
restrictLogin: boolean = false
) {
let url = instance instanceof URL ? instance : new URL(instance);

Expand All @@ -84,7 +84,7 @@ export default class BugzillaAPI {

public async bugHistory(
bugId: number | string,
since?: DateTime,
since?: DateTime
): Promise<History[]> {
let searchParams: URLSearchParams | undefined;

Expand All @@ -96,7 +96,7 @@ export default class BugzillaAPI {
let bugs = await this.link.get(
`bug/${bugId}/history`,
object(HistoryLookupSpec),
searchParams,
searchParams
);

let [bug] = bugs.bugs;
Expand All @@ -111,7 +111,7 @@ export default class BugzillaAPI {
return new FilteredQuery(
async (
includes: string[] | undefined,
excludes: string[] | undefined,
excludes: string[] | undefined
): Promise<Bug[]> => {
let search = params(query);
if (includes) {
Expand All @@ -126,11 +126,11 @@ export default class BugzillaAPI {
object({
bugs: array(object(BugSpec, includes, excludes)),
}),
search,
search
);

return result.bugs;
},
}
);
}

Expand All @@ -152,7 +152,7 @@ export default class BugzillaAPI {
| URL
| Record<string, string>
| [string, string][]
| URLSearchParams,
| URLSearchParams
): FilteredQuery<Bug> {
let searchParams: URLSearchParams;

Expand All @@ -174,7 +174,7 @@ export default class BugzillaAPI {
public async getComment(commentId: number): Promise<Comment | undefined> {
let comment = await this.link.get(
`bug/comment/${commentId}`,
object(CommentsSpec),
object(CommentsSpec)
);

if (!comment) {
Expand All @@ -187,7 +187,7 @@ export default class BugzillaAPI {
public async getBugComments(bugId: number): Promise<Comment[] | undefined> {
let comments = await this.link.get(
`bug/${bugId}/comment`,
object(CommentsSpec),
object(CommentsSpec)
);

if (!comments) {
Expand All @@ -200,7 +200,7 @@ export default class BugzillaAPI {
public async createComment(
bugId: number,
comment: string,
options: Partial<Omit<CreateCommentContent, 'comment'>> = {},
options: Partial<Omit<CreateCommentContent, 'comment'>> = {}
): Promise<number> {
const content = {
comment,
Expand All @@ -210,7 +210,7 @@ export default class BugzillaAPI {
let commentStatus = await this.link.post(
`bug/${bugId}/comment`,
object(CreatedCommentSpec),
content,
content
);

if (!commentStatus) {
Expand All @@ -232,12 +232,12 @@ export default class BugzillaAPI {

public async updateBug(
bugIdOrAlias: number | string,
data: UpdateBugContent,
data: UpdateBugContent
): Promise<UpdatedBug[]> {
let response = await this.link.put(
`bug/${bugIdOrAlias}`,
object(UpdatedBugTemplateSpec),
data,
data
);

if (!response) {
Expand All @@ -248,11 +248,11 @@ export default class BugzillaAPI {
}

public async getAttachment(
attachmentId: number,
attachmentId: number
): Promise<Attachment | undefined> {
let attachment = await this.link.get(
`bug/attachment/${attachmentId}`,
object(AttachmentsSpec),
object(AttachmentsSpec)
);

if (!attachment) {
Expand All @@ -263,11 +263,11 @@ export default class BugzillaAPI {
}

public async getBugAttachments(
bugId: number,
bugId: number
): Promise<Attachment[] | undefined> {
let attachments = await this.link.get(
`bug/${bugId}/attachment`,
object(AttachmentsSpec),
object(AttachmentsSpec)
);

if (!attachments) {
Expand All @@ -279,7 +279,7 @@ export default class BugzillaAPI {

public async createAttachment(
bugId: number,
attachment: CreateAttachmentContent,
attachment: CreateAttachmentContent
): Promise<number[]> {
const dataBase64 = {
data: Buffer.from(attachment.data).toString('base64'),
Expand All @@ -288,7 +288,7 @@ export default class BugzillaAPI {
let attachmentStatus = await this.link.post(
`bug/${bugId}/attachment`,
object(CreatedAttachmentSpec),
{ ...attachment, ...dataBase64 },
{ ...attachment, ...dataBase64 }
);

if (!attachmentStatus) {
Expand All @@ -300,12 +300,12 @@ export default class BugzillaAPI {

public async updateAttachment(
attachmentId: number,
data: UpdateAttachmentContent,
data: UpdateAttachmentContent
): Promise<UpdatedAttachment[]> {
let response = await this.link.put(
`bug/attachment/${attachmentId}`,
object(UpdatedAttachmentTemplateSpec),
data,
data
);

if (!response) {
Expand Down
Loading

0 comments on commit ef62d44

Please sign in to comment.