@@ -196,10 +196,13 @@ export class BaseConfigFactory {
196196 * Note: TypeScript React support (.tsx) is planned for the next iteration.
197197 */
198198 private createReactConfigArray ( ) : Linter . Config [ ] {
199- // Apply React rules to all JavaScript files
199+ // Apply React rules to all JavaScript and TypeScript files
200+
200201 const jsExtensions = this . engineConfig . file_extensions . javascript ;
202+ const tsExtensions = this . engineConfig . file_extensions . typescript ;
203+ const reactExtensions = [ ...new Set ( [ ...jsExtensions , ...tsExtensions ] ) ] ;
201204
202- if ( jsExtensions . length === 0 ) {
205+ if ( reactExtensions . length === 0 ) {
203206 return [ ] ;
204207 }
205208
@@ -208,7 +211,7 @@ export class BaseConfigFactory {
208211
209212 return [ {
210213 ...reactAllConfig ,
211- files : jsExtensions . map ( ext => `**/*${ ext } ` ) ,
214+ files : reactExtensions . map ( ext => `**/*${ ext } ` ) ,
212215 settings : {
213216 ...reactAllConfig . settings ,
214217 react : {
@@ -243,9 +246,10 @@ export class BaseConfigFactory {
243246
244247 private useReactBaseConfig ( ) : boolean {
245248 // React config is independently controlled by disable_react_base_config
246- // React rules apply to all JS files - no harm if file has no React code
249+ // React rules apply to all JS and TS files - no harm if file has no React code
247250 return ! this . engineConfig . disable_react_base_config &&
248- this . engineConfig . file_extensions . javascript . length > 0 ;
251+ ( this . engineConfig . file_extensions . javascript . length > 0 ||
252+ this . engineConfig . file_extensions . typescript . length > 0 ) ;
249253 }
250254}
251255
0 commit comments