Skip to content
Permalink
Browse files

fix(eslint-plugin): [no-use-before-define] false positive for functio…

…n type arguments (#2554)

Fixes #2527
  • Loading branch information
bradzacher committed Sep 13, 2020
1 parent 02d72d4 commit 189162d46ecb116c420232937a7f86df913f4e79
@@ -260,7 +260,8 @@ export default util.createRule<Options, MessageIds>({
variable.identifiers.length === 0 ||
(variable.identifiers[0].range[1] <= reference.identifier.range[1] &&
!isInInitializer(variable, reference)) ||
!isForbidden(variable, reference)
!isForbidden(variable, reference) ||
reference.from.type === TSESLint.Scope.ScopeType.functionType
) {
return;
}
@@ -343,6 +343,10 @@ const React = require('react');
},
},
},
// https://github.com/typescript-eslint/typescript-eslint/issues/2527
`
type T = (value: unknown) => value is Id;
`,
],
invalid: [
{
@@ -46,9 +46,11 @@ namespace Scope {
export type Reference = scopeManager.Reference;
export type Variable = scopeManager.Variable | ESLintScopeVariable;
export type Scope = scopeManager.Scope;
export const ScopeType = scopeManager.ScopeType;
// TODO - in the next major, clean this up with a breaking change
export type DefinitionType = scopeManager.Definition;
export type Definition = scopeManager.Definition;
export const DefinitionType = scopeManager.DefinitionType;
}

export { Scope };

0 comments on commit 189162d

Please sign in to comment.