Skip to content

Commit b50b1e0

Browse files
committed
chore: update dependencies and improve variable naming
- Updated `p-limit` from version 6.2.0 to 7.0.0 in package.json. - Updated `@biomejs/biome` from version 1.9.4 to 2.2.0 in devDependencies. - Updated `textlint` from version 14.8.0 to 15.2.1 in devDependencies. - Refactored variable names in `dev-parse-modules.ts` for clarity: changed `config` to `_config`, `context` to `_context`, and `modules` to `_modules`. - Improved backward compatibility proxy in `config.ts` and `context.ts` by renaming the target parameter to `_target` for better readability.
1 parent 2f035a0 commit b50b1e0

File tree

14 files changed

+317
-557
lines changed

14 files changed

+317
-557
lines changed

__mocks__/@actions/core.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ type MockedFunction<TFunc> = TFunc extends (...args: infer TArgs) => infer TRetu
1414
* Writes a debug message to the user log.
1515
* @param message - The debug message to log.
1616
*/
17-
export const debug: MockedFunction<(message: string) => void> = vi.fn((message: string): void => {});
17+
export const debug: MockedFunction<(message: string) => void> = vi.fn((_message: string): void => {});
1818

1919
/**
2020
* Writes an informational message to the log.
2121
* @param message - The info message to log.
2222
*/
23-
export const info: MockedFunction<(message: string) => void> = vi.fn((message: string): void => {});
23+
export const info: MockedFunction<(message: string) => void> = vi.fn((_message: string): void => {});
2424

2525
/**
2626
* Adds a warning issue with optional annotation properties.
2727
* @param message - The warning message or error.
2828
* @param properties - Optional properties to add to the annotation.
2929
*/
3030
export const warning: MockedFunction<(message: string | Error, properties?: AnnotationProperties) => void> = vi.fn(
31-
(message: string | Error, properties?: AnnotationProperties): void => {},
31+
(_message: string | Error, _properties?: AnnotationProperties): void => {},
3232
);
3333

3434
/**
@@ -37,7 +37,7 @@ export const warning: MockedFunction<(message: string | Error, properties?: Anno
3737
* @param properties - Optional properties to add to the annotation.
3838
*/
3939
export const notice: MockedFunction<(message: string | Error, properties?: AnnotationProperties) => void> = vi.fn(
40-
(message: string | Error, properties?: AnnotationProperties): void => {},
40+
(_message: string | Error, _properties?: AnnotationProperties): void => {},
4141
);
4242

4343
/**
@@ -46,7 +46,7 @@ export const notice: MockedFunction<(message: string | Error, properties?: Annot
4646
* @param properties - Optional properties to add to the annotation.
4747
*/
4848
export const error: MockedFunction<(message: string | Error, properties?: AnnotationProperties) => void> = vi.fn(
49-
(message: string | Error, properties?: AnnotationProperties): void => {},
49+
(_message: string | Error, _properties?: AnnotationProperties): void => {},
5050
);
5151

5252
/**
@@ -55,13 +55,13 @@ export const error: MockedFunction<(message: string | Error, properties?: Annota
5555
* @param message - The error message or object.
5656
* @throws An error with the specified message.
5757
*/
58-
export const setFailed: MockedFunction<(message: string | Error) => void> = vi.fn((message: string | Error) => {});
58+
export const setFailed: MockedFunction<(message: string | Error) => void> = vi.fn((_message: string | Error) => {});
5959

6060
/**
6161
* Begins a new output group. Output until the next `endGroup` will be foldable in this group.
6262
* @param name - The name of the output group.
6363
*/
64-
export const startGroup: MockedFunction<(name: string) => void> = vi.fn((name: string): void => {});
64+
export const startGroup: MockedFunction<(name: string) => void> = vi.fn((_name: string): void => {});
6565

