-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Move eslint/prettier config to packages/eslint-config-react-native #23688
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
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
Thanks, @dratwas! @matt-oakes @cpojer could you take a look? We'll probably need your help with Also, we were wondering if the new config should be included as a dependency in root |
|
Looking good! React Native has some custom prettier configuration in the root With this PR, the Prettier config for core React Native and users of this ESLint configuration would be different unless the users include the same Prettier configuration. It is possible to specify the options in this ESLint config, however, it is not recommended because most editor plugins will not read the options and will give inconsistent results. As I see it, there are three options:
|
|
@matt-oakes We have Line 124 in fc91bcc
|
|
@gengjiawen The plugin is there, but I think that the core React Native repository has some custom settings, seen here in the These will be correctly picked up when the core React Native repository runs ESLint, but if a community module uses this ESLint config then they will, by default, get the standard Prettier configuration. To fully match the React Native code style, they will need to include the same configuration in their repository. I should say, this is all guesswork on my part, I've not actually tested that this is the case, however, from the Prettier and |
|
We could also duplicate the config into the eslint config and ensure that it stays consistent, right? |
cpojer
left a comment
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.
Thanks so much, this is exactly what I had in mind to start.
- I agree we should figure out how to make all projects use the same prettier config, at least in react-native-community. Maybe in a follow-up PR we can add the config to the eslint setup (even if that's not recommended) and add a README to this package that asks people to add the appropriate prettier config for their projects.
- Did you ask the author of the npm package for the package name and are you able to publish to it? Otherwise I'll have to change the name prior to publishing (I may reuse the @react-native-community org).
- I'll try to land and see if I have to make any changes internally.
facebook-github-bot
left a comment
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.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
This pull request was successfully merged by @dratwas in e903d80. When will my fix make it into a release? | Upcoming Releases |
…23688) Summary: Basing on discussion from this issue - react-native-community/discussions-and-proposals#65 we moved ESLint/Prettier config to its own package inside packages directory. At this moment we had to left all `eslint` dependencies in root `package.json` since `eslint-config-react-native` is not published yet. [General] [Changed] - Move eslint/prettier config to packages/eslint-config-react-native Pull Request resolved: facebook/react-native#23688 Differential Revision: D14277068 Pulled By: cpojer fbshipit-source-id: ef2d0b33210418318cc8324f15fedd84df0ef64d
Summary
Basing on discussion from this issue - react-native-community/discussions-and-proposals#65 we moved ESLint/Prettier config to its own package inside packages directory.
At this moment we had to left all
eslintdependencies in rootpackage.jsonsinceeslint-config-react-nativeis not published yet.Changelog
[General] [Changed] - Move eslint/prettier config to packages/eslint-config-react-native
Test Plan
Lint returns same numbers as before
yarn lintoutput:✖ 80 problems (0 errors, 80 warnings)