-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Andy
authored
Jun 5, 2017
1 parent
7056411
commit 8ace7b8
Showing
12 changed files
with
130 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @jsx: react | ||
|
||
// @Filename: /node_modules/@types/react/index.d.ts | ||
////export = React; | ||
////export as namespace React; | ||
////declare namespace React { | ||
//// export class Component { render(): JSX.Element | null; } | ||
////} | ||
////declare global { | ||
//// namespace JSX { | ||
//// interface Element {} | ||
//// } | ||
////} | ||
|
||
// @Filename: /a.tsx | ||
////[|import { Component } from "react"; | ||
////export class MyMap extends Component { } | ||
////<MyMap/>;|] | ||
|
||
goTo.file("/a.tsx"); | ||
|
||
verify.importFixAtPosition([ | ||
`import { Component } from "react"; | ||
import * as React from "react"; | ||
export class MyMap extends Component { } | ||
<MyMap/>;`]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @jsx: react | ||
|
||
// @Filename: /node_modules/@types/react/index.d.ts | ||
////export = React; | ||
////export as namespace React; | ||
////declare namespace React { | ||
//// export class Component { render(): JSX.Element | null; } | ||
////} | ||
////declare global { | ||
//// namespace JSX { | ||
//// interface Element {} | ||
//// } | ||
////} | ||
|
||
// @Filename: /a.tsx | ||
////[|import { Component } from "react"; | ||
////export class MyMap extends Component { } | ||
////<MyMap></MyMap>;|] | ||
|
||
goTo.file("/a.tsx"); | ||
|
||
verify.importFixAtPosition([ | ||
`import { Component } from "react"; | ||
import * as React from "react"; | ||
export class MyMap extends Component { } | ||
<MyMap></MyMap>;`]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// https://github.com/Microsoft/TypeScript/issues/16065 | ||
|
||
// @jsx: react | ||
// @jsxFactory: factory | ||
|
||
// @Filename: /factory.ts | ||
////export function factory() { return {}; } | ||
////declare global { | ||
//// namespace JSX { | ||
//// interface Element {} | ||
//// } | ||
////} | ||
|
||
// @Filename: /a.tsx | ||
////[|<div/>|] | ||
|
||
goTo.file("/a.tsx"); | ||
verify.not | ||
verify.importFixAtPosition([]); |