1919 * [ ` delimiter-dangle ` ] ( #eslint-plugin-flowtype-rules-delimiter-dangle )
2020 * [ ` generic-spacing ` ] ( #eslint-plugin-flowtype-rules-generic-spacing )
2121 * [ ` no-dupe-keys ` ] ( #eslint-plugin-flowtype-rules-no-dupe-keys )
22+ * [ ` no-flow-fix-me-comments ` ] ( #eslint-plugin-flowtype-rules-no-flow-fix-me-comments )
2223 * [ ` no-mutable-array ` ] ( #eslint-plugin-flowtype-rules-no-mutable-array )
2324 * [ ` no-primitive-constructor-types ` ] ( #eslint-plugin-flowtype-rules-no-primitive-constructor-types )
2425 * [ ` no-types-missing-file-annotation ` ] ( #eslint-plugin-flowtype-rules-no-types-missing-file-annotation )
2526 * [ ` no-unused-expressions ` ] ( #eslint-plugin-flowtype-rules-no-unused-expressions )
2627 * [ ` no-weak-types ` ] ( #eslint-plugin-flowtype-rules-no-weak-types )
2728 * [ ` object-type-delimiter ` ] ( #eslint-plugin-flowtype-rules-object-type-delimiter )
29+ * [ ` require-exact-type ` ] ( #eslint-plugin-flowtype-rules-require-exact-type )
2830 * [ ` require-parameter-type ` ] ( #eslint-plugin-flowtype-rules-require-parameter-type )
2931 * [ ` require-return-type ` ] ( #eslint-plugin-flowtype-rules-require-return-type )
3032 * [ ` require-valid-file-annotation ` ] ( #eslint-plugin-flowtype-rules-require-valid-file-annotation )
@@ -252,6 +254,9 @@ var a: AType<BType>
252254type A = AType
253255// Additional rules: {"no-undef":2}
254256
257+ declare type A = number
258+ // Additional rules: {"no-undef":2}
259+
255260opaque type A = AType
256261// Additional rules: {"no-undef":2}
257262
@@ -285,6 +290,9 @@ class C implements AType {}
285290interface AType {}
286291// Additional rules: {"no-undef":2}
287292
293+ declare interface A {}
294+ // Additional rules: {"no-undef":2}
295+
288296({ a: ({b () {}}: AType) })
289297// Additional rules: {"no-undef":2}
290298
@@ -309,6 +317,9 @@ var a: AType<BType>
309317type A = AType
310318// Additional rules: {"no-undef":2,"no-use-before-define":[2,"nofunc"]}
311319
320+ declare type A = number
321+ // Additional rules: {"no-undef":2,"no-use-before-define":[2,"nofunc"]}
322+
312323opaque type A = AType
313324// Additional rules: {"no-undef":2,"no-use-before-define":[2,"nofunc"]}
314325
@@ -342,6 +353,9 @@ class C implements AType {}
342353interface AType {}
343354// Additional rules: {"no-undef":2,"no-use-before-define":[2,"nofunc"]}
344355
356+ declare interface A {}
357+ // Additional rules: {"no-undef":2,"no-use-before-define":[2,"nofunc"]}
358+
345359({ a: ({b () {}}: AType) })
346360// Additional rules: {"no-undef":2,"no-use-before-define":[2,"nofunc"]}
347361
@@ -968,6 +982,31 @@ var a = 1; var b = 1; type f = { get(key: a): string, get(key: b): string }
968982
969983
970984
985+ <a name =" eslint-plugin-flowtype-rules-no-flow-fix-me-comments " ></a >
986+ ### <code >no-flow-fix-me-comments</code >
987+
988+ Disallows ` $FlowFixMe ` comment suppressions.
989+
990+ This is especially useful as a warning to ensure instances of ` $FlowFixMe ` in your codebase get fixed over time.
991+
992+ <a name =" eslint-plugin-flowtype-rules-no-flow-fix-me-comments-options " ></a >
993+ #### Options
994+
995+ This rule takes an optional RegExp that comments a text RegExp that makes the supression valid.
996+
997+ ``` js
998+ {
999+ " rules" : {
1000+ " flowtype/no-flow-fix-me-comments" : [
1001+ 1 ,
1002+ " TODO\s +[0-9]+"
1003+ ]
1004+ }
1005+ }
1006+ ```
1007+
1008+ <!-- assertions no-flow-fix-me-comments -->
1009+
9711010<a name =" eslint-plugin-flowtype-rules-no-mutable-array " ></a >
9721011### <code >no-mutable-array</code >
9731012
@@ -1500,6 +1539,95 @@ type Foo = { a: Foo, b: Bar }
15001539
15011540
15021541
1542+ <a name="eslint-plugin-flowtype-rules-require-exact-type"></a>
1543+ ### <code>require-exact-type</code>
1544+
1545+ This rule enforces [exact object types](https://flow.org/en/docs/types/objects/#toc-exact-object-types).
1546+
1547+ <a name="eslint-plugin-flowtype-rules-require-exact-type-options"></a>
1548+ #### Options
1549+
1550+ The rule has one string option:
1551+
1552+ * ` " always" ` (default): Report all object type definitions that aren't exact.
1553+ * ` " never" ` : Report all object type definitions that are exact.
1554+
1555+ ` ` ` js
1556+ {
1557+ " rules" : {
1558+ " flowtype/require-exact-type" : [
1559+ 2 ,
1560+ " always"
1561+ ]
1562+ }
1563+ }
1564+
1565+ {
1566+ " rules" : {
1567+ " flowtype/require-exact-type" : [
1568+ 2 ,
1569+ " never"
1570+ ]
1571+ }
1572+ }
1573+ ` ` `
1574+
1575+ The following patterns are considered problems:
1576+
1577+ ` ` ` js
1578+ type foo = {};
1579+ // Message: Type identifier 'foo' must be exact.
1580+
1581+ type foo = { bar: string };
1582+ // Message: Type identifier 'foo' must be exact.
1583+
1584+ // Options: ["always"]
1585+ type foo = {};
1586+ // Message: Type identifier 'foo' must be exact.
1587+
1588+ // Options: ["always"]
1589+ type foo = { bar: string };
1590+ // Message: Type identifier 'foo' must be exact.
1591+
1592+ // Options: ["never"]
1593+ type foo = {| | };
1594+ // Message: Type identifier 'foo' must not be exact.
1595+
1596+ // Options: ["never"]
1597+ type foo = {| bar: string | };
1598+ // Message: Type identifier 'foo' must not be exact.
1599+ ` ` `
1600+
1601+ The following patterns are not considered problems:
1602+
1603+ ` ` ` js
1604+ type foo = {| | };
1605+
1606+ type foo = {| bar: string | };
1607+
1608+ type foo = number;
1609+
1610+ // Options: ["always"]
1611+ type foo = {| | };
1612+
1613+ // Options: ["always"]
1614+ type foo = {| bar: string | };
1615+
1616+ // Options: ["always"]
1617+ type foo = number;
1618+
1619+ // Options: ["never"]
1620+ type foo = { };
1621+
1622+ // Options: ["never"]
1623+ type foo = { bar: string };
1624+
1625+ // Options: ["never"]
1626+ type foo = number;
1627+ ` ` `
1628+
1629+
1630+
15031631<a name="eslint-plugin-flowtype-rules-require-parameter-type"></a>
15041632### <code>require-parameter-type</code>
15051633
@@ -1789,6 +1917,19 @@ async () => {}
17891917async function x () {}
17901918// Message: Missing return type annotation.
17911919
1920+ // Options: ["always",{"annotateUndefined":"always"}]
1921+ class Test { constructor () { } }
1922+ // Message: Must annotate undefined return type.
1923+
1924+ class Test { foo () { return 42 ; } }
1925+ // Message: Missing return type annotation.
1926+
1927+ class Test { foo = () => { return 42 ; } }
1928+ // Message: Missing return type annotation.
1929+
1930+ class Test { foo = () => 42 ; }
1931+ // Message: Missing return type annotation.
1932+
17921933// Options: ["always"]
17931934async () => { return ; }
17941935// Message: Missing return type annotation.
@@ -1869,6 +2010,24 @@ async function doThing(): Promise<void> {}
18692010// Options: ["always",{"annotateUndefined":"always"}]
18702011function * doThing (): Generator<number, void, void> { yield 2 ; }
18712012
2013+ // Options: ["always",{"annotateUndefined":"always","excludeMatching":["constructor"]}]
2014+ class Test { constructor () { } }
2015+
2016+ class Test { constructor () { } }
2017+
2018+ // Options: ["always",{"excludeMatching":["foo"]}]
2019+ class Test { foo () { return 42 ; } }
2020+
2021+ // Options: ["always",{"excludeMatching":["foo"]}]
2022+ class Test { foo = () => { return 42 ; } }
2023+
2024+ // Options: ["always",{"excludeMatching":["foo"]}]
2025+ class Test { foo = () => 42 ; }
2026+
2027+ class Test { foo = (): number => { return 42 ; } }
2028+
2029+ class Test { foo = (): number => 42 ; }
2030+
18722031async (foo): Promise < number> => { return 3 ; }
18732032
18742033// Options: ["always",{"excludeArrowFunctions":true}]
0 commit comments