66 */
77
88import MonacoEditor , { loader , type Monaco } from '@monaco-editor/react' ;
9- import { parseConfigPragmaForTests , parsePluginOptions } from 'babel-plugin-react-compiler' ;
9+ import {
10+ parseConfigPragmaForTests ,
11+ parsePluginOptions ,
12+ } from 'babel-plugin-react-compiler' ;
1013import type { editor } from 'monaco-editor' ;
1114import * as monaco from 'monaco-editor' ;
1215import { useState , useMemo } from 'react' ;
@@ -54,15 +57,22 @@ function isEqual(a: any, b: any): boolean {
5457 */
5558function getOverriddenValues ( current : any , defaults : any ) : Record < string , any > {
5659 if ( isEqual ( current , defaults ) ) return { } ;
57- if ( current && defaults &&
58- typeof current === 'object' && typeof defaults === 'object' &&
59- ! Array . isArray ( current ) && ! Array . isArray ( defaults ) ) {
60-
60+ if (
61+ current &&
62+ defaults &&
63+ typeof current === 'object' &&
64+ typeof defaults === 'object' &&
65+ ! Array . isArray ( current ) &&
66+ ! Array . isArray ( defaults )
67+ ) {
6168 const overrides : Record < string , any > = { } ;
6269
6370 for ( const key in current ) {
6471 const nested = getOverriddenValues ( current [ key ] , defaults [ key ] ) ;
65- if ( Object . keys ( nested ) . length > 0 || ! isEqual ( current [ key ] , defaults [ key ] ) ) {
72+ if (
73+ Object . keys ( nested ) . length > 0 ||
74+ ! isEqual ( current [ key ] , defaults [ key ] )
75+ ) {
6676 overrides [ key ] = Object . keys ( nested ) . length > 0 ? nested : current [ key ] ;
6777 }
6878 }
@@ -88,17 +98,21 @@ function formatConfigAsJavaScript(config: any): string {
8898 if ( value . length === 0 ) {
8999 return '[]' ;
90100 }
91- const items = value . map ( item => `${ spaces } ${ formatValue ( item , indent + 1 ) } ` ) . join ( ',\n' ) ;
101+ const items = value
102+ . map ( item => `${ spaces } ${ formatValue ( item , indent + 1 ) } ` )
103+ . join ( ',\n' ) ;
92104 return `[\n${ items } \n${ spaces } ]` ;
93105 } else if ( typeof value === 'object' && value !== null ) {
94106 const keys = Object . keys ( value ) ;
95107 if ( keys . length === 0 ) {
96108 return '{}' ;
97109 }
98- const items = keys . map ( key => {
99- const formattedValue = formatValue ( value [ key ] , indent + 1 ) ;
100- return `${ spaces } ${ key } : ${ formattedValue } ` ;
101- } ) . join ( ',\n' ) ;
110+ const items = keys
111+ . map ( key => {
112+ const formattedValue = formatValue ( value [ key ] , indent + 1 ) ;
113+ return `${ spaces } ${ key } : ${ formattedValue } ` ;
114+ } )
115+ . join ( ',\n' ) ;
102116 return `{\n${ items } \n${ spaces } }` ;
103117 } else {
104118 return String ( value ) ;
@@ -110,7 +124,7 @@ function formatConfigAsJavaScript(config: any): string {
110124}
111125
112126export default function ConfigEditor ( ) : JSX . Element {
113- const [ monaco , setMonaco ] = useState < Monaco | null > ( null ) ;
127+ const [ , setMonaco ] = useState < Monaco | null > ( null ) ;
114128 const store = useStore ( ) ;
115129
116130 // Parse current config from source pragma and show only overridden values
@@ -125,7 +139,7 @@ export default function ConfigEditor(): JSX.Element {
125139 const overrides = getOverriddenValues ( parsedConfig , DEFAULT_CONFIG ) ;
126140
127141 return overrides ;
128- } catch ( error ) {
142+ } catch ( _ ) {
129143 // If parsing fails, return empty object (no overrides)
130144 return { } ;
131145 }
0 commit comments