import * as deepmerge from 'deepmerge' ; import { CLIEngine } from 'eslint' ; import { TemplateLintConfig } from '../types/ember-template-lint' ; param { ( TemplateLintConfig | CLIEngine . Options ) } config param { Record < string , any > } taskLintConfig returns { * } export function mergeLintConfig ( config , taskLintConfig ) { let combinedConfigs = deepmerge ( config , taskLintConfig ) ; if ( combinedConfigs . rules ) { let rules = combinedConfigs . rules ; let ruleIds = Object . keys ( rules ) ; ruleIds . forEach ( ( ruleId ) => { let ruleConfig = rules [ ruleId ] ; let firstTuplePart = '' ; let secondTuplePart = { } ; if ( Array . isArray ( ruleConfig ) && ruleConfig . length > 2 ) { for ( const [ i , element ] of ruleConfig . entries ( ) ) { if ( i % 2 === 0 ) { firstTuplePart = element ; } else { secondTuplePart = Object . assign ( secondTuplePart , element ) ; } } rules [ ruleId ] = [ firstTuplePart , secondTuplePart ] ; } } ) ; } return combinedConfigs ; }