Files
smart-crop-ui/crop-x-new/docs/eslint-fix.md

37 KiB
Raw Blame History

1.任务根据以下的eslint检查提示修复any类问题。解决方案将any替换为unknown。修复define but not used问题 方案:删除掉未使用的变量。

有问题的内容: @typescript-eslint/no-unused-vars 36:5 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\auto\components\BatchEvaluationPanel.tsx:36:5 34 | 35 | useEffect(() => { > 36 | setBatchManager(new BatchAnalysisManager(dispatch)); | ^^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect 37 | }, [dispatch]); 38 | 39 | const totalWeight = Math.round( react-hooks/set-state-in-effect 67:13 warning 'blockIds' is assigned a value but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\auto\components\EvaluationModel.tsx 11:3 warning 'Eye' is defined but never used @typescript-eslint/no-unused-vars 12:3 warning 'EyeOff' is defined but never used @typescript-eslint/no-unused-vars 16:3 warning 'Droplet' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\auto\components\batchAnalysisService.tsx 3:10 warning 'SpatialAnalysisState' is defined but never used @typescript-eslint/no-unused-vars 6:11 warning 'FactorData' is defined but never used @typescript-eslint/no-unused-vars 305:99 warning 'weights' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\auto\page.tsx 10:3 warning 'Play' is defined but never used @typescript-eslint/no-unused-vars 71:48 warning 'fieldId' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\multiFactor\components\MultiFactorEvaluation.tsx 8:20 warning 'useEffect' is defined but never used @typescript-eslint/no-unused-vars 14:79 warning 'DialogTrigger' is defined but never used @typescript-eslint/no-unused-vars 17:10 warning 'Textarea' is defined but never used @typescript-eslint/no-unused-vars 19:3 warning 'Leaf' is defined but never used @typescript-eslint/no-unused-vars 26:3 warning 'Download' is defined but never used @typescript-eslint/no-unused-vars 27:3 warning 'Eye' is defined but never used @typescript-eslint/no-unused-vars 28:3 warning 'Calculator' is defined but never used @typescript-eslint/no-unused-vars 29:3 warning 'Database' is defined but never used @typescript-eslint/no-unused-vars 30:3 warning 'RefreshCw' is defined but never used @typescript-eslint/no-unused-vars 32:3 warning 'Target' is defined but never used @typescript-eslint/no-unused-vars 33:3 warning 'Droplet' is defined but never used @typescript-eslint/no-unused-vars 35:3 warning 'Sun' is defined but never used @typescript-eslint/no-unused-vars 36:3 warning 'ThermometerSun' is defined but never used @typescript-eslint/no-unused-vars 39:3 warning 'Info' is defined but never used @typescript-eslint/no-unused-vars 40:3 warning 'BarChart3' is defined but never used @typescript-eslint/no-unused-vars 41:3 warning 'Filter' is defined but never used @typescript-eslint/no-unused-vars 46:3 warning 'EvaluationFactor' is defined but never used @typescript-eslint/no-unused-vars 52:3 warning 'getSuitabilityLevelColor' is defined but never used @typescript-eslint/no-unused-vars 54:3 warning 'MOCK_FIELDS' is defined but never used @typescript-eslint/no-unused-vars 60:3 warning 'matchCropsForField' is defined but never used @typescript-eslint/no-unused-vars 68:10 warning 'batchProgress' is assigned a value but never used @typescript-eslint/no-unused-vars 76:10 warning 'isBatchRunning' is assigned a value but never used @typescript-eslint/no-unused-vars 102:9 warning 'handleRunBatchAnalysis' is assigned a value but never used @typescript-eslint/no-unused-vars 133:14 warning 'error' is defined but never used @typescript-eslint/no-unused-vars 172:14 warning 'error' is defined but never used @typescript-eslint/no-unused-vars 177:9 warning 'exportResults' is assigned a value but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\multiFactor\components\cropKnowledgeBase.ts 6:63 warning 'RiskFactor' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\recommend\components\CropRecommendations.tsx 145:39 warning 'state' is defined but never used @typescript-eslint/no-unused-vars 147:45 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 151:27 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 154:87 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\recommend\components\cropRecommendReducer.tsx 3:10 warning 'useReducer' is defined but never used @typescript-eslint/no-unused-vars 4:10 warning 'toast' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(app)\land-information\suitability\recommend\page.tsx 11:3 warning 'SuitabilityResult' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(auth)\login\components\LoginForm.tsx 30:41 warning 'AuthState' is defined but never used @typescript-eslint/no-unused-vars 30:52 warning 'AuthAction' is defined but never used @typescript-eslint/no-unused-vars 31:10 warning 'getCaptchaApiV1AuthCaptchaGet' is defined but never used @typescript-eslint/no-unused-vars 43:10 warning 'phoneCaptchaData' is assigned a value but never used @typescript-eslint/no-unused-vars 43:28 warning 'setPhoneCaptchaData' is assigned a value but never used @typescript-eslint/no-unused-vars 75:14 warning 'err' is defined but never used @typescript-eslint/no-unused-vars 157:19 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 207:14 warning 'err' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app(auth)\register\page.tsx 175:14 warning 'err' is defined but never used @typescript-eslint/no-unused-vars 249:14 warning 'err' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app\layout.tsx 9:143 warning 'MapPin' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\app\not-found.tsx 8:61 warning 'ExternalLink' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\components\app-sidebar.tsx 5:10 warning 'SearchForm' is defined but never used @typescript-eslint/no-unused-vars 6:10 warning 'VersionSwitcher' is defined but never used @typescript-eslint/no-unused-vars 18:3 warning 'SidebarHeader' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\components\auth\AuthContext.tsx 152:21 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 255:21 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 313:6 warning React Hook React.useEffect has a missing dependency: 'validateUser'. Either include it or remove the dependency array react-hooks/exhaustive-deps D:\code\repotest\smart-crop-ui\crop-x-new\src\components\auth\CaptchaInput.tsx 127:6 warning React Hook useEffect has a missing dependency: 'fetchCaptcha'. Either include it or remove the dependency array react-hooks/exhaustive-deps 164:15 warning Using could result in slower LCP and higher bandwidth. Consider using from next/image or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element D:\code\repotest\smart-crop-ui\crop-x-new\src\components\auth\LoadingScreen.tsx 14:3 warning 'message' is defined but never used @typescript-eslint/no-unused-vars 15:3 warning 'subMessage' is defined but never used @typescript-eslint/no-unused-vars 16:3 warning 'variant' is assigned a value but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\components\auth\SmartFieldBackground.tsx 24:5 warning Compilation Skipped: Inline class declarations are not supported Move class declarations outside of components/hooks. D:\code\repotest\smart-crop-ui\crop-x-new\src\components\auth\SmartFieldBackground.tsx:24:5 22 | 23 | // 田间传感器节点 > 24 | class SensorNode { | ^^^^^^^^^^^^^^^^^^ > 25 | x: number; | ^^^^^^^^^^^^^^^^ > 26 | y: number; … | ^^^^^^^^^^^^^^^^ > 95 | } | ^^^^^^^^^^^^^^^^ > 96 | } | ^^^^^^ Inline class declarations are not supported 97 | 98 | // 无人机 99 | class Drone { react-hooks/unsupported-syntax 99:5 warning Compilation Skipped: Inline class declarations are not supported Move class declarations outside of components/hooks. D:\code\repotest\smart-crop-ui\crop-x-new\src\components\auth\SmartFieldBackground.tsx:99:5 97 | 98 | // 无人机 > 99 | class Drone { | ^^^^^^^^^^^^^ > 100 | x: number; | ^^^^^^^^^^^^^^^^ > 101 | y: number; … | ^^^^^^^^^^^^^^^^ > 216 | } | ^^^^^^^^^^^^^^^^ > 217 | } | ^^^^^^ Inline class declarations are not supported 218 | 219 | // 田地波浪效果 220 | class FieldWave { react-hooks/unsupported-syntax 220:5 warning Compilation Skipped: Inline class declarations are not supported Move class declarations outside of components/hooks. D:\code\repotest\smart-crop-ui\crop-x-new\src\components\auth\SmartFieldBackground.tsx:220:5 218 | 219 | // 田地波浪效果 > 220 | class FieldWave { | ^^^^^^^^^^^^^^^^^ > 221 | offset: number; | ^^^^^^^^^^^^^^^^^^^^^ > 222 | speed: number; … | ^^^^^^^^^^^^^^^^^^^^^ > 251 | } | ^^^^^^^^^^^^^^^^^^^^^ > 252 | } | ^^^^^^ Inline class declarations are not supported 253 | 254 | // 数据流粒子 255 | class DataParticle { react-hooks/unsupported-syntax 255:5 warning Compilation Skipped: Inline class declarations are not supported Move class declarations outside of components/hooks. D:\code\repotest\smart-crop-ui\crop-x-new\src\components\auth\SmartFieldBackground.tsx:255:5 253 | 254 | // 数据流粒子 > 255 | class DataParticle { | ^^^^^^^^^^^^^^^^^^^^ > 256 | x: number; | ^^^^^^^^^^^^^^^^ > 257 | y: number; … | ^^^^^^^^^^^^^^^^ > 301 | } | ^^^^^^^^^^^^^^^^ > 302 | } | ^^^^^^ Inline class declarations are not supported 303 | 304 | // 初始化传感器网络 305 | const sensors: SensorNode[] = []; react-hooks/unsupported-syntax D:\code\repotest\smart-crop-ui\crop-x-new\src\components\common\searchFormPagination\components\SearchFormComponent.tsx 40:3 warning 'loading' is assigned a value but never used @typescript-eslint/no-unused-vars 49:3 error Error: Cannot access refs during render React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the current property) during render can cause your component not to update as expected (https://react.dev/reference/react/useRef). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\common\searchFormPagination\components\SearchFormComponent.tsx:49:3 47 | // 使用ref保持最新的onFiltersChange引用避免useEffect重复触发 48 | const onFiltersChangeRef = useRef(onFiltersChange); > 49 | onFiltersChangeRef.current = onFiltersChange; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Cannot update ref during render 50 | 51 | // 同步外部filters到本地state 52 | useEffect(() => { react-hooks/refs 70:15 warning '_lastChangedFieldType' is assigned a value but never used @typescript-eslint/no-unused-vars 70:38 warning '_lastChangedFieldKey' is assigned a value but never used @typescript-eslint/no-unused-vars 98:19 warning '_lastChangedFieldType' is assigned a value but never used @typescript-eslint/no-unused-vars 98:42 warning 'lastChangedFieldKey' is assigned a value but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\components\common\searchFormPagination\components\searchFormPaginationReducer.tsx 12:9 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 36:34 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 49:57 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 193:55 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\components\common\searchFormPagination\page.tsx 11:10 warning 'Button' is defined but never used @typescript-eslint/no-unused-vars 12:10 warning 'Input' is defined but never used @typescript-eslint/no-unused-vars 13:10 warning 'Label' is defined but never used @typescript-eslint/no-unused-vars 15:10 warning 'Select' is defined but never used @typescript-eslint/no-unused-vars 15:18 warning 'SelectContent' is defined but never used @typescript-eslint/no-unused-vars 15:33 warning 'SelectItem' is defined but never used @typescript-eslint/no-unused-vars 15:45 warning 'SelectTrigger' is defined but never used @typescript-eslint/no-unused-vars 15:60 warning 'SelectValue' is defined but never used @typescript-eslint/no-unused-vars 16:23 warning 'ChevronLeft' is defined but never used @typescript-eslint/no-unused-vars 16:36 warning 'ChevronRight' is defined but never used @typescript-eslint/no-unused-vars 17:10 warning 'toast' is defined but never used @typescript-eslint/no-unused-vars 37:20 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 37:30 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 72:48 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 126:42 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 351:7 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\common\searchFormPagination\page.tsx:351:7 349 | 350 | // 设置内部分页状态 > 351 | setInternalPagination(urlPagination); | ^^^^^^^^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect 352 | 353 | // URL中有参数时自动同步到内部状态并通知父组件 354 | if (hasUrlFilters || hasSearchParams) { react-hooks/set-state-in-effect 380:6 warning React Hook useEffect has a missing dependency: 'onUrlStateChange'. Either include it or remove the dependency array. If 'onUrlStateChange' changes too often, find the parent component that defines it and wrap that definition in useCallback react-hooks/exhaustive-deps 389:9 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\common\searchFormPagination\page.tsx:389:9 387 | // 如果父组件的分页状态与内部状态不一致,同步内部状态 388 | if (pagination.page !== internalPagination.page || pagination.size !== internalPagination.size) { > 389 | setInternalPagination({ | ^^^^^^^^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect 390 | page: pagination.page, 391 | size: pagination.size 392 | }); react-hooks/set-state-in-effect 580:75 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\components\field\MapPointPicker.tsx 31:34 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 32:42 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 33:42 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 68:6 warning React Hook useEffect has missing dependencies: 'map' and 'points'. Either include them or remove the dependency array react-hooks/exhaustive-deps 103:5 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\field\MapPointPicker.tsx:103:5 101 | }); 102 | > 103 | setMarkers(newMarkers); | ^^^^^^^^^^ Avoid calling setState() directly within an effect 104 | 105 | // 绘制多边形(仅多边形模式) 106 | if (mode === 'polygon' && points.length >= 3) { react-hooks/set-state-in-effect 124:6 warning React Hook useEffect has missing dependencies: 'markers', 'mode', 'onPointsChange', and 'polygon'. Either include them or remove the dependency array. If 'onPointsChange' changes too often, find the parent component that defines it and wrap that definition in useCallback react-hooks/exhaustive-deps 130:30 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 148:6 warning React Hook useEffect has a missing dependency: 'onPointsChange'. Either include it or remove the dependency array. If 'onPointsChange' changes too often, find the parent component that defines it and wrap that definition in useCallback react-hooks/exhaustive-deps D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\Navbar.tsx 3:10 warning 'Book' is defined but never used @typescript-eslint/no-unused-vars 3:22 warning 'Sunset' is defined but never used @typescript-eslint/no-unused-vars 3:30 warning 'Trees' is defined but never used @typescript-eslint/no-unused-vars 3:37 warning 'Zap' is defined but never used @typescript-eslint/no-unused-vars 4:18 warning 'Map' is defined but never used @typescript-eslint/no-unused-vars 4:23 warning 'Clipboard' is defined but never used @typescript-eslint/no-unused-vars 4:34 warning 'Package' is defined but never used @typescript-eslint/no-unused-vars 4:43 warning 'Brain' is defined but never used @typescript-eslint/no-unused-vars 4:50 warning 'Droplets' is defined but never used @typescript-eslint/no-unused-vars 4:60 warning 'Settings' is defined but never used @typescript-eslint/no-unused-vars 11:10 warning 'useRef' is defined but never used @typescript-eslint/no-unused-vars 11:18 warning 'useEffect' is defined but never used @typescript-eslint/no-unused-vars 11:29 warning 'useState' is defined but never used @typescript-eslint/no-unused-vars 23:3 warning 'NavigationMenuContent' is defined but never used @typescript-eslint/no-unused-vars 27:3 warning 'NavigationMenuTrigger' is defined but never used @typescript-eslint/no-unused-vars 69:11 warning 'auth' is assigned a value but never used @typescript-eslint/no-unused-vars 86:23 warning 'updateHeight' is assigned a value but never used @typescript-eslint/no-unused-vars 170:15 warning Using could result in slower LCP and higher bandwidth. Consider using from next/image or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element 186:23 warning Using could result in slower LCP and higher bandwidth. Consider using from next/image or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element 221:89 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 282:95 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\SideBar\SideBarOld.tsx 205:7 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\SideBar\SideBarOld.tsx:205:7 203 | useEffect(() => { 204 | if (pathname) { > 205 | setCurrentPath(pathname); | ^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect 206 | } 207 | }, [pathname]); 208 | react-hooks/set-state-in-effect 212:7 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\SideBar\SideBarOld.tsx:212:7 210 | useEffect(() => { 211 | if (isMobile) { > 212 | setIsCollapsed(false); | ^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect 213 | } 214 | }, [isMobile]); 215 | react-hooks/set-state-in-effect D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\SideBar\components\LeftSidebar.tsx 4:10 warning 'ChevronDown' is defined but never used @typescript-eslint/no-unused-vars 4:50 warning 'Menu' is defined but never used @typescript-eslint/no-unused-vars 7:10 warning 'Badge' is defined but never used @typescript-eslint/no-unused-vars 66:5 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\SideBar\components\LeftSidebar.tsx:66:5 64 | // 当侧边栏状态改变时,折叠所有菜单 65 | useEffect(() => { > 66 | setExpandedMenus(new Set()); | ^^^^^^^^^^^^^^^^ Avoid calling setState() directly within an effect 67 | }, [isCollapsed]); 68 | 69 | return ( react-hooks/set-state-in-effect D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\SideBar\components\MainContent.tsx 4:10 warning 'ChevronLeft' is defined but never used @typescript-eslint/no-unused-vars 4:37 warning 'X' is defined but never used @typescript-eslint/no-unused-vars 5:10 warning 'cn' is defined but never used @typescript-eslint/no-unused-vars 7:31 warning 'SheetTrigger' is defined but never used @typescript-eslint/no-unused-vars 19:3 warning 'sidebarOpen' is assigned a value but never used @typescript-eslint/no-unused-vars 24:9 warning 'handleToggleSidebar' is assigned a value but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\ThemeToggle.tsx 14:5 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\ThemeToggle.tsx:14:5 12 | // 避免服务端渲染和客户端渲染不匹配 13 | useEffect(() => { > 14 | setMounted(true); | ^^^^^^^^^^ Avoid calling setState() directly within an effect 15 | }, []); 16 | 17 | const toggleTheme = () => { react-hooks/set-state-in-effect D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\components\MessageBell.tsx 4:29 warning 'X' is defined but never used @typescript-eslint/no-unused-vars 5:10 warning 'toast' is defined but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\components\auth\AuthContext.tsx 63:9 error Error: Cannot access variable before it is declared autoLoginDefaultUser is accessed before it is declared, which prevents the earlier access from updating when this value changes over time. D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\components\auth\AuthContext.tsx:63:9 61 | localStorage.removeItem('user_info'); 62 | // 如果数据无效,自动登录默认用户 > 63 | autoLoginDefaultUser(); | ^^^^^^^^^^^^^^^^^^^^ autoLoginDefaultUser accessed before it is declared 64 | } 65 | } else { 66 | // 如果没有本地存储数据,自动登录默认用户 D:\code\repotest\smart-crop-ui\crop-x-new\src\components\layouts\components\auth\AuthContext.tsx:72:3 70 | 71 | // 自动登录默认用户 > 72 | const autoLoginDefaultUser = () => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 73 | const defaultUser: User = { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 74 | id: '1', … | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 95 | }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 96 | }; | ^^^^^ autoLoginDefaultUser is declared here 97 | 98 | const login = async (username: string, password: string): Promise => { 99 | try { react-hooks/immutability D:\code\repotest\smart-crop-ui\crop-x-new\src\components\shared\BaseMap.tsx 73:23 warning 'setCoordinates' is assigned a value but never used @typescript-eslint/no-unused-vars 135:6 warning React Hook useEffect has missing dependencies: 'initialCenter', 'initialLayer', 'initialZoom', 'onMapReady', and 'provider'. Either include them or remove the dependency array. If 'onMapReady' changes too often, find the parent component that defines it and wrap that definition in useCallback react-hooks/exhaustive-deps D:\code\repotest\smart-crop-ui\crop-x-new\src\components\ui\sidebar.tsx 611:26 error Error: Cannot call impure function during render Math.random is an impure function. Calling an impure function can produce unstable results that update unpredictably when the component happens to re-render. (https://react.dev/reference/rules/components-and-hooks-must-be-pure#components-and-hooks-must-be-idempotent). D:\code\repotest\smart-crop-ui\crop-x-new\src\components\ui\sidebar.tsx:611:26 609 | // Random width between 50 to 90%. 610 | const width = React.useMemo(() => { > 611 | return ${Math.floor(Math.random() * 40) + 50}% | ^^^^^^^^^^^^^ Cannot call impure function 612 | }, []) 613 | 614 | return ( react-hooks/purity D:\code\repotest\smart-crop-ui\crop-x-new\src\hooks\useElementHeight.ts 17:5 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\hooks\useElementHeight.ts:17:5 15 | // 确保在客户端执行 16 | useEffect(() => { > 17 | setIsClient(true); | ^^^^^^^^^^^ Avoid calling setState() directly within an effect 18 | }, []); 19 | 20 | // 使用 useCallback 来避免无限循环 react-hooks/set-state-in-effect 21:39 error Compilation Skipped: Existing memoization could not be preserved React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. The inferred dependencies did not match the manually specified dependencies, which could cause the value to change more or less frequently than expected. The inferred dependency was options, but the source dependencies were [isClient, setNavigatorHeight, options.onUpdate]. Inferred less specific property than source. D:\code\repotest\smart-crop-ui\crop-x-new\src\hooks\useElementHeight.ts:21:39 19 | 20 | // 使用 useCallback 来避免无限循环 > 21 | const calculateHeight = useCallback(() => { | ^^^^^^^ > 22 | if (!elementRef.current || !isClient) return 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 23 | … | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 37 | return height; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 38 | }, [isClient, setNavigatorHeight, options.onUpdate]); | ^^^^ Could not preserve existing manual memoization 39 | 40 | // 手动更新高度的函数 41 | const updateHeight = useCallback(() => { react-hooks/preserve-manual-memoization 38:6 warning React Hook useCallback has a missing dependency: 'options'. Either include it or remove the dependency array react-hooks/exhaustive-deps D:\code\repotest\smart-crop-ui\crop-x-new\src\hooks\useViewHeight.ts 5:26 warning 'calculateMainBodyHeight' is assigned a value but never used @typescript-eslint/no-unused-vars 10:5 error Error: Calling setState synchronously within an effect can trigger cascading renders Effects are intended to synchronize state between React and external systems such as manually updating the DOM, state management libraries, or other platform APIs. In general, the body of an effect should do one or both of the following: * Update external systems with the latest state from React. * Subscribe for updates from some external system, calling setState in a callback function when external state changes. Calling setState synchronously within an effect body causes cascading renders that can hurt performance, and is not recommended. (https://react.dev/learn/you-might-not-need-an-effect). D:\code\repotest\smart-crop-ui\crop-x-new\src\hooks\useViewHeight.ts:10:5 8 | // 确保在客户端执行 9 | useEffect(() => { > 10 | setIsClient(true); | ^^^^^^^^^^^ Avoid calling setState() directly within an effect 11 | }, []); 12 | 13 | const getViewHeight = () => { react-hooks/set-state-in-effect 51:6 warning React Hook useEffect has a missing dependency: 'getViewHeight'. Either include it or remove the dependency array react-hooks/exhaustive-deps D:\code\repotest\smart-crop-ui\crop-x-new\src\lib\api\client\client.gen.ts 23:10 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 79:5 error Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 3 characters or longer @typescript-eslint/ban-ts-comment 121:24 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 147:17 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\lib\api\core\bodySerializer.gen.ts 11:37 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 11:45 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 54:45 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 54:73 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 82:45 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 82:73 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\lib\api\core\serverSentEvents.gen.ts 230:31 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\lib\gisMapEngine.ts 68:16 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 69:32 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 70:33 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 589:11 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 590:8 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 591:26 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\lib\leafletLoader.ts 96:8 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\lib\mapLoader.ts 26:43 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 113:11 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\lib\spatialDataService.ts 24:31 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 27:41 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 38:7 warning 'WGS84_B' is assigned a value but never used @typescript-eslint/no-unused-vars 39:7 warning 'WGS84_F' is assigned a value but never used @typescript-eslint/no-unused-vars 889:38 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 914:17 warning '' is assigned a value but never used @typescript-eslint/no-unused-vars D:\code\repotest\smart-crop-ui\crop-x-new\src\stores\modules\ai-model.ts 66:71 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 66:87 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\stores\modules\auth.ts 28:30 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\types\index.ts 4:34 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 37:28 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 41:32 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 49:20 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 59:43 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 346:34 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 393:13 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any 405:29 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\types\message.ts 40:30 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\src\types\system-params.ts 60:31 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any D:\code\repotest\smart-crop-ui\crop-x-new\tailwind.config.js 4:1 warning Assign object to a variable before exporting as module default import/no-anonymous-default-export