Skip to content

Commit a2df667

Browse files
SamChou19815meta-codesync[bot]
authored andcommitted
Convert used Flow lint suppressions (#60154)
Summary: Pull Request resolved: #60154 Replace used `flowlint` directives with error-code-specific suppression comments on the affected lines. No runtime changes. Changelog: [Internal] ___ landed-with-radar-review Differential Revision: D133257719
1 parent 8771d39 commit a2df667

55 files changed

Lines changed: 413 additions & 106 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/react-native/Libraries/Animated/AnimatedExports.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @format
99
*/
1010

11-
// flowlint unsafe-getters-setters:off
12-
1311
import typeof AnimatedFlatList from './components/AnimatedFlatList';
1412
import typeof AnimatedImage from './components/AnimatedImage';
1513
import typeof AnimatedScrollView from './components/AnimatedScrollView';
@@ -29,36 +27,42 @@ export default {
2927
/**
3028
* @deprecated Use `AnimatedFlatList` instead.
3129
*/
30+
// $FlowFixMe[unsafe-getters-setters]
3231
get FlatList(): AnimatedFlatList<> {
3332
return require('./components/AnimatedFlatList').default;
3433
},
3534
/**
3635
* @deprecated Use `AnimatedImage` instead.
3736
*/
37+
// $FlowFixMe[unsafe-getters-setters]
3838
get Image(): AnimatedImage {
3939
return require('./components/AnimatedImage').default;
4040
},
4141
/**
4242
* @deprecated Use `AnimatedScrollView` instead.
4343
*/
44+
// $FlowFixMe[unsafe-getters-setters]
4445
get ScrollView(): AnimatedScrollView {
4546
return require('./components/AnimatedScrollView').default;
4647
},
4748
/**
4849
* @deprecated Use `AnimatedSectionList` instead.
4950
*/
51+
// $FlowFixMe[unsafe-getters-setters]
5052
get SectionList(): AnimatedSectionList<> {
5153
return require('./components/AnimatedSectionList').default;
5254
},
5355
/**
5456
* @deprecated Use `AnimatedText` instead.
5557
*/
58+
// $FlowFixMe[unsafe-getters-setters]
5659
get Text(): AnimatedText {
5760
return require('./components/AnimatedText').default;
5861
},
5962
/**
6063
* @deprecated Use `AnimatedView` instead.
6164
*/
65+
// $FlowFixMe[unsafe-getters-setters]
6266
get View(): AnimatedView {
6367
return require('./components/AnimatedView').default;
6468
},

‎packages/react-native/Libraries/Blob/File.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @format
99
*/
1010

11-
// flowlint unsafe-getters-setters:off
12-
1311
'use strict';
1412

1513
import type {BlobOptions} from './BlobTypes';
@@ -42,6 +40,7 @@ class File extends Blob {
4240
/**
4341
* Name of the file.
4442
*/
43+
// $FlowFixMe[unsafe-getters-setters]
4544
get name(): string {
4645
invariant(this.data.name != null, 'Files must have a name set.');
4746
return this.data.name;
@@ -50,6 +49,7 @@ class File extends Blob {
5049
/*
5150
* Last modified time of the file.
5251
*/
52+
// $FlowFixMe[unsafe-getters-setters]
5353
get lastModified(): number {
5454
return this.data.lastModified || 0;
5555
}

‎packages/react-native/Libraries/Blob/FileReader.js‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @format
99
*/
1010

11-
// flowlint unsafe-getters-setters:off
12-
1311
import type {EventCallback} from '../../src/private/webapis/dom/events/EventTarget';
1412
import type Blob from './Blob';
1513

@@ -227,62 +225,77 @@ class FileReader extends EventTarget {
227225
}
228226
}
229227

228+
// $FlowFixMe[unsafe-getters-setters]
230229
get readyState(): ReadyState {
231230
return this._readyState;
232231
}
233232

233+
// $FlowFixMe[unsafe-getters-setters]
234234
get error(): ?DOMException {
235235
return this._error;
236236
}
237237

238+
// $FlowFixMe[unsafe-getters-setters]
238239
get result(): ?ReaderResult {
239240
return this._result;
240241
}
241242

243+
// $FlowFixMe[unsafe-getters-setters]
242244
get onabort(): EventCallback | null {
243245
return getEventHandlerAttribute(this, 'abort');
244246
}
245247

248+
// $FlowFixMe[unsafe-getters-setters]
246249
set onabort(listener: ?EventCallback) {
247250
setEventHandlerAttribute(this, 'abort', listener);
248251
}
249252

253+
// $FlowFixMe[unsafe-getters-setters]
250254
get onerror(): EventCallback | null {
251255
return getEventHandlerAttribute(this, 'error');
252256
}
253257

258+
// $FlowFixMe[unsafe-getters-setters]
254259
set onerror(listener: ?EventCallback) {
255260
setEventHandlerAttribute(this, 'error', listener);
256261
}
257262

263+
// $FlowFixMe[unsafe-getters-setters]
258264
get onload(): EventCallback | null {
259265
return getEventHandlerAttribute(this, 'load');
260266
}
261267

268+
// $FlowFixMe[unsafe-getters-setters]
262269
set onload(listener: ?EventCallback) {
263270
setEventHandlerAttribute(this, 'load', listener);
264271
}
265272

273+
// $FlowFixMe[unsafe-getters-setters]
266274
get onloadstart(): EventCallback | null {
267275
return getEventHandlerAttribute(this, 'loadstart');
268276
}
269277

278+
// $FlowFixMe[unsafe-getters-setters]
270279
set onloadstart(listener: ?EventCallback) {
271280
setEventHandlerAttribute(this, 'loadstart', listener);
272281
}
273282

283+
// $FlowFixMe[unsafe-getters-setters]
274284
get onloadend(): EventCallback | null {
275285
return getEventHandlerAttribute(this, 'loadend');
276286
}
277287

288+
// $FlowFixMe[unsafe-getters-setters]
278289
set onloadend(listener: ?EventCallback) {
279290
setEventHandlerAttribute(this, 'loadend', listener);
280291
}
281292

293+
// $FlowFixMe[unsafe-getters-setters]
282294
get onprogress(): EventCallback | null {
283295
return getEventHandlerAttribute(this, 'progress');
284296
}
285297

298+
// $FlowFixMe[unsafe-getters-setters]
286299
set onprogress(listener: ?EventCallback) {
287300
setEventHandlerAttribute(this, 'progress', listener);
288301
}

‎packages/react-native/Libraries/Blob/URL.js‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @format
99
*/
1010

11-
// flowlint unsafe-getters-setters:off
12-
1311
import type Blob from './Blob';
1412

1513
import NativeBlobModule from './NativeBlobModule';
@@ -125,11 +123,13 @@ export class URL {
125123
}
126124
}
127125

126+
// $FlowFixMe[unsafe-getters-setters]
128127
get hash(): string {
129128
const hashMatch = this._url.match(/#([^/]*)/);
130129
return hashMatch ? `#${hashMatch[1]}` : '';
131130
}
132131

132+
// $FlowFixMe[unsafe-getters-setters]
133133
get host(): string {
134134
const hostMatch = this._url.match(/^https?:\/\/(?:[^@]+@)?([^:/?#]+)/);
135135
const portMatch = this._url.match(/:(\d+)(?=[/?#]|$)/);
@@ -138,45 +138,54 @@ export class URL {
138138
: '';
139139
}
140140

141+
// $FlowFixMe[unsafe-getters-setters]
141142
get hostname(): string {
142143
const hostnameMatch = this._url.match(/^https?:\/\/(?:[^@]+@)?([^:/?#]+)/);
143144
return hostnameMatch ? hostnameMatch[1] : '';
144145
}
145146

147+
// $FlowFixMe[unsafe-getters-setters]
146148
get href(): string {
147149
return this.toString();
148150
}
149151

152+
// $FlowFixMe[unsafe-getters-setters]
150153
get origin(): string {
151154
const matches = this._url.match(/^(https?:\/\/[^/]+)/);
152155
return matches ? matches[1] : '';
153156
}
154157

158+
// $FlowFixMe[unsafe-getters-setters]
155159
get password(): string {
156160
const passwordMatch = this._url.match(/https?:\/\/.*:(.*)@/);
157161
return passwordMatch ? passwordMatch[1] : '';
158162
}
159163

164+
// $FlowFixMe[unsafe-getters-setters]
160165
get pathname(): string {
161166
const pathMatch = this._url.match(/https?:\/\/[^/]+(\/[^?#]*)?/);
162167
return pathMatch ? pathMatch[1] || '/' : '/';
163168
}
164169

170+
// $FlowFixMe[unsafe-getters-setters]
165171
get port(): string {
166172
const portMatch = this._url.match(/:(\d+)(?=[/?#]|$)/);
167173
return portMatch ? portMatch[1] : '';
168174
}
169175

176+
// $FlowFixMe[unsafe-getters-setters]
170177
get protocol(): string {
171178
const protocolMatch = this._url.match(/^([a-zA-Z][a-zA-Z\d+\-.]*):/);
172179
return protocolMatch ? protocolMatch[1] + ':' : '';
173180
}
174181

182+
// $FlowFixMe[unsafe-getters-setters]
175183
get search(): string {
176184
const searchMatch = this._url.match(/\?([^#]*)/);
177185
return searchMatch ? `?${searchMatch[1]}` : '';
178186
}
179187

188+
// $FlowFixMe[unsafe-getters-setters]
180189
set search(value: string) {
181190
// Remove leading '?' if present
182191
const searchString = value.startsWith('?') ? value.slice(1) : value;
@@ -195,6 +204,7 @@ export class URL {
195204
this._searchParamsInstance = null;
196205
}
197206

207+
// $FlowFixMe[unsafe-getters-setters]
198208
get searchParams(): URLSearchParams {
199209
if (this._searchParamsInstance == null) {
200210
this._searchParamsInstance = new URLSearchParams(this.search);
@@ -225,6 +235,7 @@ export class URL {
225235
}
226236
}
227237

238+
// $FlowFixMe[unsafe-getters-setters]
228239
get username(): string {
229240
const usernameMatch = this._url.match(/^https?:\/\/([^:@]+)(?::[^@]*)?@/);
230241
return usernameMatch ? usernameMatch[1] : '';

‎packages/react-native/Libraries/Blob/URLSearchParams.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
* @format
99
*/
1010

11-
// flowlint unsafe-getters-setters:off
12-
1311
// Small subset from whatwg-url: https://github.com/jsdom/whatwg-url/tree/master/src
1412
// The reference code bloat comes from Unicode issues with URLs, so those won't work here.
1513
export class URLSearchParams {
1614
_searchParams: Map<string, string[]> = new Map();
1715

16+
// $FlowFixMe[unsafe-getters-setters]
1817
get size(): number {
1918
return this._searchParams.size;
2019
}

‎packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* @format
99
*/
1010

11-
// flowlint unsafe-getters-setters:off
12-
1311
import type {
1412
MeasureInWindowOnSuccessCallback,
1513
MeasureLayoutOnSuccessCallback,
@@ -48,6 +46,7 @@ class DrawerLayoutAndroid
4846
extends React.Component<DrawerLayoutAndroidProps, DrawerLayoutAndroidState>
4947
implements DrawerLayoutAndroidMethods
5048
{
49+
// $FlowFixMe[unsafe-getters-setters]
5150
static get positions(): unknown {
5251
console.warn(
5352
'Setting DrawerLayoutAndroid drawerPosition using `DrawerLayoutAndroid.positions` is deprecated. Instead pass the string value "left" or "right"',

‎packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,5 +731,5 @@ let AndroidTextInputNativeComponent =
731731
() => __INTERNAL_VIEW_CONFIG,
732732
);
733733

734-
// flowlint-next-line unclear-type:off
734+
// $FlowFixMe[unclear-type]
735735
export default AndroidTextInputNativeComponent as any as HostComponent<AndroidTextInputNativeProps>;

‎packages/react-native/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ const MultilineTextInputNativeComponent: HostComponent<{...}> =
3939
() => __INTERNAL_VIEW_CONFIG,
4040
);
4141

42-
// flowlint-next-line unclear-type:off
42+
// $FlowFixMe[unclear-type]
4343
export default MultilineTextInputNativeComponent as any as HostComponent<{...}>;

‎packages/react-native/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const SinglelineTextInputNativeComponent: HostComponent<{...}> =
3535
() => __INTERNAL_VIEW_CONFIG,
3636
);
3737

38-
// flowlint-next-line unclear-type:off
38+
// $FlowFixMe[unclear-type]
3939
export default SinglelineTextInputNativeComponent as any as HostComponent<{
4040
...
4141
}>;

‎packages/react-native/Libraries/Core/setUpRegeneratorRuntime.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ if (!hasNativeGenerator) {
4141

4242
// regenerator-runtime/runtime exports the regeneratorRuntime object, so we
4343
// can return it safely.
44-
return require('regenerator-runtime/runtime'); // flowlint-line untyped-import:off
44+
// $FlowFixMe[untyped-import]
45+
return require('regenerator-runtime/runtime');
4546
});
4647
}

0 commit comments

Comments
 (0)