importFixes: Support missing "React" at a JSXOpeningElement (#16066)

* importFixes: Support missing "React" at a JSXOpeningElement

* Fix nextLineRule linting

* Rename to resolveJsxNamespaceAtLocation

* Expose getJsxNamespace and resolveNameAtLocation separately
This commit is contained in:
Andy
2017-06-05 14:23:39 -07:00
committed by GitHub
parent 70564110c0
commit 8ace7b826f
12 changed files with 130 additions and 21 deletions

View File

@@ -18,7 +18,7 @@ export class Rule extends Lint.Rules.AbstractRule {
function walk(ctx: Lint.WalkContext<void>, checkCatch: boolean, checkElse: boolean): void {
const { sourceFile } = ctx;
function recur(node: ts.Node): void {
ts.forEachChild(sourceFile, function recur(node) {
switch (node.kind) {
case ts.SyntaxKind.IfStatement:
checkIf(node as ts.IfStatement);
@@ -28,7 +28,7 @@ function walk(ctx: Lint.WalkContext<void>, checkCatch: boolean, checkElse: boole
break;
}
ts.forEachChild(node, recur);
}
});
function checkIf(node: ts.IfStatement): void {
const { thenStatement, elseStatement } = node;