-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintcache
1 lines (1 loc) 路 10.8 KB
/
.eslintcache
1
[{"/develop/learn-react-hooks/hooks/src/index.tsx":"1","/develop/learn-react-hooks/hooks/src/app/App.tsx":"2","/develop/learn-react-hooks/hooks/src/app/useState/index.tsx":"3","/develop/learn-react-hooks/hooks/src/app/useEffectnLayout/index.tsx":"4","/develop/learn-react-hooks/hooks/src/app/useContext/index.tsx":"5","/develop/learn-react-hooks/hooks/src/app/useContext/composition.tsx":"6","/develop/learn-react-hooks/hooks/src/app/useContext/provider.tsx":"7","/develop/learn-react-hooks/hooks/src/app/useContext/providerWCallback.tsx":"8","/develop/learn-react-hooks/hooks/src/app/useReducer/index.tsx":"9","/develop/learn-react-hooks/hooks/src/app/useReducer/wState.tsx":"10","/develop/learn-react-hooks/hooks/src/app/useReducer/wReducer.tsx":"11","/develop/learn-react-hooks/hooks/src/app/useCallback/index.tsx":"12","/develop/learn-react-hooks/hooks/src/app/useMemo/index.tsx":"13","/develop/learn-react-hooks/hooks/src/app/useRef/index.tsx":"14"},{"size":160,"mtime":1608943857509,"results":"15","hashOfConfig":"16"},{"size":1712,"mtime":1609662254145,"results":"17","hashOfConfig":"16"},{"size":397,"mtime":1609685987682,"results":"18","hashOfConfig":"16"},{"size":2531,"mtime":1609685987682,"results":"19","hashOfConfig":"16"},{"size":1475,"mtime":1609685987682,"results":"20","hashOfConfig":"16"},{"size":1043,"mtime":1609685987682,"results":"21","hashOfConfig":"16"},{"size":445,"mtime":1609685987682,"results":"22","hashOfConfig":"16"},{"size":962,"mtime":1609132060460,"results":"23","hashOfConfig":"16"},{"size":462,"mtime":1609207959360,"results":"24","hashOfConfig":"16"},{"size":1372,"mtime":1609207669331,"results":"25","hashOfConfig":"16"},{"size":2180,"mtime":1609220351975,"results":"26","hashOfConfig":"16"},{"size":4103,"mtime":1609685987682,"results":"27","hashOfConfig":"16"},{"size":2500,"mtime":1609685987699,"results":"28","hashOfConfig":"16"},{"size":1682,"mtime":1609685987682,"results":"29","hashOfConfig":"16"},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},"1c1v2ee",{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"43","messages":"44","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"47","usedDeprecatedRules":"32"},{"filePath":"48","messages":"49","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"52","messages":"53","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"54","messages":"55","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"56","usedDeprecatedRules":"32"},{"filePath":"57","messages":"58","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"59","messages":"60","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},"/develop/learn-react-hooks/hooks/src/index.tsx",[],["61","62"],"/develop/learn-react-hooks/hooks/src/app/App.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useState/index.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useEffectnLayout/index.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useContext/index.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useContext/composition.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useContext/provider.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useContext/providerWCallback.tsx",["63"],"import * as React from 'react';\n\nconst initialStateCallback = {\n callbackState: ''\n}\n\nexport const ContextCallback = React.createContext<typeof initialStateCallback | any>(undefined);\n\nfunction ContextCallbackProvider(props: React.PropsWithChildren<{}>) {\n const [callbackState, setCallbackState] = React.useState(initialStateCallback);\n\n // With useCallback (prefered)\n const setContextCallback = React.useCallback(\n newState => {\n return setCallbackState({\n callbackState: { ...newState }\n })\n },\n [callbackState, setCallbackState]\n );\n\n const getContextCallback = React.useCallback(\n () => ({ setContextCallback, ...callbackState }),\n [callbackState, setContextCallback]\n );\n\n return (\n <ContextCallback.Provider value={getContextCallback()}>\n {props.children}\n </ContextCallback.Provider>\n )\n}\n\nexport default ContextCallbackProvider;","/develop/learn-react-hooks/hooks/src/app/useReducer/index.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useReducer/wState.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useReducer/wReducer.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useCallback/index.tsx",["64"],"import * as React from 'react';\n\nconst functionLogs = new Set();\nconst functionLogsReset = new Set();\n\nconst functionLogsWCallback = new Set();\nconst functionLogsResetWCallback = new Set();\n\nconst UseCallback = () => {\n const staticData = ['Item 1', 'Item 2', 'Item 3'];\n const [items, setItems] = React.useState({\n lists: staticData\n });\n\n const [itemsWCallback, setItemsWCallback] = React.useState({\n lists: staticData\n });\n\n\n const addItems = () => {\n let _placeArray: any = [];\n _placeArray.push(`Item ${items.lists.length + 1}`);\n\n setItems({\n lists: [...items.lists.concat(_placeArray)]\n })\n }\n\n // Recreate addItemsWCallback on every change of itemsWCallback.lists!\n const addItemsWCallback = React.useCallback(() => {\n let _placeArrayWCallback = [];\n _placeArrayWCallback.push(`Item ${itemsWCallback.lists.length + 1}`)\n\n setItemsWCallback({\n lists: [...itemsWCallback.lists.concat(_placeArrayWCallback)]\n })\n }, [itemsWCallback.lists]);\n\n\n const reset = () => {\n setItems({\n lists: staticData\n })\n }\n\n const resetWCallback = React.useCallback(() => {\n setItemsWCallback({\n lists: staticData\n })\n }, [itemsWCallback.lists]);\n\n\n\n // Debug process\n functionLogs.add(addItems);\n functionLogsReset.add(reset);\n functionLogsWCallback.add(addItemsWCallback);\n functionLogsResetWCallback.add(resetWCallback);\n\n // Ketika salah satu function lain dipanggil, maka function yang tanpa menggunakan callback, akan dibuat ulang\n console.log(`Without callback addItems(), created: `, functionLogs.size, ' times');\n console.log(`Without callback reset(), created: `, functionLogsReset.size, ' times');\n\n // Hanya dibuat ulang ketika nilai itemsWCallback.lists berubah (tidak dibuat ulang ketika function lain dipanggil)\n console.log(`With callback addItemsWCallback(), created: `, functionLogsWCallback.size, ' times');\n console.log(`With callback resetWCallback(), created: `, functionLogsResetWCallback.size, ' times');\n\n\n // Divider\n console.log('');\n\n return (\n <>\n <h1>useCallback()</h1>\n <div className=\"list-groups\" style={{ \n display: 'flex', \n flexDirection: 'row',\n }}>\n <div className=\"list-groups-items\">\n <h2>without useCallback()</h2>\n <ul>\n {items.lists.map((item: any, index: number) => {\n return <li key={index}>{item}</li>\n })}\n </ul>\n\n <button onClick={() => addItems()}>Add item</button>\n <button onClick={() => reset()}>Reset item</button>\n\n <div style={{ margin: '20px 0' }}>\n {JSON.stringify(`Without callback addItems(), created: ${functionLogs.size} times`)} <br />\n {JSON.stringify(`Without callback reset(), created: ${functionLogsReset.size} times`)}\n </div>\n </div>\n\n <div className=\"list-groups-items\" style={{ marginLeft: '50px' }}>\n <h2>with useCallback()</h2>\n <ul>\n {itemsWCallback.lists.map((item: any, index: number) => {\n return <li key={index}>{item}</li>\n })}\n </ul>\n\n <button onClick={addItemsWCallback}>Add item</button>\n <button onClick={resetWCallback}>Reset item</button>\n\n <div style={{ margin: '20px 0' }}>\n {JSON.stringify(`With callback addItemsWCallback(), created: ${functionLogsWCallback.size} times`)} <br />\n {JSON.stringify(`With callback resetWCallback(), created: ${functionLogsResetWCallback.size} times`)}\n </div>\n </div>\n </div>\n </>\n );\n}\n\nexport default UseCallback;","/develop/learn-react-hooks/hooks/src/app/useMemo/index.tsx",[],"/develop/learn-react-hooks/hooks/src/app/useRef/index.tsx",[],{"ruleId":"65","replacedBy":"66"},{"ruleId":"67","replacedBy":"68"},{"ruleId":"69","severity":1,"message":"70","line":19,"column":9,"nodeType":"71","endLine":19,"endColumn":42,"suggestions":"72"},{"ruleId":"69","severity":1,"message":"73","line":66,"column":8,"nodeType":"71","endLine":66,"endColumn":30,"suggestions":"74"},"no-native-reassign",["75"],"no-negated-in-lhs",["76"],"react-hooks/exhaustive-deps","React Hook React.useCallback has an unnecessary dependency: 'callbackState'. Either exclude it or remove the dependency array.","ArrayExpression",["77"],"React Hook React.useCallback has a missing dependency: 'staticData'. Either include it or remove the dependency array.",["78"],"no-global-assign","no-unsafe-negation",{"desc":"79","fix":"80"},{"desc":"81","fix":"82"},"Update the dependencies array to be: [setCallbackState]",{"range":"83","text":"84"},"Update the dependencies array to be: [staticData]",{"range":"85","text":"86"},[570,603],"[setCallbackState]",[2329,2351],"[staticData]"]