react-noop-renderer: convert vars into let/const#11732
react-noop-renderer: convert vars into let/const#11732raphamorim wants to merge 2 commits intofacebook:masterfrom
Conversation
|
Was |
|
How to prevent developer from use |
|
We could lint against it but this is a bit tricky because some files have to use |
|
Hm. In React-DOM, I keep some |
|
Can you explain that in more detail? |
|
One sec. I'll give a example |
|
|
||
| if (__DEV__) { | ||
| var validatePropertiesInDevelopment = function(type, props) { | ||
| let validatePropertiesInDevelopment = function(type, props) { |
There was a problem hiding this comment.
Hm, @gaearon I guess my first idea is wrong. Seems to be a scope issue.
In this case I simple changed it and returns errors like:
ReferenceError: validatePropertiesInDevelopment is not defined on tests.
There was a problem hiding this comment.
Yep—you can define it outside the dev block.
There was a problem hiding this comment.
Maybe let validatePropertiesInDevelopment = () => {}; would be the best default value, and then in the block you reassign.
There was a problem hiding this comment.
ok, I'll fix for react-dom, and see if forgot some var in other package then. I'll add on this PR.
There was a problem hiding this comment.
It's okay for you?
There was a problem hiding this comment.
I think it's better I close this PR and send one with another branch name :P
ref: #11730
last one @gaearon, I promise 😆