Skip to content

Commit

Permalink
Merge branch 'spring-cleaning'
Browse files Browse the repository at this point in the history
  • Loading branch information
radex committed May 7, 2021
2 parents 4403ea0 + a7afa2b commit c32f299
Show file tree
Hide file tree
Showing 149 changed files with 1,252 additions and 2,141 deletions.
115 changes: 54 additions & 61 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

env:
es6: true
jest: true
Expand All @@ -22,94 +21,88 @@ settings:

rules:
curly:
- 2
- error
- all
arrow-parens:
- 2
- as-needed
semi:
- 2
- never
class-methods-use-this: 0
class-methods-use-this: off
comma-dangle:
- 2
- error
- always-multiline
no-console:
- 2
no-unused-expressions: 0
- error
no-unused-expressions: off
no-param-reassign:
- 2
- error
- props: false
no-useless-escape: 0
func-names: 0
quotes:
- 2
- single
- allowTemplateLiterals: true
no-underscore-dangle: 0
object-curly-newline: 0
function-paren-newline: 0
no-useless-escape: off
func-names: off
no-underscore-dangle: off
no-unused-vars:
- 2
- argsIgnorePattern: "^_"
- error
- argsIgnorePattern: '^_'
no-else-return:
- 2
- error
- allowElseIf: true

# react
react/prop-types: 0
react/jsx-filename-extension: 0
react/jsx-first-prop-new-line:
- 2
# formatting (off - formatting is Prettier's job)
semi:
- error
- never
arrow-parens: off
react/jsx-closing-bracket-location: off
react/jsx-first-prop-new-line: off
operator-linebreak: off
object-curly-newline: off
function-paren-newline: off
max-classes-per-file: off
react/jsx-indent: off
quotes: off
react/jsx-curly-newline: off
flowtype/space-after-type-colon: off
flowtype/generic-spacing: off
# react
react/prop-types: off
react/jsx-filename-extension: off
react/jsx-indent-props:
- 2
- 2
react/jsx-closing-bracket-location:
- 1
- selfClosing: after-props
nonEmpty: after-props
- error
react/prefer-stateless-function:
- 1
- ignorePureComponents: true
react/jsx-boolean-value:
- 2
- error
- always
react/no-unused-prop-types: 0
react/destructuring-assignment: 0
react/jsx-one-expression-per-line: 0
react/no-unused-prop-types: off
react/destructuring-assignment: off
react/jsx-one-expression-per-line: off
flowtype/delimiter-dangle:
- 2
- error
- always-multiline
flowtype/require-return-type:
- 2
- error
- always
- excludeArrowFunctions: true
annotateUndefined: always
import/prefer-default-export: 0
import/named: 0 # doesn't seem to work with Flow
import/no-extraneous-dependencies: 0
import/no-cycle: 0
jest/no-large-snapshots: 1
jest/no-disabled-tests: 0
global-require: 0
no-plusplus: 0
max-classes-per-file: 0
prefer-object-spread: 0
react/jsx-props-no-spreading: 0
react/jsx-no-bind: 0
import/prefer-default-export: off
import/named: off # doesn't seem to work with Flow
import/no-extraneous-dependencies: off
import/no-cycle: off
jest/no-large-snapshots: warn
jest/no-disabled-tests: off
global-require: off
no-plusplus: off
prefer-object-spread: off
react/jsx-props-no-spreading: off
react/jsx-no-bind: off

overrides:
- files:
- "src/**/*.js"
- 'src/**/*.js'
excludedFiles:
- "*integrationTest.js"
- "*test.js"
- "**/__tests__/**"
- "*test.*.js"
- '*integrationTest.js'
- '*test.js'
- '**/__tests__/**'
- '*test.*.js'
rules:
flowtype/require-valid-file-annotation:
- 2
- error
- always

globals:
Expand Down
15 changes: 0 additions & 15 deletions .prettierrc

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG-Unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

### BREAKING CHANGES

- Deprecated `new Database({ actionsEnabled: false })` options is now removed. Actions are always enabled.
- Deprecated `new SQLiteAdapter({ synchronous: true })` option is now removed. Use `{ jsi: true }` instead.
- Deprecated `Q.unsafeLokiFilter` is now removed.
Use `Q.unsafeLokiTransform((raws, loki) => raws.filter(raw => ...))` instead.
- Deprecated `Query.hasJoins` is now removed

### Deprecations

### New features
Expand All @@ -12,6 +18,8 @@

### Changes

- All Watermelon console logs are prepended with a 🍉 tag

### Fixes

### Internal
34 changes: 16 additions & 18 deletions docs-master/Advanced/SharingDatabaseAcrossTargets.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,29 @@ This tells iOS to share storage directories between your targets, and in this ca
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
import schema from './schema';
import RNFetchBlob from 'rn-fetch-blob';

const getAppGroupPath = (): string => {
let path = '';

if (Platform.OS === 'ios') {
path = `${RNFetchBlob.fs.syncPathAppGroup('group.com.example.MyAwesomeApp')}/`;
}

return path;
}

const adapter = new SQLiteAdapter({
dbName: `${getAppGroupPath()}default.db`,
schema,
});

const database = new Database({
adapter,
modelClasses: [
...
],
actionsEnabled: true,
});

export default database;
```

Expand All @@ -80,10 +79,10 @@ This tells iOS to share storage directories between your targets, and in this ca
4. Add a file named `AppGroup.swift` and paste the following:
```
import Foundation

@objc(AppGroup)
class AppGroup: NSObject {

@objc
func constantsToExport() -> [AnyHashable : Any]! {
var path = ""
Expand All @@ -92,44 +91,43 @@ This tells iOS to share storage directories between your targets, and in this ca
path = directory.path
}
}

return ["path": "\(path)/"]
}
}
```
This reads your new `Info.plist` row and exports a constant called `path` with your App Group path (shared directory path), to be used in your JS code.
5. In your JS, when creating the database, import the `path` constant from your new `AppGroup` module and prepend to your `dbName`:
```ts
import { NativeModules, Platform } from 'react-native';
import { Database } from '@nozbe/watermelondb';
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
import schema from './schema';

const getAppGroupPath = (): string => {
let path = '';

if (Platform.OS === 'ios') {
path = NativeModules.AppGroup.path;
}

return path;
}

const adapter = new SQLiteAdapter({
dbName: `${getAppGroupPath()}default.db`,
schema,
});

const database = new Database({
adapter,
modelClasses: [
...
],
actionsEnabled: true,
});

export default database;
```

Expand Down
1 change: 0 additions & 1 deletion docs-master/Components.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ import DatabaseProvider from '@nozbe/watermelondb/DatabaseProvider'
const database = new Database({
adapter,
modelClasses: [Blog, Post, Comment],
actionsEnabled: true,
})
render(
Expand Down
1 change: 0 additions & 1 deletion docs-master/Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const database = new Database({
modelClasses: [
// Post, // ⬅️ You'll add Models to Watermelon here
],
actionsEnabled: true,
})
```

Expand Down
3 changes: 0 additions & 3 deletions native/ios/WatermelonDB/DatabaseBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ @interface RCT_EXTERN_REMAP_MODULE(DatabaseBridge, DatabaseBridge, NSObject)
args \
resolve:(RCTPromiseResolveBlock)resolve \
reject:(RCTPromiseRejectBlock)reject \
) \
RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(WMELON_CONCAT(name, Synchronous):(nonnull NSNumber *)connectionTag \
args \
)

WMELON_BRIDGE_METHOD(initialize,
Expand Down
Loading

0 comments on commit c32f299

Please sign in to comment.