Skip to content

Commit a36ab22

Browse files
authored
Merge pull request #1444 from Hexastack/fix/api-lint-add-rule-2025-11-05
fix(api): update eslint padding-line-between-statements rule
2 parents 00994fd + 0dfe477 commit a36ab22

File tree

200 files changed

+381
-424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+381
-424
lines changed

packages/api/eslint.config.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ const createConfig = ({ headerYear = '2025' } = {}) => {
7979
2,
8080
{ blankLine: 'always', prev: '*', next: 'export' },
8181
{ blankLine: 'always', prev: '*', next: 'function' },
82+
{ blankLine: 'always', prev: '*', next: 'return' },
83+
{ blankLine: 'never', prev: 'const', next: 'const' },
8284
],
8385
'lines-between-class-members': ['warn', 'always'],
8486
'no-console': 2,

packages/api/src/analytics/controllers/bot-stats.controller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class BotStatsController extends BaseOrmController<
5050
BotStatsType.outgoing,
5151
];
5252
const result = await this.botStatsService.findMessages(from, to, types);
53+
5354
return BotStatsOrmEntity.toLines(result, types);
5455
}
5556

@@ -86,8 +87,8 @@ export class BotStatsController extends BaseOrmController<
8687
BotStatsType.new_conversations,
8788
BotStatsType.existing_conversations,
8889
];
89-
9090
const result = await this.botStatsService.findMessages(from, to, types);
91+
9192
return BotStatsOrmEntity.toLines(result, types);
9293
}
9394

@@ -108,8 +109,8 @@ export class BotStatsController extends BaseOrmController<
108109
BotStatsType.returning_users,
109110
BotStatsType.retention,
110111
];
111-
112112
const result = await this.botStatsService.findMessages(from, to, types);
113+
113114
return BotStatsOrmEntity.toLines(result, types);
114115
}
115116

