fix(iOS): fix Prettier lint failure after SwiftPM support landed (#57564)

Summary:
The OSS lint job went red after the SwiftPM stack landed (https://github.com/react/react-native/issues/57332 and its base PRs). The failing signal is the **Prettier** step of the `lint` job.

The offending file (introduced in base PR https://github.com/react/react-native/issues/57442) is:

`packages/react-native/scripts/ios-prebuild/__tests__/headers-xcframework-test.js`

```js
let tmp /*: string */;
```

This is a Flow *comment-type annotation* on an **uninitialized** `let`. Prettier reformats an uninitialized declaration by moving the trailing comment past the semicolon:

```js
let tmp; /*: string */   // annotation detached — no longer a type annotation
```

Because CI runs `prettier --list-different` (fails on any diff), this made the lint job fail. Prettier only keeps the `/*: string */` annotation inline when the declaration has an initializer, so the fix is to give `tmp` one:

```js
let tmp /*: string */ = '';
```

Semantically safe — `tmp` is assigned in `beforeEach` before any use.

## Changelog:

[INTERNAL] [FIXED] - Fix Prettier lint failure in `headers-xcframework` test

Pull Request resolved: https://github.com/react/react-native/pull/57564

Test Plan:
- `yarn format-check` — clean across the repo
- `yarn lint` (ESLint) — passes
- `yarn lint-markdown` — passes
- `yarn test-typescript-legacy` — passes
- Jest `headers-xcframework-test.js` — all 5 tests pass

Reviewed By: cortinico, fabriziocucci

Differential Revision: D112114604

Pulled By: cipolleschi

fbshipit-source-id: 9f2d116eae0cf5581cf0e1a1e79c0c3b28f7c176
This commit is contained in:
Riccardo Cipolleschi
2026-07-15 07:16:41 -07:00
committed by meta-codesync[bot]
parent 27b5f761b1
commit a693f41e5b
@@ -20,7 +20,7 @@ const os = require('os');
const path = require('path');
describe('buildDepsHeadersXcframework set-equality gate', () => {
let tmp /*: string */;
let tmp /*: string */ = '';
beforeEach(() => {
tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'deps-headers-test-'));
});