Skip to content

Commit cd80a78

Browse files
committed
fix(lint): fixed lint issues
1 parent 12f2dcb commit cd80a78

4 files changed

Lines changed: 11 additions & 14 deletions

File tree

src/app/features/preprints/components/preprint-details/preprint-make-decision/preprint-make-decision.component.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,17 @@ export class PreprintMakeDecisionComponent {
228228
}
229229

230230
submit() {
231-
// Don't remove comments
232231
const preprint = this.preprint();
233232
if (!preprint) return;
234233

235-
let trigger = '';
234+
let trigger;
236235
if (preprint.reviewsState !== ReviewsState.Pending && this.commentEdited() && !this.decisionChanged()) {
237236
// If the submission is not pending,
238237
// the decision has not changed and the comment is edited.
239238
// the trigger would be 'edit_comment'
240239
trigger = 'edit_comment';
241240
} else {
242-
let actionType = '';
241+
let actionType;
243242
if (preprint.isPublished && this.isPendingWithdrawal()) {
244243
// if the submission is published and is pending withdrawal.
245244
// actionType would be 'reject'
@@ -262,7 +261,7 @@ export class PreprintMakeDecisionComponent {
262261
trigger = this.decision() === ReviewsState.Accepted ? 'accept' : actionType;
263262
}
264263

265-
let comment: StringOrNull = '';
264+
let comment: StringOrNull;
266265

267266
if (this.isPendingWithdrawal()) {
268267
if (trigger === 'reject') {

src/app/shared/pipes/citation-format.pipe.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ export class CitationFormatPipe implements PipeTransform {
1616
const middleInitials = this.getInitials(user.middleNames);
1717
const suffix = user.suffix ? `, ${this.formatSuffix(user.suffix)}` : '';
1818

19-
let cite = '';
20-
21-
if (format === 'apa') {
22-
const initials = [this.getInitials(givenName), middleInitials].filter(Boolean).join(' ');
23-
cite = `${familyName}, ${initials}${suffix}`;
24-
} else {
25-
cite = `${familyName}, ${givenName} ${middleInitials}${suffix}`.trim();
26-
}
19+
const initials = [this.getInitials(givenName), middleInitials].filter(Boolean).join(' ');
20+
const cite =
21+
format === 'apa'
22+
? `${familyName}, ${initials}${suffix}`
23+
: `${familyName}, ${givenName} ${middleInitials}${suffix}`.trim();
2724

2825
return cite.endsWith('.') ? cite : `${cite}.`;
2926
}

src/app/shared/services/csl-style-manager.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class CslStyleManagerService {
9595
const config = Cite.plugins.config.get('@csl');
9696
config.templates.add(styleId, cslXml);
9797
} catch (error) {
98-
throw new Error(`Failed to register CSL style ${styleId}: ${error?.toString()}`);
98+
throw new Error(`Failed to register CSL style ${styleId}: ${String(error)}`, { cause: error });
9999
}
100100
})
101101
);

src/app/shared/services/datacite/datacite.service.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function assertSendBeacon(
6565
doi: string,
6666
event: DataciteEvent
6767
) {
68-
expect(navigator.sendBeacon).toBeCalledTimes(1);
68+
expect(navigator.sendBeacon).toHaveBeenCalledTimes(1);
6969
expect(navigator.sendBeacon).toHaveBeenCalledWith(
7070
dataciteTrackerAddress,
7171
JSON.stringify({
@@ -87,6 +87,7 @@ describe('DataciteService', () => {
8787
const dataciteTrackerRepoId = 'repo-123';
8888
describe('with proper configuration', () => {
8989
beforeEach(() => {
90+
sentry = {} as jest.Mocked<any>;
9091
Object.defineProperty(navigator, 'sendBeacon', {
9192
configurable: true,
9293
value: jest.fn(() => false),

0 commit comments

Comments
 (0)