-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reader: Use localize() instead of i18n mixin #13759
Conversation
Any reason the codemod is wrapping the declaration instead of the line with the export (how we usually do it)? Current: const a = localize( React.createClass( {} ) );
export default a; Preferred: const a = React.createClass({});
export default localize( a ); |
I was about to ask about the same :) It might break one of the Babel's transformations which gives the name to the components. Another thing is that |
Love it btw 🎉 |
It was way easier to wrap |
fbcae70
to
ba918ac
Compare
This makes linter very unhappy. Errors from the first container:
There are 3 more container to check, but it could be easily fixed by prettier (see #12260) :) Expect me to advertise |
Some
|
I ran |
@gziolo Anyway, it looks like most of these lints aren't even introduced by the codemod but seem to pre-exist, no? (Check the affected lines.) If that's the case, I'd say it's fine to ignore them and consider them an orthogonal issue. |
Hmm, on second glance, I might be wrong about that 😳 |
Computer says no: eslint/eslint#6873 |
Resorted to using Atom to replace |
IDE is your friend. That works, too :) I was using |
client/reader/liked-stream/main.jsx
Outdated
@@ -3,6 +3,8 @@ | |||
*/ | |||
import React from 'react'; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why it adds empty line here and in a couple of other places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's benjamn/recast#371
If you mean the spaces added before an opening JSX element, I isolated the bug in |
@@ -19,7 +20,7 @@ import { | |||
} from 'reader/stats'; | |||
import cssSafeUrl from 'lib/css-safe-url'; | |||
|
|||
export default React.createClass( { | |||
export default localize(React.createClass({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing spaces inside localize
.
I had two minor comments, otherwise it looks neat. I think it needs to be tested by someone from Reader team and we are good to 🚢 |
Nice! Wanna add a link to the PR for reference? 😄 |
@blowery @bluefuton @samouri pls? 😄 |
Here it is: benjamn/recast#404 |
I'll give this a go 🤞 |
I've just fixed up the last couple of lint errors 👍 |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I say 🚢
Thanks for merging @samouri! |
Let's continue the tradition of using the Reader as a guinea pig for trying out new codemods 😁
Branch made by running the codemod from #13597, and
s/localize\((\S*)\)/localize( $1 )/g
.To test: