Skip to content

Commit f8cf90a

Browse files
committed
fix: resolve ESLint errors and warnings
1 parent f458b0d commit f8cf90a

File tree

4 files changed

+11
-38
lines changed

4 files changed

+11
-38
lines changed

packages/ci/vitest.int.config.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
import { createIntTestConfig } from '../../testing/test-setup-config/src/index.js';
22

3-
const baseConfig = createIntTestConfig('ci');
4-
5-
const config = {
6-
...baseConfig,
7-
test: {
8-
...baseConfig.test,
9-
setupFiles: [
10-
...(baseConfig.test!.setupFiles || []),
11-
'../../testing/test-setup/src/lib/logger.mock.ts',
12-
],
13-
},
14-
};
15-
16-
export default config;
3+
export default createIntTestConfig('ci');

packages/ci/vitest.unit.config.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
import { createUnitTestConfig } from '../../testing/test-setup-config/src/index.js';
22

3-
const baseConfig = createUnitTestConfig('ci');
4-
5-
const config = {
6-
...baseConfig,
7-
test: {
8-
...baseConfig.test,
9-
setupFiles: [
10-
...(baseConfig.test!.setupFiles || []),
11-
'../../testing/test-setup/src/lib/logger.mock.ts',
12-
],
13-
},
14-
};
15-
16-
export default config;
3+
export default createUnitTestConfig('ci');

packages/utils/src/lib/logger.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable max-lines, no-console */
1+
/* eslint-disable max-lines, no-console, @typescript-eslint/class-methods-use-this */
22
import ansis, { type AnsiColors } from 'ansis';
33
import os from 'node:os';
44
import path from 'node:path';
@@ -13,8 +13,12 @@ type GroupColor = Extract<AnsiColors, 'cyan' | 'magenta'>;
1313
type CiPlatform = 'GitHub Actions' | 'GitLab CI/CD';
1414

1515
const HEX_RADIX = 16;
16-
const SIGINT_EXIT_CODE_UNIX = 130;
17-
const SIGINT_EXIT_CODE_WINDOWS = 2;
16+
17+
const SIGINT_CODE = 2;
18+
// https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html#:~:text=When%20a%20command%20terminates%20on%20a%20fatal%20signal%20whose%20number%20is%20N%2C%20Bash%20uses%20the%20value%20128%2BN%20as%20the%20exit%20status.
19+
const SIGNALS_CODE_OFFSET_UNIX = 128;
20+
const SIGINT_EXIT_CODE_UNIX = SIGNALS_CODE_OFFSET_UNIX + SIGINT_CODE;
21+
const SIGINT_EXIT_CODE_WINDOWS = SIGINT_CODE;
1822

1923
/**
2024
* Rich logging implementation for Code PushUp CLI, plugins, etc.
@@ -196,10 +200,7 @@ export class Logger {
196200
await this.#spinner(worker, {
197201
pending: title,
198202
success: value => value,
199-
failure: error => {
200-
const errorMessage = String(error);
201-
return `${title}${ansis.red(errorMessage)}`;
202-
},
203+
failure: error => `${title}${ansis.red(String(error))}`,
203204
});
204205
}
205206

@@ -476,15 +477,13 @@ export class Logger {
476477
);
477478
}
478479

479-
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
480480
#colorize(text: string, color: AnsiColors | undefined): string {
481481
if (!color) {
482482
return text;
483483
}
484484
return ansis[color](text);
485485
}
486486

487-
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
488487
#formatDurationSuffix({
489488
start,
490489
end,

testing/test-setup-config/src/lib/vitest-setup-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable sonarjs/no-duplicate-string */
12
import type { TestKind } from './vitest-config-factory.js';
23

34
/**
@@ -19,7 +20,6 @@ const CUSTOM_MATCHERS = [
1920
* which is why they use `../../` to navigate to the workspace root first.
2021
*/
2122
const UNIT_TEST_SETUP_FILES = [
22-
// eslint-disable-next-line sonarjs/no-duplicate-string
2323
'../../testing/test-setup/src/lib/reset.mocks.ts',
2424
'../../testing/test-setup/src/lib/fs.mock.ts',
2525
'../../testing/test-setup/src/lib/logger.mock.ts',

0 commit comments

Comments
 (0)