Skip to content

Commit 6dfe853

Browse files
committed
lint fixes
1 parent 473a6d5 commit 6dfe853

5 files changed

Lines changed: 145 additions & 70 deletions

File tree

packages/@react-native-windows/cli/src/commands/setupModuleWindows/setupModuleWindows.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import {
2121
} from '../../utils/telemetryHelpers';
2222
import type {SetupModuleWindowsOptions} from './setupModuleWindowsOptions';
2323
import {setupModuleWindowsOptions} from './setupModuleWindowsOptions';
24-
import {validateEnvironment, checkForExistingSpec} from './utils/validationUtils';
24+
import {
25+
validateEnvironment,
26+
checkForExistingSpec,
27+
} from './utils/validationUtils';
2528
import {
2629
getFinalModuleName,
2730
updatePackageJsonCodegen,
@@ -39,7 +42,10 @@ import {generateStubFiles} from './utils/templateGenerationUtils';
3942
* @param value The unsanitized value of the option.
4043
* @returns The sanitized value of the option.
4144
*/
42-
function optionSanitizer(key: keyof SetupModuleWindowsOptions, value: any): any {
45+
function optionSanitizer(
46+
key: keyof SetupModuleWindowsOptions,
47+
value: any,
48+
): any {
4349
// Do not add a default case here.
4450
// Strings risking PII should just return true if present, false otherwise.
4551
// All others should return the value (or false if undefined).
@@ -114,9 +120,12 @@ export class SetupModuleWindows {
114120

115121
// Print success message with helpful information
116122
const paths = this.getActualProjectPaths();
117-
123+
118124
// Get the actual module name from the project path
119-
const moduleName = await getFinalModuleName(this.root, this.actualModuleName);
125+
const moduleName = await getFinalModuleName(
126+
this.root,
127+
this.actualModuleName,
128+
);
120129
let displayModuleName = moduleName;
121130
if (this.actualProjectPath) {
122131
// Extract the module name from the actual project path
@@ -142,7 +151,9 @@ export class SetupModuleWindows {
142151
);
143152

144153
console.log(
145-
`\n${chalk.blue('Learn More:')} https://microsoft.github.io/react-native-windows/docs/native-platform`,
154+
`\n${chalk.blue(
155+
'Learn More:',
156+
)} https://microsoft.github.io/react-native-windows/docs/native-platform`,
146157
);
147158
}
148159
}
@@ -216,4 +227,4 @@ export const setupModuleWindowsCommand: Command = {
216227
'Streamlined setup of Windows support for React Native community modules',
217228
func: setupModuleWindows,
218229
options: setupModuleWindowsOptions,
219-
};
230+
};

packages/@react-native-windows/cli/src/commands/setupModuleWindows/utils/moduleNameUtils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ export async function updatePackageJsonCodegen(
7676

7777
await fs.writeFile(packageJsonPath, JSON.stringify(pkgJson, null, 2));
7878
if (logging) {
79-
console.log(
80-
'[SetupModuleWindows] Added codegenConfig to package.json',
81-
);
79+
console.log('[SetupModuleWindows] Added codegenConfig to package.json');
8280
}
8381
} else {
8482
if (logging) {
@@ -87,4 +85,4 @@ export async function updatePackageJsonCodegen(
8785
);
8886
}
8987
}
90-
}
88+
}

packages/@react-native-windows/cli/src/commands/setupModuleWindows/utils/projectSetupUtils.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@ export async function runInitWindows(
3131
try {
3232
// If using cpp-lib template and example directory exists but doesn't have a proper package.json,
3333
// temporarily rename it to avoid template processing issues
34-
if ((options.template || 'cpp-lib') === 'cpp-lib' &&
35-
await fs.exists(exampleDir) &&
36-
!await fs.exists(examplePackageJson)) {
34+
if (
35+
(options.template || 'cpp-lib') === 'cpp-lib' &&
36+
(await fs.exists(exampleDir)) &&
37+
!(await fs.exists(examplePackageJson))
38+
) {
3739
tempExampleDir = path.join(root, 'example.temp.setup-module-windows');
3840
await fs.rename(exampleDir, tempExampleDir);
3941
temporarilyRenamed = true;
4042
if (options.logging) {
41-
console.log('[SetupModuleWindows] Temporarily renamed example directory to avoid conflicts');
43+
console.log(
44+
'[SetupModuleWindows] Temporarily renamed example directory to avoid conflicts',
45+
);
4246
}
4347
}
4448

@@ -54,7 +58,7 @@ export async function runInitWindows(
5458
overwrite: true,
5559
namespace: '',
5660
});
57-
61+
5862
if (options.logging) {
5963
console.log('[SetupModuleWindows] init-windows completed successfully');
6064
}
@@ -75,7 +79,10 @@ export async function runInitWindows(
7579
}
7680
} catch (restoreError: any) {
7781
if (options.logging) {
78-
console.log('[SetupModuleWindows] Warning: Failed to restore example directory:', restoreError.message);
82+
console.log(
83+
'[SetupModuleWindows] Warning: Failed to restore example directory:',
84+
restoreError.message,
85+
);
7986
}
8087
}
8188
}
@@ -102,7 +109,9 @@ export async function runCodegenWindows(
102109
telemetry: options.telemetry,
103110
});
104111
if (options.logging) {
105-
console.log('[SetupModuleWindows] codegen-windows completed successfully');
112+
console.log(
113+
'[SetupModuleWindows] codegen-windows completed successfully',
114+
);
106115
}
107116
} catch (error: any) {
108117
// Check if codegen directory was created even with errors
@@ -146,4 +155,4 @@ export function getActualProjectPaths(
146155
headerPath: `windows/${moduleName}/${moduleName}.h`,
147156
cppPath: `windows/${moduleName}/${moduleName}.cpp`,
148157
};
149-
}
158+
}

0 commit comments

Comments
 (0)