-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 16.4 KB
/
.eslintcache
1
[{"C:\\Users\\amir\\Desktop\\not-twitter\\src\\index.js":"1","C:\\Users\\amir\\Desktop\\not-twitter\\src\\App.js":"2","C:\\Users\\amir\\Desktop\\not-twitter\\src\\views\\Home.js":"3","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Layout\\Layout.js":"4","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Header\\Header.js":"5","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\NewTweet\\NewTweet.js":"6","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\TextField\\TextField.js":"7","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Button\\Button.js":"8","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Divider\\Divider.js":"9","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Tweet\\Tweet.js":"10","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Modal\\Modal.js":"11","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\ReactionPopup\\ReactionPopup.js":"12","C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\DropDownMenu\\DropDownMenu.js":"13","C:\\Users\\amir\\Desktop\\not-twitter\\src\\views\\Details.js":"14","C:\\Users\\amir\\Desktop\\not-twitter\\src\\store\\index.js":"15"},{"size":440,"mtime":1608297773390,"results":"16","hashOfConfig":"17"},{"size":2101,"mtime":1608379431235,"results":"18","hashOfConfig":"17"},{"size":5261,"mtime":1608391474042,"results":"19","hashOfConfig":"17"},{"size":234,"mtime":1608124636298,"results":"20","hashOfConfig":"17"},{"size":681,"mtime":1608295984439,"results":"21","hashOfConfig":"17"},{"size":1834,"mtime":1608388073084,"results":"22","hashOfConfig":"17"},{"size":475,"mtime":1608387697017,"results":"23","hashOfConfig":"17"},{"size":578,"mtime":1608309158312,"results":"24","hashOfConfig":"17"},{"size":266,"mtime":1608110266121,"results":"25","hashOfConfig":"17"},{"size":4835,"mtime":1608378979221,"results":"26","hashOfConfig":"17"},{"size":484,"mtime":1608296006256,"results":"27","hashOfConfig":"17"},{"size":4267,"mtime":1608324224946,"results":"28","hashOfConfig":"17"},{"size":3069,"mtime":1608324284898,"results":"29","hashOfConfig":"17"},{"size":3706,"mtime":1608386443289,"results":"30","hashOfConfig":"17"},{"size":3302,"mtime":1608379023626,"results":"31","hashOfConfig":"17"},{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},"1w9f51m",{"filePath":"35","messages":"36","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"37","usedDeprecatedRules":"34"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"42","messages":"43","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"44","messages":"45","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"46","messages":"47","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"48","messages":"49","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"52","messages":"53","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"54","messages":"55","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"56","messages":"57","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"58","messages":"59","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"60"},{"filePath":"61","messages":"62","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"63","usedDeprecatedRules":"34"},{"filePath":"64","messages":"65","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"66","usedDeprecatedRules":"34"},"C:\\Users\\amir\\Desktop\\not-twitter\\src\\index.js",[],["67","68"],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\App.js",["69"],"import { useEffect } from 'react'\nimport { BrowserRouter, Route, Switch } from 'react-router-dom'\nimport Home from './views/Home'\nimport Details from './views/Details'\nimport axios from 'axios'\nimport { connect } from 'react-redux'\n\nimport {\n updateUsersList,\n updateLoggedUser,\n updateTweetsList,\n} from './store/index'\n\n// local data\nimport localUsers from './data/users.json'\nimport localTweets from './data/tweets.json'\n\nconst App = ({ dispatch }) => {\n const BASE_URL = process.env.REACT_APP_BASE_API_ADDRESS\n const cancelFetchUsersList = axios.CancelToken.source()\n const cancelFetchTweets = axios.CancelToken.source()\n\n useEffect(() => {\n // fetch users list from API\n fetchUsersList()\n handleUpdateLoggedUser()\n fetchTweets()\n\n return () => {\n cancelFetchUsersList.cancel()\n cancelFetchTweets.cancel()\n }\n }, [])\n\n const fetchUsersList = async () => {\n try {\n // fake fetch request\n await axios.get(`${BASE_URL}/users/`, {\n CancelToken: cancelFetchUsersList.token,\n })\n // update users list with local data\n dispatch(updateUsersList(localUsers))\n } catch (e) {\n console.log(`An error occurred white fetching users list`, e)\n }\n }\n\n const handleUpdateLoggedUser = () => {\n // in real cases logged user should be fetch and authenticated even before app loaded, for example after login, but here it's not the case so i will not send request, just update local storage and store\n dispatch(updateLoggedUser(localUsers[0]))\n }\n\n const fetchTweets = async () => {\n try {\n // fake fetch request\n await axios.get(`${BASE_URL}/posts/`, {\n CancelToken: cancelFetchTweets.token,\n })\n // update tweets with local data\n dispatch(updateTweetsList(localTweets))\n } catch (e) {\n console.log(`An error occurred white fetching tweets`, e)\n }\n }\n\n return (\n <BrowserRouter>\n <Switch>\n <Route path=\"/\" exact component={Home} />\n <Route path=\"/tweet/:id\" component={Details} />\n </Switch>\n </BrowserRouter>\n )\n}\n\nexport default connect()(App)\n","C:\\Users\\amir\\Desktop\\not-twitter\\src\\views\\Home.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Layout\\Layout.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Header\\Header.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\NewTweet\\NewTweet.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\TextField\\TextField.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Button\\Button.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Divider\\Divider.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Tweet\\Tweet.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\Modal\\Modal.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\ReactionPopup\\ReactionPopup.js",[],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\components\\DropDownMenu\\DropDownMenu.js",[],["70","71"],"C:\\Users\\amir\\Desktop\\not-twitter\\src\\views\\Details.js",["72","73"],"import { useState, useEffect, useRef } from 'react'\nimport { useHistory, useParams } from 'react-router-dom'\nimport axios from 'axios'\nimport { connect } from 'react-redux'\nimport nanoid from 'nanoid'\n\nimport { getTweet, addComment } from '../store/index'\n\nimport Layout from '../components/Layout/Layout'\nimport Header from '../components/Header/Header'\nimport NewTweet from '../components/NewTweet/NewTweet'\nimport Divider from '../components/Divider/Divider'\nimport Tweet from '../components/Tweet/Tweet'\nimport Modal from '../components/Modal/Modal'\n\nconst Home = ({ dispatch, tweets, loggedUser }) => {\n const BASE_URL = process.env.REACT_APP_BASE_API_ADDRESS\n const history = useHistory()\n const { id } = useParams()\n const cancelFetchTweet = axios.CancelToken.source()\n\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [tweetDetails, setTweetDetails] = useState(null)\n const [commentTweetText, setCommentTweetText] = useState('')\n const [loadingNewTweet, setLoadingNewTweet] = useState(false)\n\n useEffect(() => {\n // get details from fake server\n if (tweets.length > 0) {\n fetchTweet()\n }\n\n return () => {\n cancelFetchTweet.cancel()\n }\n }, [tweets])\n\n const fetchTweet = async () => {\n try {\n // fake fetch request\n await axios.get(`${BASE_URL}/users/`, {\n CancelToken: cancelFetchTweet.token,\n })\n // update users list with local data\n // get user info\n\n const detailTweet = getTweet(id)\n setTweetDetails({ ...detailTweet })\n } catch (e) {\n console.log(`An error occurred white fetching users list`, e)\n }\n }\n\n const handleToggleModalComment = () => {\n setIsModalOpen((isModalOpen) => !isModalOpen)\n }\n\n const handleSetCommentTweetText = (v) => {\n setCommentTweetText(v)\n }\n\n const handleSubmitNewComment = async () => {\n setLoadingNewTweet(true)\n try {\n // fake server request\n const { data } = await axios.post(`${BASE_URL}/posts`, {\n title: 'new tweet',\n body: commentTweetText,\n })\n\n const newComment = {\n tweet_id: nanoid(),\n tweet_owner_id: loggedUser.user_id,\n tweet_owner_name: loggedUser.name,\n tweet_owner_avatar: loggedUser.avatar,\n tweet_owner_username: loggedUser.username,\n date: Date.now(),\n body: data.body,\n parent_tweet_id: tweetDetails.tweet_id,\n }\n\n dispatch(addComment(newComment, tweetDetails.tweet_id))\n // close modal\n handleToggleModalComment()\n } catch (e) {\n console.log(`An error occurred white submitting new comment`, e)\n }\n setLoadingNewTweet(false)\n }\n\n const renderComments = tweetDetails?.comments.map((comment) => {\n return <Tweet content={comment} key={comment.tweet_id} comment />\n })\n\n return (\n <>\n <Layout>\n <Header onActionClicked={() => history.push('/')} title=\"Tweet\" back />\n <Tweet\n content={tweetDetails ? tweetDetails : {}}\n onCommentClicked={() => handleToggleModalComment()}\n />\n <Divider big />\n\n {renderComments}\n\n <Modal\n onCloseClicked={() => handleToggleModalComment()}\n active={isModalOpen}\n title=\"Reply\"\n >\n <Tweet reply content={tweetDetails} />\n <NewTweet\n text={handleSetCommentTweetText}\n onSubmit={() => handleSubmitNewComment()}\n loading={loadingNewTweet}\n avatar={loggedUser.avatar}\n reply\n />\n </Modal>\n </Layout>\n </>\n )\n}\n\nconst mapStateToProps = (state) => {\n return {\n tweets: state.tweets,\n loggedUser: state.loggedUser,\n }\n}\n\nexport default connect(mapStateToProps)(Home)\n","C:\\Users\\amir\\Desktop\\not-twitter\\src\\store\\index.js",["74"],"import { store } from '../index'\n\nconst initState = {\n users: [],\n loggedUser: [],\n tweets: [],\n}\n\n// Types\nconst UPDATE_USERS_LIST = 'UPDATE_USERS_LIST'\nconst UPDATE_LOGGED_USER = 'UPDATE_LOGGED_USER'\nconst UPDATE_TWEETS_LIST = 'UPDATE_TWEETS_LIST'\n\n// Actions\nexport const updateUsersList = (usersList) => {\n const users = handleUpdateLocal('users', usersList)\n return { type: UPDATE_USERS_LIST, users }\n}\n\nexport const updateLoggedUser = (loggedUser) => {\n // update local storage\n localStorage.setItem('loggedUser', JSON.stringify(loggedUser))\n\n return { type: UPDATE_LOGGED_USER, loggedUser }\n}\n\nexport const updateTweetsList = (tweetsList) => {\n const tweets = handleUpdateLocal('tweets', tweetsList)\n return { type: UPDATE_TWEETS_LIST, tweets }\n}\n\nexport const addNewTweet = (newTweet) => {\n let tweets = [...store.getState().tweets]\n tweets.unshift(newTweet)\n tweets = handleUpdateLocal('tweets', tweets)\n return { type: UPDATE_TWEETS_LIST, tweets }\n}\n\nexport const addReaction = (reaction, tweetId) => {\n let tweets = [...store.getState().tweets]\n // find the target tweet\n const targetTweetIndex = tweets.findIndex(\n (tweet) => tweet.tweet_id === tweetId,\n )\n // add reaction\n tweets[targetTweetIndex].reaction = reaction\n\n // update local and state\n localStorage.setItem('tweets', JSON.stringify(tweets))\n return { type: UPDATE_TWEETS_LIST, tweets }\n}\n\nexport const addComment = (comment, tweetId) => {\n let tweets = [...store.getState().tweets]\n // find the target tweet\n const targetTweetIndex = tweets.findIndex(\n (tweet) => tweet.tweet_id === tweetId,\n )\n\n // add reply to\n comment.replyTo = tweets[targetTweetIndex].tweet_owner_username\n // add comment\n tweets[targetTweetIndex].comments.unshift(comment)\n // update local and state\n localStorage.setItem('tweets', JSON.stringify(tweets))\n return { type: UPDATE_TWEETS_LIST, tweets }\n}\n\n// Reducers\nconst rootReducer = (state = initState, action) => {\n switch (action.type) {\n case UPDATE_USERS_LIST:\n return { ...state, users: action.users }\n case UPDATE_LOGGED_USER:\n return { ...state, loggedUser: action.loggedUser }\n case UPDATE_TWEETS_LIST:\n return { ...state, tweets: action.tweets }\n\n default:\n return state\n }\n}\n\nexport default rootReducer\n\n// utils\nconst handleUpdateLocal = (kind, list) => {\n let localList = JSON.parse(localStorage.getItem(kind))\n if (localList) {\n // some items are already in local storage\n // check if list are in local, if not update local\n list.forEach((item) => {\n if (kind === 'tweets') {\n if (!localList.some((ll) => ll.tweet_id === item.tweet_id)) {\n // add to local\n localList.unshift(item)\n }\n } else if (kind === 'users') {\n if (!localList.some((ll) => ll.user_id === item.user_id)) {\n // add to local\n localList.push(item)\n }\n }\n })\n\n // update local storage\n localStorage.setItem(kind, JSON.stringify(localList))\n } else {\n // create users in local storage\n localList = [...list]\n localStorage.setItem(kind, JSON.stringify(list))\n }\n\n return localList\n}\n\nexport const getTweet = (tweetId) => {\n return Object.assign(\n {},\n [...store.getState().tweets].find((tweet) => tweet.tweet_id == tweetId),\n )\n}\n",{"ruleId":"75","replacedBy":"76"},{"ruleId":"77","replacedBy":"78"},{"ruleId":"79","severity":1,"message":"80","line":33,"column":6,"nodeType":"81","endLine":33,"endColumn":8,"suggestions":"82"},{"ruleId":"75","replacedBy":"83"},{"ruleId":"77","replacedBy":"84"},{"ruleId":"85","severity":1,"message":"86","line":1,"column":31,"nodeType":"87","messageId":"88","endLine":1,"endColumn":37},{"ruleId":"79","severity":1,"message":"89","line":36,"column":6,"nodeType":"81","endLine":36,"endColumn":14,"suggestions":"90"},{"ruleId":"91","severity":1,"message":"92","line":120,"column":65,"nodeType":"93","messageId":"94","endLine":120,"endColumn":67},"no-native-reassign",["95"],"no-negated-in-lhs",["96"],"react-hooks/exhaustive-deps","React Hook useEffect has missing dependencies: 'cancelFetchTweets', 'cancelFetchUsersList', 'fetchTweets', 'fetchUsersList', and 'handleUpdateLoggedUser'. Either include them or remove the dependency array.","ArrayExpression",["97"],["95"],["96"],"no-unused-vars","'useRef' is defined but never used.","Identifier","unusedVar","React Hook useEffect has missing dependencies: 'cancelFetchTweet' and 'fetchTweet'. Either include them or remove the dependency array.",["98"],"eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","no-global-assign","no-unsafe-negation",{"desc":"99","fix":"100"},{"desc":"101","fix":"102"},"Update the dependencies array to be: [cancelFetchTweets, cancelFetchUsersList, fetchTweets, fetchUsersList, handleUpdateLoggedUser]",{"range":"103","text":"104"},"Update the dependencies array to be: [cancelFetchTweet, fetchTweet, tweets]",{"range":"105","text":"106"},[853,855],"[cancelFetchTweets, cancelFetchUsersList, fetchTweets, fetchUsersList, handleUpdateLoggedUser]",[1195,1203],"[cancelFetchTweet, fetchTweet, tweets]"]