Skip to content

Commit d6b7fa3

Browse files
committed
chore: update dependencies
1 parent 0e7d361 commit d6b7fa3

40 files changed

+2735
-2234
lines changed

cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ interface RunCommandOptions {
100100
* @returns {void} This function does not return a value but may exit the
101101
* process.
102102
*/
103-
export let run = (): void => {
103+
export function run(): void {
104104
let cli = cac('eslint-rule-benchmark')
105105

106106
cli.version(version).help()

core/benchmark/calculate-statistics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { BenchmarkMetrics } from '../../types/benchmark-metrics'
99
* case.
1010
* @returns {BenchmarkMetrics} An object containing calculated metrics.
1111
*/
12-
export let calculateStatistics = (samples: number[]): BenchmarkMetrics => {
12+
export function calculateStatistics(samples: number[]): BenchmarkMetrics {
1313
if (samples.length === 0) {
1414
return {
1515
sampleCount: 0,

core/benchmark/create-bench.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ interface CreateBenchOptions {
2828
* @param {CreateBenchOptions} options - Benchmark configuration options.
2929
* @returns {Bench} Configured Tinybench instance ready for use.
3030
*/
31-
export let createBench = (options: CreateBenchOptions = {}): Bench =>
32-
new Bench({
31+
export function createBench(options: CreateBenchOptions = {}): Bench {
32+
return new Bench({
3333
warmupIterations: options.warmup
3434
? (options.warmupIterations ?? DEFAULT_WARMUP_ITERATIONS)
3535
: 0,
3636
warmupTime: options.warmup ? DEFAULT_WARMUP_TIME_MS : 0,
3737
iterations: options.iterations ?? DEFAULT_ITERATIONS,
3838
time: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
3939
})
40+
}

core/benchmark/create-benchmark-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ interface CreateBenchmarkConfigParameters {
4040
* benchmark configuration.
4141
* @returns {BenchmarkConfig} A configured benchmark configuration.
4242
*/
43-
export let createBenchmarkConfig = (
43+
export function createBenchmarkConfig(
4444
parameters: CreateBenchmarkConfigParameters,
45-
): BenchmarkConfig => {
45+
): BenchmarkConfig {
4646
let warmup: WarmupConfig = {
4747
iterations: parameters.warmup?.iterations ?? DEFAULT_WARMUP_ITERATIONS,
4848
enabled: parameters.warmup?.enabled ?? DEFAULT_WARMUP_ENABLED,

core/benchmark/filter-outliers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* @returns {{ filteredSamples: number[]; outliersRemovedCount: number }} An
1515
* object containing the filtered samples and the count of removed outliers.
1616
*/
17-
export let filterOutliers = (
17+
export function filterOutliers(
1818
samples: number[],
1919
multiplier: number = 1.5,
20-
): { outliersRemovedCount: number; filteredSamples: number[] } => {
20+
): { outliersRemovedCount: number; filteredSamples: number[] } {
2121
if (samples.length === 0) {
2222
return { outliersRemovedCount: 0, filteredSamples: [] }
2323
}

core/benchmark/run-benchmark.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ type Language = (typeof LANGUAGES)[number]
6666
* calculated metrics for a benchmarked code sample. Returns null if no tasks
6767
* were run.
6868
*/
69-
export let runBenchmark = async (
69+
export async function runBenchmark(
7070
parameters: RunBenchmarkParameters,
71-
): Promise<ProcessedBenchmarkTask[] | null> => {
71+
): Promise<ProcessedBenchmarkTask[] | null> {
7272
let { configDirectory, testCases, config } = parameters
7373

7474
if (testCases.length === 0) {
@@ -109,9 +109,7 @@ export let runBenchmark = async (
109109
} catch (error: unknown) {
110110
let errorValue = error as Error
111111
console.error(
112-
`Failed to create ESLint instance for TestCase "${testCase.name}": ${
113-
errorValue.message
114-
}. Skipping this test case.`,
112+
`Failed to create ESLint instance for TestCase "${testCase.name}": ${errorValue.message}. Skipping this test case.`,
115113
)
116114
continue
117115
}

core/config/define-config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@ import type { UserBenchmarkConfig } from '../../types/user-benchmark-config'
6363
* @param {UserBenchmarkConfig} config - User configuration object.
6464
* @returns {UserBenchmarkConfig} The same configuration with proper typing.
6565
*/
66-
export let defineConfig = (config: UserBenchmarkConfig): UserBenchmarkConfig =>
67-
config
66+
export function defineConfig(config: UserBenchmarkConfig): UserBenchmarkConfig {
67+
return config
68+
}

core/config/load-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ let explorer = lilconfig('eslint-rule-benchmark', {
4848
* @param {string} configPath - Optional path to the configuration file.
4949
* @returns {Promise<LoadConfigResult>} Load configuration result.
5050
*/
51-
export let loadConfig = async (
51+
export async function loadConfig(
5252
configPath?: string,
53-
): Promise<LoadConfigResult> => {
53+
): Promise<LoadConfigResult> {
5454
let searchDirectory = process.cwd()
5555
if (configPath) {
5656
searchDirectory = configPath

core/config/validate-config.ts

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,6 @@ import type {
66
UserBenchmarkConfig,
77
} from '../../types/user-benchmark-config'
88

9-
/**
10-
* Validates BaseBenchmarkSettings (iterations, timeout, warmup).
11-
*
12-
* @param {Partial<BaseBenchmarkSettings>} [settings] - The settings object to
13-
* validate. Defaults to an empty object if not provided.
14-
* @returns {string[]} Array of validation error messages.
15-
*/
16-
let validateBaseBenchmarkSettings = (
17-
settings: Partial<BaseBenchmarkSettings> = {},
18-
): string[] => {
19-
let errors: string[] = []
20-
21-
if (
22-
settings.iterations !== undefined &&
23-
(typeof settings.iterations !== 'number' || settings.iterations <= 0)
24-
) {
25-
errors.push(`"iterations" must be a positive number`)
26-
}
27-
28-
if (
29-
settings.timeout !== undefined &&
30-
(typeof settings.timeout !== 'number' || settings.timeout <= 0)
31-
) {
32-
errors.push(`"timeout" must be a positive number`)
33-
}
34-
35-
if (settings.warmup !== undefined) {
36-
if (typeof settings.warmup === 'object') {
37-
if (
38-
settings.warmup.iterations !== undefined &&
39-
(typeof settings.warmup.iterations !== 'number' ||
40-
settings.warmup.iterations < 0)
41-
) {
42-
errors.push(`"warmup.iterations" must be a non-negative number`)
43-
}
44-
if (
45-
settings.warmup.enabled !== undefined &&
46-
typeof settings.warmup.enabled !== 'boolean'
47-
) {
48-
errors.push(`"warmup.enabled" must be a boolean`)
49-
}
50-
} else {
51-
errors.push(`"warmup" must be an object`)
52-
}
53-
}
54-
return errors
55-
}
56-
579
/**
5810
* Validates the user benchmark configuration according to the new structure,
5911
* including global settings, individual test specifications (`testSpec`), and
@@ -78,10 +30,10 @@ let validateBaseBenchmarkSettings = (
7830
* @returns {Promise<string[]>} A promise that resolves to an array of
7931
* validation error messages. An empty array indicates a valid configuration.
8032
*/
81-
export let validateConfig = async (
33+
export async function validateConfig(
8234
config: Partial<UserBenchmarkConfig>,
8335
configDirectory: string,
84-
): Promise<string[]> => {
36+
): Promise<string[]> {
8537
let errors: string[] = []
8638

8739
if (
@@ -202,3 +154,51 @@ export let validateConfig = async (
202154

203155
return errors
204156
}
157+
158+
/**
159+
* Validates BaseBenchmarkSettings (iterations, timeout, warmup).
160+
*
161+
* @param {Partial<BaseBenchmarkSettings>} [settings] - The settings object to
162+
* validate. Defaults to an empty object if not provided.
163+
* @returns {string[]} Array of validation error messages.
164+
*/
165+
function validateBaseBenchmarkSettings(
166+
settings: Partial<BaseBenchmarkSettings> = {},
167+
): string[] {
168+
let errors: string[] = []
169+
170+
if (
171+
settings.iterations !== undefined &&
172+
(typeof settings.iterations !== 'number' || settings.iterations <= 0)
173+
) {
174+
errors.push(`"iterations" must be a positive number`)
175+
}
176+
177+
if (
178+
settings.timeout !== undefined &&
179+
(typeof settings.timeout !== 'number' || settings.timeout <= 0)
180+
) {
181+
errors.push(`"timeout" must be a positive number`)
182+
}
183+
184+
if (settings.warmup !== undefined) {
185+
if (typeof settings.warmup === 'object') {
186+
if (
187+
settings.warmup.iterations !== undefined &&
188+
(typeof settings.warmup.iterations !== 'number' ||
189+
settings.warmup.iterations < 0)
190+
) {
191+
errors.push(`"warmup.iterations" must be a non-negative number`)
192+
}
193+
if (
194+
settings.warmup.enabled !== undefined &&
195+
typeof settings.warmup.enabled !== 'boolean'
196+
) {
197+
errors.push(`"warmup.enabled" must be a boolean`)
198+
}
199+
} else {
200+
errors.push(`"warmup" must be an object`)
201+
}
202+
}
203+
return errors
204+
}

core/eslint/create-eslint-instance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ let jiti = createJiti(import.meta.url, {
4242
* the ESLint instance.
4343
* @returns {Promise<ESLint>} Promise resolving to configured ESLint instance.
4444
*/
45-
export let createESLintInstance = async (
45+
export async function createESLintInstance(
4646
instanceOptions: CreateESLintInstanceOptions,
47-
): Promise<ESLint> => {
47+
): Promise<ESLint> {
4848
let { configDirectory, languages, rule } = instanceOptions
4949

5050
let { path: rulePath, severity, options, ruleId } = rule

0 commit comments

Comments
 (0)