1+ /* eslint-disable @typescript-eslint/no-unsafe-return */
2+ /* eslint-disable @typescript-eslint/no-explicit-any */
3+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
4+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
16/**
27 * Loads config values from
38 * - a settings file
@@ -158,7 +163,6 @@ export const init = async () => {
158163 urlParams . forEach ( ( value , key ) => {
159164 // Create empty objects for full path (if the key contains ".") and set
160165 // the value at the end.
161- // eslint-disable-next-line @typescript-eslint/no-explicit-any
162166 let obj : { [ k : string ] : any ; } = rawUrlSettings ;
163167 if ( key . startsWith ( "opencast." ) || key === "allowedCallbackPrefixes" ) {
164168 return ;
@@ -207,7 +211,7 @@ const loadContextSettings = async () => {
207211 // Construct path to settings file. If the `VITE_APP_SETTINGS_PATH` is
208212 // given and starts with "/", it is interpreted as absolute path from the
209213 // server root.
210- const settingsPath = import . meta. env . VITE_APP_SETTINGS_PATH || CONTEXT_SETTINGS_FILE ;
214+ const settingsPath : string = import . meta. env . VITE_APP_SETTINGS_PATH || CONTEXT_SETTINGS_FILE ;
211215 const base = settingsPath . startsWith ( "/" ) ? "" : basepath ;
212216 const url = new URL ( base . concat ( settingsPath ) , window . location . origin ) ;
213217 let response ;
@@ -239,7 +243,7 @@ const loadContextSettings = async () => {
239243 return parse ( await response . text ( ) ) ;
240244 } catch ( e ) {
241245 console . error ( `Could not parse "${ settingsPath } " as TOML: ` , e ) ;
242- throw new SyntaxError ( `Could not parse "${ settingsPath } " as TOML: ${ e } ` ) ;
246+ throw new SyntaxError ( `Could not parse "${ settingsPath } " as TOML: ${ String ( e ) } ` ) ;
243247 }
244248
245249} ;
@@ -251,11 +255,9 @@ const loadContextSettings = async () => {
251255 * `srcDescription` is just a string for error messages specifying where `obj`
252256 * comes from.
253257 * */
254- // eslint-disable-next-line @typescript-eslint/no-explicit-any
255258const validate = ( obj : Record < string , any > | null , allowParse : boolean , src : string , sourceDescription : string ) => {
256259 // Validates `obj` with `schema`. `path` is the current path used for error
257260 // messages.
258- // eslint-disable-next-line @typescript-eslint/no-explicit-any
259261 const validate = ( schema : any , obj : Record < string , any > | null , path : string ) => {
260262 if ( typeof schema === "function" ) {
261263 return validateValue ( schema , obj , path ) ;
@@ -267,9 +269,7 @@ const validate = (obj: Record<string, any> | null, allowParse: boolean, src: str
267269 // Validate a settings value with a validation function. Returns the final
268270 // value of the setting or `null` if it should be ignored.
269271 const validateValue = (
270- // eslint-disable-next-line @typescript-eslint/no-explicit-any
271272 validation : ( arg0 : any , arg1 : boolean , arg2 : string ) => any ,
272- // eslint-disable-next-line @typescript-eslint/no-explicit-any
273273 value : Record < string , any > | null ,
274274 path : string ,
275275 ) => {
@@ -279,19 +279,17 @@ const validate = (obj: Record<string, any> | null, allowParse: boolean, src: str
279279 } catch ( e ) {
280280 console . warn (
281281 `Validation of setting "${ path } " (${ sourceDescription } ) with value "${ JSON . stringify ( value ) } " failed: `
282- + `${ e } . Ignoring.` ,
282+ + `${ String ( e ) } . Ignoring.` ,
283283 ) ;
284284 return null ;
285285 }
286286 } ;
287287
288288 // Validate a settings object/namespace. `schema` and `obj` need to be
289289 // objects.
290- // eslint-disable-next-line @typescript-eslint/no-explicit-any
291290 const validateObj = ( schema : any , obj : Record < string , any > | null , path : string ) => {
292291 // We iterate through all keys of the given settings object, checking if
293292 // each key is valid and recursively validating the value of that key.
294- // eslint-disable-next-line @typescript-eslint/no-explicit-any
295293 const out : { [ k : string ] : any ; } = { } ;
296294 for ( const key in obj ) {
297295 const newPath = path ? `${ path } .${ key } ` : key ;
@@ -319,13 +317,11 @@ const validate = (obj: Record<string, any> | null, allowParse: boolean, src: str
319317
320318// Validation functions for different types.
321319const types = {
322- // eslint-disable-next-line @typescript-eslint/no-explicit-any
323320 "string" : ( v : string , _allowParse : any ) => {
324321 if ( typeof v !== "string" ) {
325322 throw new Error ( "is not a string, but should be" ) ;
326323 }
327324 } ,
328- // eslint-disable-next-line @typescript-eslint/no-explicit-any
329325 "boolean" : ( v : string , allowParse : any ) => {
330326 if ( typeof v === "boolean" ) {
331327 return ;
@@ -343,7 +339,6 @@ const types = {
343339 throw new Error ( "is not a boolean" ) ;
344340 }
345341 } ,
346- // eslint-disable-next-line @typescript-eslint/no-explicit-any
347342 "array" : ( v : string | [ ] , _allowParse : any ) => {
348343 if ( ! Array . isArray ( v ) ) {
349344 throw new Error ( "is not an array, but should be" ) ;
@@ -355,7 +350,6 @@ const types = {
355350 }
356351 }
357352 } ,
358- // eslint-disable-next-line @typescript-eslint/no-explicit-any
359353 "map" : ( v : { [ k : string ] : string } , _allowParse : any ) => {
360354 for ( const key in v ) {
361355 if ( typeof key !== "string" ) {
@@ -366,7 +360,6 @@ const types = {
366360 }
367361 }
368362 } ,
369- // eslint-disable-next-line @typescript-eslint/no-explicit-any
370363 "objectsWithinObjects" : ( v : any , _allowParse : any ) => {
371364 for ( const catalogName in v ) {
372365 if ( typeof catalogName !== "string" ) {
@@ -443,5 +436,4 @@ const merge = (a: iSettings, b: iSettings) => {
443436 return deepmerge ( a , b , { arrayMerge } ) ;
444437} ;
445438merge . all = ( array : object [ ] ) => deepmerge . all ( array , { arrayMerge } ) ;
446- // eslint-disable-next-line @typescript-eslint/no-explicit-any
447439const arrayMerge = ( _destinationArray : any , sourceArray : any , _options : any ) => sourceArray ;
0 commit comments