Skip to content

Commit 8b7aa36

Browse files
prescottpruerscottengregfentonyukimurasawayukimurasawa
authored
v3.5.1 (#951)
* 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]>
1 parent 4e1813a commit 8b7aa36

17 files changed

+291
-261
lines changed

.eslintignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ lib/**
66
_book/**
77
_site/**
88
docs/**
9-
index.d.ts
9+
index.d.ts
10+
examples/**
11+
test/utils.js

.eslintrc.js

+28-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module.exports = {
22
root: true,
33
parser: 'babel-eslint',
4-
extends: ['standard', 'standard-react', 'prettier', 'prettier/react', 'plugin:jsdoc/recommended'],
5-
plugins: ['babel', 'react', 'prettier', 'react-hooks', 'jsdoc'],
4+
extends: ['standard', 'standard-react', 'prettier', 'prettier/react'],
5+
plugins: ['babel', 'react', 'prettier', 'react-hooks'],
66
settings: {
77
react: {
88
version: 'detect'
@@ -15,18 +15,29 @@ module.exports = {
1515
rules: {
1616
semi: [2, 'never'],
1717
'no-console': 'error',
18-
'jsdoc/newline-after-description': 0,
19-
'jsdoc/no-undefined-types': [1, { definedTypes: ['React', 'firebase'] }],
20-
'prettier/prettier': ['error', {
21-
singleQuote: true,
22-
trailingComma: 'none',
23-
semi: false,
24-
bracketSpacing: true,
25-
jsxBracketSameLine: true,
26-
printWidth: 80,
27-
tabWidth: 2,
28-
useTabs: false
29-
}]
30-
}
31-
};
32-
18+
'prettier/prettier': [
19+
'error',
20+
{
21+
singleQuote: true,
22+
trailingComma: 'none',
23+
semi: false,
24+
bracketSpacing: true,
25+
jsxBracketSameLine: true,
26+
printWidth: 80,
27+
tabWidth: 2,
28+
useTabs: false
29+
}
30+
]
31+
},
32+
overrides: [
33+
{
34+
files: ['./src/**/**.js'],
35+
plugins: ['jsdoc'],
36+
extends: ['plugin:jsdoc/recommended'],
37+
rules: {
38+
'jsdoc/newline-after-description': 0,
39+
'jsdoc/no-undefined-types': [1, { definedTypes: ['React', 'firebase'] }]
40+
}
41+
}
42+
]
43+
}

docs/api/firestoreConnect.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

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

2020
### Parameters

docs/api/useFirestoreConnect.md

+25-27
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
### Table of Contents
44

5-
- [useFirestoreConnect][1]
6-
- [Parameters][2]
7-
- [Examples][3]
5+
- [useFirestoreConnect][1]
6+
- [Parameters][2]
7+
- [Examples][3]
88

99
## useFirestoreConnect
1010

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

1717
### Parameters
1818

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

2323
### Examples
2424

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

3232
export default function TodosList() {
33-
useFirestoreConnect('todos') // sync todos collection from Firestore into redux
34-
const todos = useSelector(state => state.firestore.data.todos)
33+
useFirestoreConnect(['todos']) // sync todos collection from Firestore into redux
34+
const todos = useSelector((state) => state.firestore.data.todos)
3535
return (
3636
<ul>
3737
{todos &&
3838
todos.map((todo) => (
39-
<li>id: {todo.id} todo: {todo.description}</li>
39+
<li>
40+
id: {todo.id} todo: {todo.description}
41+
</li>
4042
))}
41-
</ul>
43+
</ul>
4244
)
4345
}
4446
```
@@ -51,10 +53,12 @@ import { useSelector } from 'react-redux'
5153
import { useFirestoreConnect } from 'react-redux-firebase'
5254

5355
export default function TodoItem({ todoId }) {
54-
useFirestoreConnect([{
55-
collection: 'todos',
56-
doc: todoId
57-
}])
56+
useFirestoreConnect([
57+
{
58+
collection: 'todos',
59+
doc: todoId
60+
}
61+
])
5862
const todo = useSelector(
5963
({ firestore: { data } }) => data.todos && data.todos[todoId]
6064
)
@@ -64,17 +68,11 @@ export default function TodoItem({ todoId }) {
6468
```
6569

6670
[1]: #usefirestoreconnect
67-
6871
[2]: #parameters
69-
7072
[3]: #examples
71-
7273
[4]: https://react-redux-firebase.com/docs/api/useFirestoreConnect.html
73-
74-
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
75-
76-
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
77-
78-
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
79-
80-
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
74+
[5]: https://github.com/prescottprue/redux-firestore/issues/48
75+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
76+
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
77+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
78+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function

0 commit comments

Comments
 (0)