Skip to content

Commit

Permalink
v3.5.1 (#951)
Browse files Browse the repository at this point in the history
* fix(types): fix file blob type for uploadFile and uploadFiles (#950) - @rscotten
* chore(docs): cleanup minor typo in useFirestoreConnect.md (#949) - @gregfenton
* chore(tests): fix typo "merge" to "merges" in reducer test file (#948) - @yukimurasawa
* chore(docs): remove note about populate not being supported in firestore (#915)
* chore(examples): clarify explanation in `watchEvent` example snippet (#910)
* chore(docs): add correct syntax highlighting to example in firestore.md
* chore(build): improve lint command
* chore(build): only require jsdoc comments in source

Co-authored-by: Richard Scotten <[email protected]>
Co-authored-by: gregfenton <[email protected]>
Co-authored-by: yukimurasawa <[email protected]>
Co-authored-by: yukimurasawa <[email protected]>
  • Loading branch information
5 people authored May 31, 2020
1 parent 4e1813a commit 8b7aa36
Show file tree
Hide file tree
Showing 17 changed files with 291 additions and 261 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ lib/**
_book/**
_site/**
docs/**
index.d.ts
index.d.ts
examples/**
test/utils.js
45 changes: 28 additions & 17 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
root: true,
parser: 'babel-eslint',
extends: ['standard', 'standard-react', 'prettier', 'prettier/react', 'plugin:jsdoc/recommended'],
plugins: ['babel', 'react', 'prettier', 'react-hooks', 'jsdoc'],
extends: ['standard', 'standard-react', 'prettier', 'prettier/react'],
plugins: ['babel', 'react', 'prettier', 'react-hooks'],
settings: {
react: {
version: 'detect'
Expand All @@ -15,18 +15,29 @@ module.exports = {
rules: {
semi: [2, 'never'],
'no-console': 'error',
'jsdoc/newline-after-description': 0,
'jsdoc/no-undefined-types': [1, { definedTypes: ['React', 'firebase'] }],
'prettier/prettier': ['error', {
singleQuote: true,
trailingComma: 'none',
semi: false,
bracketSpacing: true,
jsxBracketSameLine: true,
printWidth: 80,
tabWidth: 2,
useTabs: false
}]
}
};

'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'none',
semi: false,
bracketSpacing: true,
jsxBracketSameLine: true,
printWidth: 80,
tabWidth: 2,
useTabs: false
}
]
},
overrides: [
{
files: ['./src/**/**.js'],
plugins: ['jsdoc'],
extends: ['plugin:jsdoc/recommended'],
rules: {
'jsdoc/newline-after-description': 0,
'jsdoc/no-undefined-types': [1, { definedTypes: ['React', 'firebase'] }]
}
}
]
}
2 changes: 1 addition & 1 deletion docs/api/firestoreConnect.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

Higher Order Component that automatically listens/unListens
to provided Cloud Firestore paths using React's Lifecycle hooks. Make sure you
have required/imported Cloud Firestore, including it's reducer, before
have required/imported Cloud Firestore, including its reducer, before
attempting to use. **Note** Populate is not yet supported.

### Parameters
Expand Down
52 changes: 25 additions & 27 deletions docs/api/useFirestoreConnect.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

### Table of Contents

- [useFirestoreConnect][1]
- [Parameters][2]
- [Examples][3]
- [useFirestoreConnect][1]
- [Parameters][2]
- [Examples][3]

## useFirestoreConnect


React hook that automatically listens/unListens
to provided Cloud Firestore paths. Make sure you have required/imported
Cloud Firestore, including it's reducer, before attempting to use.
**Note** Populate is not yet supported.
Populate is supported for Firestore as of v0.6.0 of redux-firestore (added
[as part of issue #48][5]).

### Parameters

- `queriesConfigs` **([object][5] \| [string][6] \| [Array][7] \| [Function][8])** An object, string,
or array of object or string for paths to sync from firestore. Can also be
a function that returns the object, string, or array of object or string.
- `queriesConfigs` **([object][6] \| [string][7] \| [Array][8] \| [Function][9])** An object, string,
or array of object or string for paths to sync from firestore. Can also be
a function that returns the object, string, or array of object or string.

### Examples

Expand All @@ -30,15 +30,17 @@ import { useSelector } from 'react-redux'
import { useFirestoreConnect } from 'react-redux-firebase'

export default function TodosList() {
useFirestoreConnect('todos') // sync todos collection from Firestore into redux
const todos = useSelector(state => state.firestore.data.todos)
useFirestoreConnect(['todos']) // sync todos collection from Firestore into redux
const todos = useSelector((state) => state.firestore.data.todos)
return (
<ul>
{todos &&
todos.map((todo) => (
<li>id: {todo.id} todo: {todo.description}</li>
<li>
id: {todo.id} todo: {todo.description}
</li>
))}
</ul>
</ul>
)
}
```
Expand All @@ -51,10 +53,12 @@ import { useSelector } from 'react-redux'
import { useFirestoreConnect } from 'react-redux-firebase'

export default function TodoItem({ todoId }) {
useFirestoreConnect([{
collection: 'todos',
doc: todoId
}])
useFirestoreConnect([
{
collection: 'todos',
doc: todoId
}
])
const todo = useSelector(
({ firestore: { data } }) => data.todos && data.todos[todoId]
)
Expand All @@ -64,17 +68,11 @@ export default function TodoItem({ todoId }) {
```

[1]: #usefirestoreconnect

[2]: #parameters

[3]: #examples

[4]: https://react-redux-firebase.com/docs/api/useFirestoreConnect.html

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
[5]: https://github.com/prescottprue/redux-firestore/issues/48
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
Loading

0 comments on commit 8b7aa36

Please sign in to comment.