Skip to content

Commit ba092bf

Browse files
yungstersfacebook-github-bot
authored andcommitted
RN: Add Missing @format Annotations (facebook#51415)
Summary: Pull Request resolved: facebook#51415 Adds the `format` annotation to all files that were missing them. Also, adds `noformat` to generated files, and removed it from files that no longer need them. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D74901034 fbshipit-source-id: 7e0b85ca8ee2de41278f3aa23cb03e9c266d9c28
1 parent ef17880 commit ba092bf

File tree

18 files changed

+268
-119
lines changed

18 files changed

+268
-119
lines changed

packages/debugger-frontend/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @flow strict-local
8-
* @noformat
8+
* @format
99
*/
1010

1111
const path = require('path');
@@ -33,4 +33,4 @@ if (process.env.REACT_NATIVE_DEBUGGER_FRONTEND_PATH != null) {
3333
);
3434
}
3535

36-
module.exports = (frontEndPath /*: string */);
36+
module.exports = frontEndPath /*:: as string */;

packages/helloworld/.prettierrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
68
*/
79

810
module.exports = {

packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
68
*/
79

810
'use strict';

packages/react-native-codegen-typescript-test/scripts/build.js

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,45 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
8+
* @lint-ignore-every LICENSELINT
69
*/
710

811
const fs = require('fs');
912
const path = require('path');
1013

11-
const tsComponentFixturePath = path.join(__dirname, '../../react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js');
12-
const tsComponentSnapshotPath = path.join(__dirname, '../../react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap');
13-
const tsModuleFixturePath = path.join(__dirname, '../../react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js');
14-
const tsModuleSnapshotPath = path.join(__dirname, '../../react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap');
14+
const tsComponentFixturePath = path.join(
15+
__dirname,
16+
'../../react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js',
17+
);
18+
const tsComponentSnapshotPath = path.join(
19+
__dirname,
20+
'../../react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap',
21+
);
22+
const tsModuleFixturePath = path.join(
23+
__dirname,
24+
'../../react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js',
25+
);
26+
const tsModuleSnapshotPath = path.join(
27+
__dirname,
28+
'../../react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap',
29+
);
1530
const snapshotOutputPath = path.join(__dirname, '../__generated__');
1631

17-
function genereateSnapshotTestCases(name, fixturePath, snapshotPath, outputPath) {
18-
const fixtures = require(fixturePath);
19-
const snapshots = require(snapshotPath);
20-
for (const key of Object.keys(fixtures)) {
21-
const snapshotName = `RN Codegen TypeScript Parser can generate fixture ${key} 1`;
22-
const snapshotString = snapshots[snapshotName];
23-
const snapshot = snapshotString.substring(2, snapshotString.length - 2);
24-
const tsSourceCode = `
32+
function genereateSnapshotTestCases(
33+
name,
34+
fixturePath,
35+
snapshotPath,
36+
outputPath,
37+
) {
38+
const fixtures = require(fixturePath);
39+
const snapshots = require(snapshotPath);
40+
for (const key of Object.keys(fixtures)) {
41+
const snapshotName = `RN Codegen TypeScript Parser can generate fixture ${key} 1`;
42+
const snapshotString = snapshots[snapshotName];
43+
const snapshot = snapshotString.substring(2, snapshotString.length - 2);
44+
const tsSourceCode = `
2545
/**
2646
* Copyright (c) Meta Platforms, Inc. and affiliates.
2747
*
@@ -34,9 +54,21 @@ import type { SchemaType } from '@react-native/codegen/lib/CodegenSchema';
3454
const snapshot : SchemaType = ${snapshot};
3555
export default snapshot;
3656
`;
37-
fs.writeFileSync(path.join(outputPath, `${name}_${key}.ts`), tsSourceCode, { encoding: 'utf-8' });
38-
}
57+
fs.writeFileSync(path.join(outputPath, `${name}_${key}.ts`), tsSourceCode, {
58+
encoding: 'utf-8',
59+
});
60+
}
3961
}
4062

41-
genereateSnapshotTestCases('component', tsComponentFixturePath, tsComponentSnapshotPath, snapshotOutputPath);
42-
genereateSnapshotTestCases('module', tsModuleFixturePath, tsModuleSnapshotPath, snapshotOutputPath);
63+
genereateSnapshotTestCases(
64+
'component',
65+
tsComponentFixturePath,
66+
tsComponentSnapshotPath,
67+
snapshotOutputPath,
68+
);
69+
genereateSnapshotTestCases(
70+
'module',
71+
tsModuleFixturePath,
72+
tsModuleSnapshotPath,
73+
snapshotOutputPath,
74+
);

packages/react-native-popup-menu-android/react-native.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
68
*/
79

810
module.exports = {
911
dependency: {
1012
platforms: {
1113
android: {
12-
'cmakeListsPath': '../android/src/main/jni/CMakeLists.txt',
14+
cmakeListsPath: '../android/src/main/jni/CMakeLists.txt',
1315
},
1416
},
1517
},

packages/react-native-popup-menu-android/scripts/prepublish-popup-menu-android.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
68
*/
79

810
/*
@@ -26,7 +28,9 @@ const fs = require('fs');
2628
const buildGradleKtsPath = 'android/build.gradle.kts';
2729
const libsVersionsTomlPath = '../react-native/gradle/libs.versions.toml';
2830

29-
console.log(`Updating ${buildGradleKtsPath} with versions from ${libsVersionsTomlPath}...`);
31+
console.log(
32+
`Updating ${buildGradleKtsPath} with versions from ${libsVersionsTomlPath}...`,
33+
);
3034

3135
let gradleContent = fs.readFileSync(buildGradleKtsPath, 'utf8');
3236
const tomlContent = fs.readFileSync(libsVersionsTomlPath, 'utf8');
@@ -39,7 +43,10 @@ gradleContent = gradleContent
3943
.replace('libs.versions.compileSdk.get().toInt()', compileSdk)
4044
.replace('libs.versions.minSdk.get().toInt()', minSdk)
4145
.replace('libs.versions.buildTools.get()', `"${buildTools}"`)
42-
.replace('project(":packages:react-native:ReactAndroid")', '"com.facebook.react:react-android"');
46+
.replace(
47+
'project(":packages:react-native:ReactAndroid")',
48+
'"com.facebook.react:react-android"',
49+
);
4350

4451
fs.writeFileSync(buildGradleKtsPath, gradleContent);
4552

packages/react-native-test-library/babel.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
68
*/
79

810
module.exports = {
9-
presets: [['module:@react-native/babel-preset', {disableStaticViewConfigsCodegen: false}]],
11+
presets: [
12+
[
13+
'module:@react-native/babel-preset',
14+
{disableStaticViewConfigsCodegen: false},
15+
],
16+
],
1017
};

packages/react-native-test-library/react-native.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
68
*/
79

810
module.exports = {
911
dependency: {
1012
platforms: {
1113
android: {
12-
'cmakeListsPath': '../android/src/main/jni/CMakeLists.txt',
14+
cmakeListsPath: '../android/src/main/jni/CMakeLists.txt',
1315
},
1416
},
1517
},

packages/react-native/Libraries/Components/__tests__/Button-test.js

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
68
*/
79

810
import {create} from '../../../jest/renderer';
@@ -14,46 +16,84 @@ describe('<Button />', () => {
1416
expect(await create(<Button title="Test Button" />)).toMatchSnapshot();
1517
});
1618

17-
it('should be disabled and it should set accessibilityState to disabled when disabled={true}', async() => {
19+
it('should be disabled and it should set accessibilityState to disabled when disabled={true}', async () => {
1820
expect(
19-
await create(<Button title="Test Button" disabled={true} />)
21+
await create(<Button title="Test Button" disabled={true} />),
2022
).toMatchSnapshot();
2123
});
2224

23-
it('should be disabled when disabled={true} and accessibilityState={{disabled: true}}', async() => {
25+
it('should be disabled when disabled={true} and accessibilityState={{disabled: true}}', async () => {
2426
expect(
25-
await create(<Button title="Test Button" disabled={true} accessibilityState={{disabled: true}} />)
27+
await create(
28+
<Button
29+
title="Test Button"
30+
disabled={true}
31+
accessibilityState={{disabled: true}}
32+
/>,
33+
),
2634
).toMatchSnapshot();
2735
});
2836

29-
it('should be disabled when disabled is empty and accessibilityState={{disabled: true}}',async () => {
37+
it('should be disabled when disabled is empty and accessibilityState={{disabled: true}}', async () => {
3038
expect(
31-
await create(<Button title="Test Button" accessibilityState={{disabled: true}} />)
39+
await create(
40+
<Button title="Test Button" accessibilityState={{disabled: true}} />,
41+
),
3242
).toMatchSnapshot();
3343
});
3444

35-
it('should overwrite accessibilityState with value of disabled prop', async() => {
36-
expect(await create(<Button title="Test Button" disabled={true} accessibilityState={{disabled: false}} />)
45+
it('should overwrite accessibilityState with value of disabled prop', async () => {
46+
expect(
47+
await create(
48+
<Button
49+
title="Test Button"
50+
disabled={true}
51+
accessibilityState={{disabled: false}}
52+
/>,
53+
),
3754
).toMatchSnapshot();
3855
});
3956

40-
it('should not be disabled when disabled={false} and accessibilityState={{disabled: true}}', async() => {
41-
expect(await create(<Button title="Test Button" disabled={false} accessibilityState={{disabled: true}} />)
57+
it('should not be disabled when disabled={false} and accessibilityState={{disabled: true}}', async () => {
58+
expect(
59+
await create(
60+
<Button
61+
title="Test Button"
62+
disabled={false}
63+
accessibilityState={{disabled: true}}
64+
/>,
65+
),
4266
).toMatchSnapshot();
4367
});
4468

45-
it('should not be disabled when disabled={false} and accessibilityState={{disabled: false}}', async() => {
46-
expect(await create( <Button title="Test Button" disabled={false} accessibilityState={{disabled: false}} />)
69+
it('should not be disabled when disabled={false} and accessibilityState={{disabled: false}}', async () => {
70+
expect(
71+
await create(
72+
<Button
73+
title="Test Button"
74+
disabled={false}
75+
accessibilityState={{disabled: false}}
76+
/>,
77+
),
4778
).toMatchSnapshot();
4879
});
4980

50-
it('should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no-hide-descendants}', async() => {
51-
expect(await create( <Button title="Test Button" importantForAccessibility={'no-hide-descendants'} />)
81+
it('should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no-hide-descendants}', async () => {
82+
expect(
83+
await create(
84+
<Button
85+
title="Test Button"
86+
importantForAccessibility={'no-hide-descendants'}
87+
/>,
88+
),
5289
).toMatchSnapshot();
5390
});
5491

55-
it('should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no}', async() => {
56-
expect( await create( <Button title="Test Button" importantForAccessibility={'no'} />)
92+
it('should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no}', async () => {
93+
expect(
94+
await create(
95+
<Button title="Test Button" importantForAccessibility={'no'} />,
96+
),
5797
).toMatchSnapshot();
5898
});
5999
});

packages/react-native/Libraries/Core/ReactNativeVersion.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @flow strict
8+
* @noformat
89
* @generated by scripts/releases/set-version.js
910
*/
1011

packages/react-native/scripts/featureflags/templates/js/NativeReactNativeFeatureFlags.js-template.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default function (definitions: FeatureFlagDefinitions): string {
2222
*
2323
* ${signedsource.getSigningToken()}
2424
* @flow strict
25+
* @noformat
2526
*/
2627
2728
${DO_NOT_MODIFY_COMMENT}

packages/react-native/scripts/featureflags/templates/js/ReactNativeFeatureFlags.js-template.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default function (definitions: FeatureFlagDefinitions): string {
2222
*
2323
* ${signedsource.getSigningToken()}
2424
* @flow strict
25+
* @noformat
2526
*/
2627
2728
${DO_NOT_MODIFY_COMMENT}

packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<2dc9ec2ea173f10586a67940720f1d37>>
7+
* @generated SignedSource<<29691b2062c240377834a01ced24c71c>>
88
* @flow strict
9+
* @noformat
910
*/
1011

1112
/**

packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<a7ffa9ddffa2dac8da58de63940981fb>>
7+
* @generated SignedSource<<59ebee6019b99a8c6a29dfc1eb036194>>
88
* @flow strict
9+
* @noformat
910
*/
1011

1112
/**

0 commit comments

Comments
 (0)