6666
/**
6767
* Ends the current output group.
@@ -109,36 +109,36 @@ export const getMultilineInput: MockedFunction<(name: string, options?: InputOpt
109109
* Masks a value in the log. When the masked value appears in the log, it is replaced with asterisks.
110110
* @param secret - Value to mask
111111
*/
112-
export const setSecret: MockedFunction<(secret: string) => void> = vi.fn((secret: string): void => {});
112+
export const setSecret: MockedFunction<(secret: string) => void> = vi.fn((_secret: string): void => {});
113113

114114
/**
115115
* Prepends the given path to the PATH environment variable.
116116
* @param inputPath - Path to prepend
117117
*/
118-
export const addPath: MockedFunction<(inputPath: string) => void> = vi.fn((inputPath: string): void => {});
118+
export const addPath: MockedFunction<(inputPath: string) => void> = vi.fn((_inputPath: string): void => {});
119119

120120
/**
121121
* Sets env variable for this action and future actions in the job.
122122
* @param name - Name of the variable to set
123123
* @param val - Value of the variable
124124
*/
125125
export const exportVariable: MockedFunction<(name: string, val: string) => void> = vi.fn(
126-
(name: string, val: string): void => {},
126+
(_name: string, _val: string): void => {},
127127
);
128128

129129
/**
130130
* Enables or disables the echoing of commands into stdout for the rest of the step.
131131
* @param enabled - True to enable echoing, false to disable
132132
*/
133-
export const setCommandEcho: MockedFunction<(enabled: boolean) => void> = vi.fn((enabled: boolean): void => {});
133+
export const setCommandEcho: MockedFunction<(enabled: boolean) => void> = vi.fn((_enabled: boolean): void => {});
134134