packages/api/src/analytics/entities/bot-stats.entity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,19 @@ export class BotStatsOrmEntity extends BaseOrmEntity {
7373
values: [],
7474
} as ToLinesType;
7575
});
76-
7776
const index: { [dataName: string]: number } = data.reduce(
7877
(acc, curr, i) => {
7978
acc[curr.name] = i;
79+
8080
return acc;
8181
},
8282
{},
8383
);
84-
8584
const result = stats.reduce(
8685
(acc, stat: BotStatsOrmEntity & { date: Date }) => {
8786
stat.date = stat.day;
8887
acc[index[stat.type]].values.push(stat);
88+
8989
return acc;
9090
},
9191
data,

packages/api/src/analytics/services/bot-stats.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('BotStatsService', () => {
3636
if (leftTime !== rightTime) {
3737
return leftTime - rightTime;
3838
}
39+
3940
return left.type.localeCompare(right.type);
4041
});
4142

@@ -186,7 +187,6 @@ describe('BotStatsService', () => {
186187
assignedToId: null,
187188
...partial,
188189
}) as unknown as SubscriberOrmEntity;
189-
190190
const buildEvent = ({
191191
entity,
192192
databaseEntity,

packages/api/src/analytics/validation-rules/is-less-than-date.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export function IsLessThanDate(
2727
if (relatedValue) {
2828
return value <= relatedValue;
2929
}
30+
3031
return true;
3132
},
3233
},

packages/api/src/app.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class AppController {
4444
@Get('__getcookie')
4545
cookies(@Req() req: Request): string {
4646
req.session.anonymous = true;
47+
4748
return '';
4849
}
4950
}

packages/api/src/app.instance.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class AppInstance {
1717
if (!this.app) {
1818
throw new Error('App instance has not been set yet.');
1919
}
20+
2021
return this.app;
2122
}
2223

packages/api/src/attachment/controllers/attachment.controller.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ describe('AttachmentController', () => {
104104
it('should forward TypeORM options to the service', async () => {
105105
const findSpy = jest.spyOn(attachmentService, 'find');
106106
const name = attachmentFixtures[0].name;
107-
108107
const options = {
109108
where: { name },
110109
take: 5,
@@ -127,7 +126,6 @@ describe('AttachmentController', () => {
127126
it('should count attachments', async () => {
128127
const countSpy = jest.spyOn(attachmentService, 'count');
129128
const name = attachmentFixtures[0].name;
130-
131129
const result = await attachmentController.filterCount({
132130
where: { name },
133131
});

packages/api/src/attachment/controllers/attachment.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class AttachmentController extends BaseOrmController<
7979
this.logger.warn(`Unable to find Attachment by id ${id}`);
8080
throw new NotFoundException(`Attachment with ID ${id} not found`);
8181
}
82+
8283
return attachment;
8384
}
8485

packages/api/src/attachment/guards/attachment-ability.guard.spec.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@ describe('AttachmentGuard', () => {
4141
subscriber: 'subscriber-model-id',
4242
user: 'user-model-id',
4343
};
44-
4544
const buildContext = (request: Partial<Request>) =>
4645
({
4746
switchToHttp: jest.fn().mockReturnValue({
4847
getRequest: jest.fn().mockReturnValue(request),
4948
}),
5049
}) as unknown as ExecutionContext;
51-
5250
const mockModelFindOne = () =>
5351
jest.spyOn(modelService, 'findOne').mockImplementation((criteria) => {
5452
const identity = (criteria as { where?: { identity?: TModel } }).where
@@ -60,6 +58,7 @@ describe('AttachmentGuard', () => {
6058
new Error(`Unexpected model identity: ${identity}`),
6159
);
6260
}
61+
6362
return Promise.resolve({
6463
id,
6564
identity,
@@ -98,18 +97,15 @@ describe('AttachmentGuard', () => {
9897
it('should allow GET requests with valid ref', async () => {
9998
const mockUser = { roles: ['admin-id'] } as any;
10099
const mockRef = [AttachmentResourceRef.UserAvatar];
101-
102100
const modelFindOne = mockModelFindOne();
103101
const permissionFindOne = jest
104102
.spyOn(permissionService, 'findOne')
105103
.mockResolvedValue({} as Permission);
106-
107104
const mockExecutionContext = buildContext({
108105
query: { where: { resourceRef: mockRef } },
109106
method: 'GET',
110107
user: mockUser,
111108
});
112-
113109
const result = await guard.canActivate(mockExecutionContext);
114110
expect(result).toBe(true);
115111

@@ -152,13 +148,11 @@ describe('AttachmentGuard', () => {
152148
const permissionFindOne = jest
153149
.spyOn(permissionService, 'findOne')
154150
.mockResolvedValue({} as Permission);
155-
156151
const mockExecutionContext = buildContext({
157152
params: { id: attachmentId },
158153
method: 'GET',
159154
user: mockUser,
160155
});
161-
162156
const result = await guard.canActivate(mockExecutionContext);
163157
expect(result).toBe(true);
164158

@@ -180,18 +174,15 @@ describe('AttachmentGuard', () => {
180174

181175
it('should allow POST requests with a valid ref', async () => {
182176
const mockUser = { roles: ['editor-id'] } as any;
183-
184177
const modelFindOne = mockModelFindOne();
185178
const permissionFindOne = jest
186179
.spyOn(permissionService, 'findOne')
187180
.mockResolvedValue({} as Permission);
188-
189181
const mockExecutionContext = buildContext({
190182
query: { resourceRef: AttachmentResourceRef.BlockAttachment },
191183
method: 'POST',
192184
user: mockUser,
193185
});
194-
195186
const result = await guard.canActivate(mockExecutionContext);
196187
expect(result).toBe(true);
197188

@@ -241,7 +232,6 @@ describe('AttachmentGuard', () => {
241232

242233
it('should allow DELETE requests with valid attachment and context', async () => {
243234
const mockUser = { roles: ['admin-id'] } as any;
244-
245235
const attachmentWithUuid = {
246236
...attachment,
247237
id: '5a1ea13e-63ef-48da-9afb-7b4d0533b1a0',
@@ -255,13 +245,11 @@ describe('AttachmentGuard', () => {
255245
const permissionFindOne = jest
256246
.spyOn(permissionService, 'findOne')
257247
.mockResolvedValue({} as Permission);
258-
259248
const mockExecutionContext = buildContext({
260249
method: 'DELETE',
261250
params: { id: attachmentWithUuid.id },
262251
user: mockUser,
263252
});
264-
265253
const result = await guard.canActivate(mockExecutionContext);
266254
expect(result).toBe(true);
267255

0 commit comments

Comments
 (0)