import path from 'path' ; import { Rule } from 'eslint' ; type RulesInput = string [ ] ; type RulesOutput = { [ key ] : Rule . RuleModule ; } ; const exportRules = ( rulesInput ) : RulesOutput => { return rulesInput . reduce ( ( rulesOutput , rule ) => ( { ... rulesOutput , [ rule ] : require ( `./${ path . join ( './rules/' , rule ) }` ) . default , } ) , { } as RulesOutput ) ; } ; module . exports = { rules : exportRules ( [ 'best-practices/no-discouraged-words' ] ) , } ;