135135
/**
136136
* Begin an output group.
137137
* @param name - Name of the output group
138138
* @param fn - Function to execute within the output group
139139
*/
140140
export const group: MockedFunction<(name: string, fn: () => Promise<void>) => Promise<void>> = vi.fn(
141-
async (name: string, fn: () => Promise<void>): Promise<void> => {
141+
async (_name: string, fn: () => Promise<void>): Promise<void> => {
142142
await fn();
143143
},
144144
);
@@ -150,15 +150,15 @@ export const group: MockedFunction<(name: string, fn: () => Promise<void>) => Pr
150150
* @param value - Value to store. Non-string values will be converted to a string via JSON.stringify
151151
*/
152152
export const saveState: MockedFunction<(name: string, value: string) => void> = vi.fn(
153-
(name: string, value: string): void => {},
153+
(_name: string, _value: string): void => {},
154154
);
155155

156156
/**
157157
* Gets the value of an state set by this action's main execution.
158158
* @param name - Name of the state to get
159159
* @returns string
160160
*/
161-
export const getState: MockedFunction<(name: string) => string> = vi.fn((name: string): string => '');
161+
export const getState: MockedFunction<(name: string) => string> = vi.fn((_name: string): string => '');
162162

163163
/**
164164
* Gets whether Actions Step Debug is on or not
@@ -172,7 +172,7 @@ export const isDebug: MockedFunction<() => boolean> = vi.fn((): boolean => false
172172
* @returns string
173173
*/
174174
export const getIDToken: MockedFunction<(audience?: string) => Promise<string>> = vi.fn(
175-
async (audience?: string): Promise<string> => '',
175+
async (_audience?: string): Promise<string> => '',
176176
);
177177

178178
/**
@@ -181,7 +181,7 @@ export const getIDToken: MockedFunction<(audience?: string) => Promise<string>>
181181
* @param value - Value to store. Non-string values will be converted to a string via JSON.stringify
182182
*/
183183
export const setOutput: MockedFunction<(name: string, value: string) => void> = vi.fn(
184-
(name: string, value: string): void => {},
184+
(_name: string, _value: string): void => {},
185185
);
186186

187187
// Re-export types

__mocks__/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ let currentConfig: Config = { ...defaultConfig };
4040
* Config proxy handler.
4141
*/
4242
const configProxyHandler: ProxyHandler<ConfigWithMethods> = {
43-
set(target: ConfigWithMethods, key: string, value: unknown): boolean {
43+
set(_target: ConfigWithMethods, key: string, value: unknown): boolean {
4444
if (!validConfigKeys.includes(key as ValidConfigKey)) {
4545
throw new Error(`Invalid config key: ${key}`);
4646
}
@@ -49,15 +49,15 @@ const configProxyHandler: ProxyHandler<ConfigWithMethods> = {
4949
const expectedValue = defaultConfig[typedKey];
5050

5151
if ((Array.isArray(expectedValue) && Array.isArray(value)) || typeof expectedValue === typeof value) {
52-
// @ts-ignore - we know that the key is valid and that the value is correct
52+
// @ts-expect-error - we know that the key is valid and that the value is correct
5353
currentConfig[typedKey] = value as typeof expectedValue;
5454
return true;
5555
}
5656

5757
throw new TypeError(`Invalid value type for config key: ${key}`);
5858
},
5959

60-
get(target: ConfigWithMethods, prop: string | symbol): unknown {
60+
get(_target: ConfigWithMethods, prop: string | symbol): unknown {
6161
if (typeof prop === 'string') {
6262
if (prop === 'set') {
6363
return (overrides: Partial<Config> = {}) => {

__mocks__/context.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let currentContext: Context = { ...defaultContext };
5959
* Context proxy handler
6060
*/
6161
const contextProxyHandler: ProxyHandler<ContextWithMethods> = {
62-
set(target: ContextWithMethods, key: string, value: unknown): boolean {
62+
set(_target: ContextWithMethods, key: string, value: unknown): boolean {
6363
if (!validContextKeys.includes(key as ValidContextKey)) {
6464
throw new Error(`Invalid context key: ${key}`);
6565
}
@@ -68,15 +68,15 @@ const contextProxyHandler: ProxyHandler<ContextWithMethods> = {
6868
const expectedValue = defaultContext[typedKey];
6969

7070
if (typeof expectedValue === typeof value || (typedKey === 'octokit' && typeof value === 'object')) {
71-
// @ts-ignore - we know the key is valid and value type is correct
71+
// @ts-expect-error - we know the key is valid and value type is correct
7272
currentContext[typedKey] = value;
7373
return true;
7474
}
7575

7676
throw new TypeError(`Invalid value type for context key: ${key}`);
7777
},
7878

79-
get(target: ContextWithMethods, prop: string | symbol): unknown {
79+
get(_target: ContextWithMethods, prop: string | symbol): unknown {
8080
if (typeof prop === 'string') {
8181
if (prop === 'set') {
8282
return (overrides: Partial<Context> = {}) => {

__tests__/context.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe('context', () => {
216216
vi.mocked(startGroup).mockClear();
217217

218218
// Second access should not trigger initialization
219-
const prNumber = context.prNumber; // Intentionally access a property with no usage
219+
const _prNumber = context.prNumber; // Intentionally access a property with no usage
220220
expect(startGroup).not.toHaveBeenCalled();
221221
expect(info).not.toHaveBeenCalled();
222222
});

__tests__/tags.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('tags', () => {
5353
expect(debugCall).toBeDefined(); // Ensure there is a debug call
5454
const debugMessage = debugCall[0];
5555
expect(/^Total page requests: \d+$/.test(debugMessage)).toBe(true); // Check if it matches the format
56-
expect(Number.parseInt(debugMessage.split(': ')[1])).toBeGreaterThan(1); // Check if number > 1
56+
expect(Number.parseInt(debugMessage.split(': ')[1], 10)).toBeGreaterThan(1); // Check if number > 1
5757

5858
// Check the first info call for "Found X tags"
5959
const infoCall = vi.mocked(info).mock.calls[0]; // Get the first call
@@ -270,7 +270,7 @@ describe('tags', () => {
270270

271271
await expect(deleteTags(tagsToDelete)).rejects.toThrow(
272272
`Failed to delete repository tag: v1.0.0 Resource not accessible by integration.
273-
Ensure that the GitHub Actions workflow has the correct permissions to delete tags by ensuring that your workflow YAML file has the following block under \"permissions\":
273+
Ensure that the GitHub Actions workflow has the correct permissions to delete tags by ensuring that your workflow YAML file has the following block under "permissions":
274274
275275
permissions:
276276
contents: write`,

__tests__/terraform-docs.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ describe('terraform-docs', async () => {
251251
for (const file of cleanupFiles) {
252252
try {
253253
unlinkSync(file);
254-
} catch (err) {
254+
} catch (_err) {
255255
// Ignore cleanup errors
256256
}
257257
}

__tests__/utils/file.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ describe('utils/file', () => {
619619
// Create terraform file above workspace (if possible)
620620
try {
621621
writeFileSync(terraformFileAbove, 'resource "test" "example" {}');
622-
} catch (error) {
622+
} catch (_error) {
623623
// Skip this test if we can't write above tmpDir
624624
return;
625625
}
@@ -635,7 +635,7 @@ describe('utils/file', () => {
635635
// Cleanup
636636
try {
637637
rmSync(terraformFileAbove);
638-
} catch (error) {
638+
} catch (_error) {
639639
// Ignore cleanup errors
640640
}
641641
});

__tests__/wiki.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('wiki', async () => {
103103

104104
it('should handle unsetting config extraheader and throwing error accordingly', () => {
105105
const mockExecFileSync = vi.fn(
106-
(command: string, args?: readonly string[] | undefined, options?: ExecFileSyncOptions) => {
106+
(_command: string, args?: readonly string[] | undefined, _options?: ExecFileSyncOptions) => {
107107
if (args?.includes('--unset-all') && args.includes('http.https://github.com/.extraheader')) {
108108
const error = new Error('git config error') as ExecSyncError;
109109
error.status = 10;
@@ -131,7 +131,7 @@ describe('wiki', async () => {
131131

132132
it('should handle unsetting config extraheader gracefully', () => {
133133
const mockExecFileSync = vi.fn(
134-
(command: string, args?: readonly string[] | undefined, options?: ExecFileSyncOptions) => {
134+
(_command: string, args?: readonly string[] | undefined, _options?: ExecFileSyncOptions) => {
135135
if (args?.includes('--unset-all') && args.includes('http.https://github.com/.extraheader')) {
136136
const error = new Error('git config error') as ExecSyncError;
137137
error.status = 5;
@@ -168,7 +168,7 @@ describe('wiki', async () => {
168168

169169
// Reset mocks and configure remote command to return "origin"
170170
vi.clearAllMocks();
171-
vi.mocked(execFileSync).mockImplementation((cmd, args = []) => {
171+
vi.mocked(execFileSync).mockImplementation((_cmd, args = []) => {
172172
if (args[0] === 'remote') {
173173
return Buffer.from('origin');
174174
}

biome.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
33
"vcs": {
44
"enabled": true,
55
"clientKind": "git",
66
"useIgnoreFile": true
77
},
8+
"assist": {
9+
"enabled": false
10+
},
811
"files": {
9-
"ignore": ["dist", "node_modules"]
12+
"includes": ["*.md", "*.ts", "__mocks__/**/*.ts", "__tests__/**/*.ts", "src/**/*.ts", "scripts/**/*.ts"]
1013
},
1114
"formatter": {
1215
"enabled": true,
@@ -24,9 +27,6 @@
2427
}
2528
}
2629
},
27-
"organizeImports": {
28-
"enabled": true
29-
},
3030
"javascript": {
3131
"formatter": {
3232
"enabled": true,

0 commit comments

Comments
 (0)