Skip to content

Commit

Permalink
feat: remove mixed from weak types (issue #361)
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Nov 1, 2018
1 parent 30e8ca6 commit 94e7a1b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
7 changes: 0 additions & 7 deletions src/rules/noWeakTypes.js
Expand Up @@ -10,9 +10,6 @@ const schema = [
Function: {
type: 'boolean'
},
mixed: {
type: 'boolean'
},
Object: {
type: 'boolean'
}
Expand Down Expand Up @@ -43,7 +40,6 @@ const genericTypeEvaluator = (context, {checkFunction, checkObject}) => {

const create = (context) => {
const checkAny = _.get(context, 'options[0].any', true) === true;
const checkMixed = _.get(context, 'options[0].mixed', true) === true;
const checkFunction = _.get(context, 'options[0].Function', true) === true;
const checkObject = _.get(context, 'options[0].Object', true) === true;

Expand All @@ -52,9 +48,6 @@ const create = (context) => {
if (checkAny) {
checks.AnyTypeAnnotation = reportWeakType(context, 'any');
}
if (checkMixed) {
checks.MixedTypeAnnotation = reportWeakType(context, 'mixed');
}

if (checkFunction || checkObject) {
checks.GenericTypeAnnotation = genericTypeEvaluator(context, {
Expand Down
36 changes: 0 additions & 36 deletions tests/rules/assertions/noWeakTypes.js
Expand Up @@ -18,24 +18,6 @@ export default {
message: 'Unexpected use of weak type "any"'
}]
},
{
code: 'function foo(thing): mixed {}',
errors: [{
message: 'Unexpected use of weak type "mixed"'
}]
},
{
code: 'function foo(thing): Promise<mixed> {}',
errors: [{
message: 'Unexpected use of weak type "mixed"'
}]
},
{
code: 'function foo(thing): Promise<Promise<mixed>> {}',
errors: [{
message: 'Unexpected use of weak type "mixed"'
}]
},
{
code: 'function foo(thing): Object {}',
errors: [{
Expand Down Expand Up @@ -209,14 +191,6 @@ export default {
any: false,
Object: false
}]
},
{
code: 'type X = mixed; type Y = Function; type Z = Object',
errors: [{message: 'Unexpected use of weak type "mixed"'}],
options: [{
Function: false,
Object: false
}]
}
],
misconfigured: [
Expand All @@ -241,9 +215,6 @@ export default {
Function: {
type: 'boolean'
},
mixed: {
type: 'boolean'
},
Object: {
type: 'boolean'
}
Expand Down Expand Up @@ -326,13 +297,6 @@ export default {
Object: false
}]
},
{
code: 'type X = mixed; type Y = Object',
options: [{
mixed: false,
Object: false
}]
},
{
code: 'type X = Function',
options: [{Function: false}]
Expand Down

0 comments on commit 94e7a1b

Please sign in to comment.