Skip to content

Commit

Permalink
fix: Remove no longer needed code for define-flow-type
Browse files Browse the repository at this point in the history
Since babel/babel-eslint#449 define-flow-type no
longer needs to check interface declarations to suppress the
no-undef rule.

This commit removes the unneeded code, and moves some test cases from
`VALID_WITH_USE_FLOW_TYPE` to `ALWAYS_VALID` so that the tests pass
again.
  • Loading branch information
lydell committed Aug 27, 2017
1 parent c1f444f commit a6151bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/rules/defineFlowType.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ const create = (context) => {
makeDefined(qid);
}
},
InterfaceDeclaration (node) {
makeDefined(node.id);
},
Program () {
globalScope = context.getScope();
},
Expand Down
17 changes: 3 additions & 14 deletions tests/rules/assertions/defineFlowType.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ const VALID_WITH_DEFINE_FLOW_TYPE = [
'\'AType\' is not defined.'
]
},
{
code: 'interface AType {}',
errors: [
'\'AType\' is not defined.'
]
},
{
code: '({ a: ({b() {}}: AType) })',
// `AType` appears twice in `globalScope.through` as distinct
Expand All @@ -112,13 +106,6 @@ const VALID_WITH_DEFINE_FLOW_TYPE = [
'\'AType\' is not defined.',
'\'BType\' is not defined.'
]
},
{
code: 'interface AType<BType> {}',
errors: [
'\'AType\' is not defined.',
'\'BType\' is not defined.'
]
}
];

Expand Down Expand Up @@ -158,7 +145,9 @@ const ALWAYS_VALID = [
'function f(a): string {}',
'class C { a: string }',
'var AType = {}; class C { a: AType.a }',
'declare module A { declare var a: AType }'
'declare module A { declare var a: AType }',
'interface AType {}',
'interface AType<BType> {}'
];

/**
Expand Down

0 comments on commit a6151bd

Please sign in to comment.