import type { Rule } from 'eslint' ; export const getGlobals = < T extends Record < string , unknown > | string [ ] , G extends Record < string , boolean > , R extends G = G & Record < T extends Array < infer R > ? R : keyof T , false > > ( sources , initialGlobals = { } as G ) : R => ( Array . isArray ( sources ) ? ( sources as string [ ] ) : Object . keys ( sources ) ) . reduce ( ( globals , source ) => Object . assign ( globals , { [ source ] : false , } ) , initialGlobals as R ) ; const PRIVATE_API_VERSION = 8 ; export const getBuiltinRule = ( ruleId ) => { const { version : eslintVersion } = require ( 'eslint/package.json' ) as { version : string ; } ; const majorVersion = Number . parseInt ( eslintVersion . split ( '.' ) [ 0 ] , 10 ) ; if ( majorVersion < PRIVATE_API_VERSION ) { return require ( `eslint/lib/rules/${ ruleId }` ) as Rule . RuleModule ; } return ( require ( 'eslint/use-at-your-own-risk' ) as typeof import ( 'eslint/use-at-your-own-risk' ) ) . builtinRules . get ( ruleId ) ; } ;