Skip to content
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

Refactor and cleanup for version 11. #117

Merged
merged 11 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:prettier/recommended"
// "./header.eslintrc"
gagik marked this conversation as resolved.
Show resolved Hide resolved
],
"rules": {
"no-restricted-globals": ["error", "globalThis"]
},
"env": {
"es2020": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"settings": {
"react": {
"version": "16.6.3"
}
}
}

2 changes: 1 addition & 1 deletion flipper-plugin-realm/.prettierrc → .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "es5"
"trailingComma": "all"
}
73 changes: 73 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributing

## Filing Issues

Whether you find a bug, typo or an API call that could be clarified, please [file an issue](https://github.com/realm/realm-flipper-plugin/issues) on our GitHub repository.

When filing an issue, please provide as much of the following information as possible in order to help others fix it:

1. **Goals**
2. **Expected results**
3. **Actual results**
4. **Steps to reproduce**
5. **Code sample that highlights the issue** (full Xcode / Android Studio projects that we can compile ourselves are ideal)
6. **Version of Realm / Flipper Desktop Plugin / Flipper Device Plugin / Your OS**

If you'd like to send us sensitive sample code to help troubleshoot your issue, you can email <help@realm.io> directly.

## Contributing Bug Fixes and Enhancements

We love contributions to Realm! If you'd like to fix bugs, contribute code, documentation, or add any other improvements, we recommend that create a new issue to pitch what you would like to work on. Once you are ready to contribute, please [file a Pull Request](https://github.com/realm/realm-flipper-plugin/pulls) on our GitHub repository. Make sure to accept our [CLA](#cla).

If you're on the MongoDB payroll, please ensure you're familiar with [the Realm SDK cross-team working agreement](https://docs.google.com/document/d/1AB9Z1F29oLmubnPAjfphYwGz1xqqeotHaMWK5OKkL3A/edit).

When creating a PR as an external contributor, please express your intent with your PR; what do you want to solve? To avoid duplication, please link your PR to an existing issue.

Moreover, indicate how you would like us to support you. We will happily guide you and work with you to move the PR to a point where it can be merged. It might require considerable work at your end to meet our expectations (code quality, API docs, TS defs, tests, etc.). In the case you want to move on and not work with us, please let us know. If the PR meets our expectations, we will merge it - and if it doesn't, we will either take over or close it, depending on the requirement on our time and our current priorities.

### Branching

If you’re working on a long-living branch, keep it updated with upstream changes by rebasing it on the target branch on a regular basis. This requires a force-push, so you should coordinate with anyone working on the same branch team when doing that.

### Commit Messages

Although we don’t enforce a strict format for commit messages, we prefer that you follow the guidelines below, which are common among open source projects. Following these guidelines helps with the review process, searching commit logs and documentation of implementation details. At a high level, the contents of the commit message should convey the rationale of the change, without delving into much detail. For example, `setter names were not set right` leaves the reviewer wondering about which bits and why they weren’t “right”. In contrast, `[RLMProperty] Correctly capitalize setterName` conveys almost all there is to the change.

Below are some guidelines about the format of the commit message itself:

* Separate the commit message into a single-line title and a separate body that describes the change.
* Make the title concise to be easily read within a commit log.
* Make the body concise, while including the complete reasoning. Unless required to understand the change, additional code examples or other details should be left to the pull request.
* If the commit fixes a bug, include the number of the issue in the message.
* Use the first person present tense - for example "Fix …" instead of "Fixes …" or "Fixed …".
* For text formatting and spelling, follow the same rules as documentation and in-code comments — for example, the use of capitalization and periods.
* If the commit is a bug fix on top of another recently committed change, or a revert or reapply of a patch, include the Git revision number of the prior related commit, e.g. `Revert abcd3fg because it caused #1234`.

### CLA

Realm welcomes all contributions! The only requirement we have is that, like many other projects, we need to have a [Contributor License Agreement](https://en.wikipedia.org/wiki/Contributor_License_Agreement) (CLA) in place before we can accept any external code. Our own CLA is a modified version of the Apache Software Foundation’s CLA.

[Please submit your CLA electronically using our Google form](https://docs.google.com/forms/d/e/1FAIpQLSeQ9ROFaTu9pyrmPhXc-dEnLD84DbLuT_-tPNZDOL9J10tOKQ/viewform) so we can accept your submissions. The GitHub username you file there will need to match that of your Pull Requests. If you have any questions or cannot file the CLA electronically, you can email <help@realm.io>.

## Building and Debugging the Realm Flipper Plugin Locally
This guide assumes that development is happening on a Mac.
### 1. Building `realm-flipper-plugin-device`
1. Navigate to the device plugin directory: `cd realm-flipper-plugin-device`.
2. Install dependencies with `npm install`.
3. Build with `npm run build` or `npm run build -- --watch` for live build updates.

### 2. Building and using `flipper-plugin-realm`
1. Navigate to the device plugin directory: `cd flipper-plugin-realm`.
2. Install dependencies with `npm install`
3. Build with `npm run build` or `npm run build -- --watch` for live build updates.
4. **Add the path to your `flipper-plugin-realm` directory to `"pluginPaths"` of your `~/.flipper/config.json`. See [Flipper Docs](https://fbflipper.com/docs/extending/loading-custom-plugins/) for more information**.

### 3. Testing the plugin with the Realm Flipper Tester
The plugin directory contains `testApp` which is a sample React Native application you can use to test the local device plugin. If you would like to embed the local device plugin version to a different app, refer to the `metro.config.json` and `package.json` of `testApp` as a reference for how that could be done.
1. Navigate to the test app directory `cd testApp`.
2. Install dependencies with `npm install`.
3. Install Pods with `cd ios && pod install`
4. Run the application by going back to `testApp` root with `cd ..` and `npm run ios`.

That's it! `testApp` will use the current build of `realm-flipper-plugin-device`.

18 changes: 18 additions & 0 deletions flipper-plugin-realm/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// From https://github.com/realm/realm-js/blob/master/packages/realm-react/.eslintrc.json
{
"plugins": [
"eslint-plugin-tsdoc"
],
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"tsdoc/syntax": "warn"
}
}

26 changes: 0 additions & 26 deletions flipper-plugin-realm/.eslintrc.js

This file was deleted.

Loading