@@ -150,7 +150,11 @@ function ScriptEditor() {
150150 const [ currentScript , setCurrentScript ] = useState < Script > ( ) ;
151151 const [ selectSciptButtonAndTab , setSelectSciptButtonAndTab ] =
152152 useState < string > ( "" ) ;
153- const [ rightOperationTab , setRightOperationTab ] = useState ( ) ;
153+ const [ rightOperationTab , setRightOperationTab ] = useState < {
154+ key : string ;
155+ uuid : string ;
156+ selectSciptButtonAndTab : string ;
157+ } > ( ) ;
154158 const setShow = ( key : visibleItem , show : boolean ) => {
155159 Object . keys ( visible ) . forEach ( ( k ) => {
156160 visible [ k ] = false ;
@@ -374,7 +378,7 @@ function ScriptEditor() {
374378 // 对tab点击右键进行的操作
375379 useEffect ( ( ) => {
376380 let newEditors = [ ] ;
377- let selectEditorIndex ;
381+ let selectEditorIndex : number = 0 ;
378382 // 1 关闭当前, 2关闭其它, 3关闭左侧, 4关闭右侧
379383 if ( rightOperationTab ) {
380384 // eslint-disable-next-line default-case
@@ -414,31 +418,29 @@ function ScriptEditor() {
414418 }
415419 setEditors ( [ ...newEditors ] ) ;
416420 break ;
417- // eslint-disable-next-line no-fallthrough
418421 case "2" :
419- // eslint-disable-next-line no-case-declarations, no-redeclare
420422 newEditors = editors . filter (
421423 ( item ) => item . script . uuid === rightOperationTab . uuid
422424 ) ;
423425 setSelectSciptButtonAndTab ( rightOperationTab . uuid ) ;
424426 setEditors ( [ ...newEditors ] ) ;
425427 break ;
426428 case "3" :
427- // eslint-disable-next-line array-callback-return
428429 editors . map ( ( item , index ) => {
429430 if ( item . script . uuid === rightOperationTab . uuid ) {
430431 selectEditorIndex = index ;
431432 }
433+ return null ;
432434 } ) ;
433435 newEditors = editors . splice ( selectEditorIndex ) ;
434436 setEditors ( [ ...newEditors ] ) ;
435437 break ;
436438 case "4" :
437- // eslint-disable-next-line array-callback-return
438439 editors . map ( ( item , index ) => {
439440 if ( item . script . uuid === rightOperationTab . uuid ) {
440441 selectEditorIndex = index ;
441442 }
443+ return null ;
442444 } ) ;
443445 newEditors = editors . splice ( 0 , selectEditorIndex + 1 ) ;
444446 setEditors ( [ ...newEditors ] ) ;
0 commit comments