@@ -93,11 +93,8 @@ Validate an XO config array for legacy ESLint config properties that are not sup
9393@param xoConfig - The flat XO config to validate.
9494*/
9595export const validateXoConfig = ( xoConfig : XoConfigItem [ ] ) : void => {
96- for ( const [ index , config ] of xoConfig . entries ( ) ) {
97- if ( index === 0 ) {
98- continue ; // Skip internal base config prepended by XO
99- }
100-
96+ // Skip the first item (internal base config prepended by XO)
97+ for ( const config of xoConfig . values ( ) . drop ( 1 ) ) {
10198 for ( const key of Object . keys ( config ) ) {
10299 const hint = legacyPropertyHints [ key ] ;
103100 if ( hint ) {
@@ -122,18 +119,13 @@ export const preProcessXoConfig = (xoConfig: XoConfigItem[]): {config: XoConfigI
122119 const tsFilesGlob : string [ ] = [ ] ;
123120 const tsFilesIgnoresGlob : string [ ] = [ ] ;
124121
125- const processedConfig : XoConfigItem [ ] = [ ] ;
122+ // The first config item is the internal base config; push it through unmodified.
123+ const processedConfig : XoConfigItem [ ] = xoConfig [ 0 ] ? [ { ...xoConfig [ 0 ] } ] : [ ] ;
126124
127- for ( const [ idx , { ...config } ] of xoConfig . entries ( ) ) {
125+ for ( const { ...config } of xoConfig . values ( ) . drop ( 1 ) ) {
128126 const languageOptions = config . languageOptions as Linter . LanguageOptions | undefined ;
129127 const parserOptions = languageOptions ?. parserOptions as TypeScriptParserOptions | undefined ;
130128
131- // We can skip the first config item, as it is the base config item.
132- if ( idx === 0 ) {
133- processedConfig . push ( config ) ;
134- continue ;
135- }
136-
137129 // Use TS parser/plugin for JS files if the config contains TypeScript rules which are applied to JS files.
138130 // typescript-eslint rules set to "off" are ignored and not applied to JS files.
139131 if (
0 commit comments