Skip to content

Commit 94e7a1b

Browse files
committed
feat: remove mixed from weak types (issue #361)
1 parent 30e8ca6 commit 94e7a1b

File tree

2 files changed

+0
-43
lines changed

2 files changed

+0
-43
lines changed

src/rules/noWeakTypes.js

-7
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ const schema = [
1010
Function: {
1111
type: 'boolean'
1212
},
13-
mixed: {
14-
type: 'boolean'
15-
},
1613
Object: {
1714
type: 'boolean'
1815
}
@@ -43,7 +40,6 @@ const genericTypeEvaluator = (context, {checkFunction, checkObject}) => {
4340

4441
const create = (context) => {
4542
const checkAny = _.get(context, 'options[0].any', true) === true;
46-
const checkMixed = _.get(context, 'options[0].mixed', true) === true;
4743
const checkFunction = _.get(context, 'options[0].Function', true) === true;
4844
const checkObject = _.get(context, 'options[0].Object', true) === true;
4945

@@ -52,9 +48,6 @@ const create = (context) => {
5248
if (checkAny) {
5349
checks.AnyTypeAnnotation = reportWeakType(context, 'any');
5450
}
55-
if (checkMixed) {
56-
checks.MixedTypeAnnotation = reportWeakType(context, 'mixed');
57-
}
5851

5952
if (checkFunction || checkObject) {
6053
checks.GenericTypeAnnotation = genericTypeEvaluator(context, {

tests/rules/assertions/noWeakTypes.js

-36
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,6 @@ export default {
1818
message: 'Unexpected use of weak type "any"'
1919
}]
2020
},
21-
{
22-
code: 'function foo(thing): mixed {}',
23-
errors: [{
24-
message: 'Unexpected use of weak type "mixed"'
25-
}]
26-
},
27-
{
28-
code: 'function foo(thing): Promise<mixed> {}',
29-
errors: [{
30-
message: 'Unexpected use of weak type "mixed"'
31-
}]
32-
},
33-
{
34-
code: 'function foo(thing): Promise<Promise<mixed>> {}',
35-
errors: [{
36-
message: 'Unexpected use of weak type "mixed"'
37-
}]
38-
},
3921
{
4022
code: 'function foo(thing): Object {}',
4123
errors: [{
@@ -209,14 +191,6 @@ export default {
209191
any: false,
210192
Object: false
211193
}]
212-
},
213-
{
214-
code: 'type X = mixed; type Y = Function; type Z = Object',
215-
errors: [{message: 'Unexpected use of weak type "mixed"'}],
216-
options: [{
217-
Function: false,
218-
Object: false
219-
}]
220194
}
221195
],
222196
misconfigured: [
@@ -241,9 +215,6 @@ export default {
241215
Function: {
242216
type: 'boolean'
243217
},
244-
mixed: {
245-
type: 'boolean'
246-
},
247218
Object: {
248219
type: 'boolean'
249220
}
@@ -326,13 +297,6 @@ export default {
326297
Object: false
327298
}]
328299
},
329-
{
330-
code: 'type X = mixed; type Y = Object',
331-
options: [{
332-
mixed: false,
333-
Object: false
334-
}]
335-
},
336300
{
337301
code: 'type X = Function',
338302
options: [{Function: false}]

0 commit comments

Comments
 (0)