Skip to content

Commit bd9bec0

Browse files
committed
Add eslint-plugin-fb-flow; fixed use-indexed-access-type
See the patch notes for 0.157.0 at https://github.com/facebook/flow/releases/tag/v0.157.0 where this plugin was announced.
1 parent 05b9324 commit bd9bec0

File tree

8 files changed

+19
-6
lines changed

8 files changed

+19
-6
lines changed

.eslintrc.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins:
66
- import
77
- react
88
- flowtype
9+
- fb-flow
910
- react-hooks
1011

1112
env:
@@ -333,6 +334,12 @@ rules:
333334
flowtype/union-intersection-spacing: [warn, always]
334335
flowtype/use-flow-type: warn
335336

337+
#########################
338+
# eslint-plugin-fb-flow #
339+
#########################
340+
341+
fb-flow/use-indexed-access-type: error
342+
336343
#############################
337344
# eslint-plugin-react-hooks #
338345
#############################

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"copy-webpack-plugin": "4.6.0",
3333
"core-js": "3.6.5",
3434
"detect-node": "2.0.3",
35+
"eslint-plugin-fb-flow": "^0.0.2",
3536
"file-loader": "3.0.1",
3637
"filesize": "2.0.4",
3738
"generic-diff": "1.0.1",

root/collection/CollectionIndex.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import CollectionLayout from './CollectionLayout';
3333
type PropsForEntity<T: CoreEntityT> = {
3434
+$c: CatalystContextT,
3535
+collection: CollectionT,
36-
+collectionEntityType: $ElementType<T, 'entityType'>,
36+
+collectionEntityType: T['entityType'],
3737
+entities: $ReadOnlyArray<T>,
3838
+order: string,
3939
+pager: PagerT,

root/edit/details/AddAnnotation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import DescriptiveLink
1414
import formatEntityTypeName
1515
from '../../static/scripts/common/utility/formatEntityTypeName';
1616

17-
type AnnotatedEntityTypeT = $ElementType<AnnotatedEntityT, 'entityType'>;
17+
type AnnotatedEntityTypeT = AnnotatedEntityT['entityType'];
1818

1919
type AddAnnotationEditT = {
2020
...EditT,

root/recording/RecordingIndex.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const RecordingAppearancesTable = ({
4242
}: {
4343
$c: CatalystContextT,
4444
recording: RecordingWithArtistCreditT,
45-
tracks: $ElementType<Props, 'tracks'>,
45+
tracks: Props['tracks'],
4646
}) => (
4747
<table className="tbl">
4848
<thead>

root/static/scripts/common/components/Autocomplete2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function setScrollPosition(menuId: string) {
121121
type InitialStateT<T: EntityItemT> = {
122122
+activeUser?: ActiveEditorT,
123123
+canChangeType?: (string) => boolean,
124-
+entityType: $ElementType<T, 'entityType'>,
124+
+entityType: T['entityType'],
125125
+id: string,
126126
+inputValue?: string,
127127
+placeholder?: string,

root/static/scripts/common/components/Autocomplete2/types.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
* later version: http://www.gnu.org/licenses/gpl-2.0.txt
88
*/
99

10-
export type SearchableTypeT = $ElementType<EntityItemT, 'entityType'>;
10+
export type SearchableTypeT = EntityItemT['entityType'];
1111

1212
export type StateT<T: EntityItemT> = {
1313
+activeUser: ActiveEditorT | null,
1414
+canChangeType?: (string) => boolean,
1515
+containerClass?: string,
1616
+disabled?: boolean,
17-
+entityType: $ElementType<T, 'entityType'>,
17+
+entityType: T['entityType'],
1818
+error: number,
1919
+highlightedIndex: number,
2020
+id: string,

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -3004,6 +3004,11 @@ eslint-module-utils@^2.6.0:
30043004
debug "^2.6.9"
30053005
pkg-dir "^2.0.0"
30063006

3007+
eslint-plugin-fb-flow@^0.0.2:
3008+
version "0.0.2"
3009+
resolved "https://registry.yarnpkg.com/eslint-plugin-fb-flow/-/eslint-plugin-fb-flow-0.0.2.tgz#54a5d1699872863b86a79f19f39c3085bb65a517"
3010+
integrity sha512-Wp5u0rGWLbufdv6rKUoa6A3/DWF1Tc19F762apVmBg2edVET4LjHIApsMl+LIzuRw767uTGF9BB9KuPtrakM0g==
3011+
30073012
30083013
version "5.2.0"
30093014
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-5.2.0.tgz#a4bef5dc18f9b2bdb41569a4ab05d73805a3d261"

0 commit comments

Comments
 (0)