Skip to content

Commit 01500a5

Browse files
committed
Lint all examples
1 parent 9c21959 commit 01500a5

File tree

55 files changed

+34
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+34
-20
lines changed

.eslintignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
**/*.snap
22
**/dist/**
33
**/es/**
4-
**/lib/**
4+
**/lib/**
5+
**/*.html
6+
**/*.hbs

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@
7979
"import/order": [2, { "newlines-between": "always" }],
8080

8181
"react/prop-types": 0,
82+
"react/no-array-index-key": 0,
8283
"react/button-has-type": 2,
8384
"react/no-access-state-in-setstate": 2,
84-
"react/no-array-index-key": 2,
8585
"react/no-redundant-should-component-update": 2,
8686
"react/no-unsafe": 2,
8787
"react/no-unused-state": 2,

examples/advanced/src/components/app.js examples/advanced/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Query } from '@redux-requests/react';
55

66
import { fetchPhoto, fetchPost } from '../store/actions';
77
import { FETCH_PHOTO, FETCH_POST } from '../store/constants';
8+
89
import Spinner from './spinner';
910
import Photo from './photo';
1011
import Post from './post';
File renamed without changes.

examples/basic/src/components/app.js examples/basic/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Query } from '@redux-requests/react';
55

66
import { fetchPhoto, fetchPost } from '../store/actions';
77
import { FETCH_PHOTO, FETCH_POST } from '../store/constants';
8+
89
import Spinner from './spinner';
910
import Photo from './photo';
1011
import Post from './post';
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/fetch-api/src/components/app.js examples/fetch-api/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Query } from '@redux-requests/react';
55

66
import { fetchPhoto, fetchPost } from '../store/actions';
77
import { FETCH_PHOTO, FETCH_POST } from '../store/constants';
8+
89
import Spinner from './spinner';
910
import Photo from './photo';
1011
import Post from './post';
File renamed without changes.

examples/graphql/src/components/app.js examples/graphql/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
UPLOAD_FILE,
2020
UPLOAD_FILES,
2121
} from '../store/constants';
22+
2223
import Spinner from './spinner';
2324

2425
const buttonStyle = { marginRight: 10 };
File renamed without changes.

examples/mock-and-multiple-drivers/src/components/app.js examples/mock-and-multiple-drivers/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Query } from '@redux-requests/react';
55

66
import { fetchPhoto, fetchPost } from '../store/actions';
77
import { FETCH_PHOTO, FETCH_POST } from '../store/constants';
8+
89
import Spinner from './spinner';
910
import Photo from './photo';
1011
import Post from './post';

examples/mock-and-multiple-drivers/src/store/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { handleRequests } from '@redux-requests/core';
44
import { createDriver as createAxiosDriver } from '@redux-requests/axios';
55
import { createDriver as createMockDriver } from '@redux-requests/mock';
66

7-
import { FETCH_PHOTO } from './constants';
8-
97
export const configureStore = () => {
108
const { requestsReducer, requestsMiddleware } = handleRequests({
119
driver: {

examples/mutations/src/components/app.js examples/mutations/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
FETCH_PHOTO,
1717
FETCH_POSTS,
1818
} from '../store/constants';
19+
1920
import Spinner from './spinner';
2021

2122
const buttonStyle = { marginRight: 10 };
File renamed without changes.

examples/normalisation/src/components/app.js examples/normalisation/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
UPLOAD_FILE,
2323
UPLOAD_FILES,
2424
} from '../store/constants';
25+
2526
import Spinner from './spinner';
2627

2728
const buttonStyle = { marginRight: 10 };
File renamed without changes.

examples/promise-driver/src/components/app.js examples/promise-driver/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Query } from '@redux-requests/react';
55

66
import { fetchPhoto, fetchPost } from '../store/actions';
77
import { FETCH_PHOTO, FETCH_POST } from '../store/constants';
8+
89
import Spinner from './spinner';
910
import Photo from './photo';
1011
import Post from './post';
File renamed without changes.

examples/promise-driver/src/store/actions.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import axios from 'axios';
2+
23
import { FETCH_PHOTO, FETCH_POST } from './constants';
34

45
export const fetchPhoto = id => ({

examples/redux-act-integration/src/components/app.js examples/redux-act-integration/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
fetchPosts,
1010
deletePost,
1111
} from '../store/actions';
12+
1213
import Spinner from './spinner';
1314

1415
const buttonStyle = { marginRight: 10 };

examples/server-side-rendering/src/app-middleware.js examples/server-side-rendering/src/app-middleware.jsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ router.get('/api/books/:id', async (req, res) => {
6262
const { id } = req.params;
6363

6464
if (!id || !books.find(v => v.id === id)) {
65-
return res.sendStatus(404).send();
65+
res.sendStatus(404).send();
66+
return;
6667
}
6768

6869
await sleep();
@@ -73,7 +74,8 @@ router.get('/api/bookScreeningActors', async (req, res) => {
7374
const { bookIds } = req.query;
7475

7576
if (!bookIds || !Array.isArray(bookIds)) {
76-
return res.sendStatus(400).send();
77+
res.sendStatus(400).send();
78+
return;
7779
}
7880

7981
await sleep();

examples/server-side-rendering/src/components/app.js examples/server-side-rendering/src/components/app.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
FETCH_BOOKS_SCREENING_ACTORS,
1010
} from '../store/constants';
1111
import { fetchBook, fetchBooks } from '../store/actions';
12+
1213
import Spinner from './spinner';
1314

1415
const RequestError = () => (

examples/server-side-rendering/src/store/actions.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
FETCH_BOOKS_SCREENING_ACTORS,
55
} from './constants';
66

7-
export const fetchBooksScreeningActors = bookIds => ({
7+
const fetchBooksScreeningActors = bookIds => ({
88
type: FETCH_BOOKS_SCREENING_ACTORS,
99
request: {
1010
url: '/api/bookScreeningActors',
@@ -24,8 +24,6 @@ export const fetchBooks = () => ({
2424
},
2525
meta: {
2626
dependentRequestsNumber: 1,
27-
// cache: 5,
28-
// normalize: true,
2927
onSuccess: (response, action, store) => {
3028
store.dispatch(fetchBooksScreeningActors(response.data.map(v => v.id)));
3129
return response;
@@ -40,7 +38,6 @@ export const fetchBook = id => ({
4038
},
4139
meta: {
4240
cache: true,
43-
// normalize: true,
4441
requestKey: id,
4542
requestsCapacity: 3,
4643
},

examples/showcase/src/components/books.js examples/showcase/src/components/books.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState } from 'react';
22
import { clearRequestsCache } from '@redux-requests/core';
3-
import { Query, Mutation } from '@redux-requests/react';
3+
import { Query } from '@redux-requests/react';
44
import { useDispatch } from 'react-redux';
55
import {
66
Paper,
@@ -15,6 +15,7 @@ import { Pagination, Rating } from '@material-ui/lab';
1515

1616
import { fetchBooks, setBookRating } from '../store/actions';
1717
import { FETCH_BOOKS } from '../store/constants';
18+
1819
import Spinner from './spinner';
1920
import CodeTooltip from './code-tooltip';
2021

examples/showcase/src/components/code-tooltip.js examples/showcase/src/components/code-tooltip.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const CodeTooltip = ({ code }) => {
4242
}
4343

4444
setPristine(false);
45-
}, [code]);
45+
}, [code, pristine]);
4646

4747
return (
4848
<Tooltip
@@ -61,9 +61,9 @@ const CodeTooltip = ({ code }) => {
6161
}}
6262
>
6363
{tokens.map((line, i) => (
64-
<div {...getLineProps({ line, key: i })}>
64+
<div key={i} {...getLineProps({ line, key: i })}>
6565
{line.map((token, key) => (
66-
<span {...getTokenProps({ token, key })} />
66+
<span key={key} {...getTokenProps({ token, key })} />
6767
))}
6868
</div>
6969
))}

examples/showcase/src/components/groups.js examples/showcase/src/components/groups.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ import {
1717
ListItemSecondaryAction,
1818
} from '@material-ui/core';
1919

20-
import { FETCH_GROUPS } from '../store/constants';
2120
import { followUser, unfollowUser } from '../store/actions';
21+
import { FETCH_GROUPS } from '../store/constants';
22+
2223
import Spinner from './spinner';
2324
import CodeTooltip from './code-tooltip';
2425

examples/showcase/src/components/posts.js examples/showcase/src/components/posts.jsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
1717

1818
import { FETCH_POSTS, LIKE_POST, UNLIKE_POST } from '../store/constants';
1919
import { reorderPosts, likePost, unlikePost } from '../store/actions';
20+
2021
import Spinner from './spinner';
2122
import CodeTooltip from './code-tooltip';
2223

@@ -206,11 +207,11 @@ const Posts = () => {
206207
<div {...provided.droppableProps} ref={provided.innerRef}>
207208
{data.map((post, i) => (
208209
<Draggable key={post.id} draggableId={post.id} index={i}>
209-
{provided => (
210+
{providedNested => (
210211
<div
211-
style={provided.draggableProps.style}
212-
ref={provided.innerRef}
213-
{...provided.draggableProps}
212+
style={providedNested.draggableProps.style}
213+
ref={providedNested.innerRef}
214+
{...providedNested.draggableProps}
214215
>
215216
<Paper style={{ padding: 16, marginBottom: 16 }}>
216217
<div>
@@ -277,7 +278,7 @@ const Posts = () => {
277278
)}
278279
</Mutation>
279280
<span
280-
{...provided.dragHandleProps}
281+
{...providedNested.dragHandleProps}
281282
style={{ float: 'right' }}
282283
>
283284
<DragIndicator fontSize="large" />
File renamed without changes.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"build": "lerna run build",
88
"clean": "lerna run clean",
99
"lint": "lerna run lint",
10+
"lint-examples": "eslint 'examples/**/src/**'",
1011
"test": "jest packages/*/src",
1112
"test:cover": "jest --coverage packages/*/src",
1213
"coveralls": "cat ./coverage/lcov.info | coveralls",

0 commit comments

Comments
 (0)