Skip to content

Mark "React" symbol as referenced#11721

Merged
sheetalkamat merged 3 commits into
masterfrom
unusedLocals
Oct 19, 2016
Merged

Mark "React" symbol as referenced#11721
sheetalkamat merged 3 commits into
masterfrom
unusedLocals

Conversation

@sheetalkamat

Copy link
Copy Markdown
Member

It won't not be marked as isReferenced in resolveName when there is no diagnosticMessage when resolving it.
Fixes #10312

//@noUnusedLocals:true
//@noUnusedParameters:true
//@module: commonjs
//@jsx: react

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test for reactNamesapce and noUnusedLocals

Comment thread tests/cases/compiler/unusedImports14.ts Outdated
@@ -0,0 +1,23 @@
//@noUnusedLocals:true
//@noUnusedParameters:true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you do not need the unused params here.

@sheetalkamat sheetalkamat merged commit 67873ca into master Oct 19, 2016
@sheetalkamat sheetalkamat deleted the unusedLocals branch October 19, 2016 20:44
@bartosz-k

Copy link
Copy Markdown

what about custom JSX backend using reactNamespace param in tsconfig.json? Is it handled here too?

@mhegazy

mhegazy commented Oct 19, 2016

Copy link
Copy Markdown
Contributor

what about custom JSX backend using reactNamespace param in tsconfig.json? Is it handled here too?

yup. see the test in https://github.com/Microsoft/TypeScript/blob/67873ca20b334c0b21e2a70440ab431a8b4bc41b/tests/cases/compiler/unusedImports15.ts

@fspillner

Copy link
Copy Markdown

It seems, that it doesn't work with new jsxFactory param in tsconfig.json. Can somebody confirm this? Should I open new issue?

@mhegazy

mhegazy commented Feb 15, 2017

Copy link
Copy Markdown
Contributor

Should I open new issue?

yes please.

@fspillner

Copy link
Copy Markdown

@mhegazy here you go: #14109

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--noUnusedLocals doesn't consider React to be "used" when using JSX files

5 participants