@@ -56,17 +56,12 @@ export class Config implements IConfig {
5656 }
5757
5858 private setVariables ( config ) {
59- // Boolean
60-
6159 this . jsxExt = config . jsxExt ?? this . jsxExt ;
6260 this . newJsx = config . newJsx ?? this . newJsx ;
6361 this . typescript = config . typescript ?? this . typescript ;
6462 this . wrapFolder = config . wrapFolder ?? this . wrapFolder ;
65- this . cssModules = config . cssModules ?? this . cssModules ;
6663 this . arrowFunction = config . arrowFunction ?? this . arrowFunction ;
6764
68- // Enum
69-
7065 this . fileNameCase = config . fileNameCase ?? this . fileNameCase ;
7166
7267 if ( config . styles ) {
@@ -108,16 +103,31 @@ export class Config implements IConfig {
108103 if ( ! this . path || config . path ) {
109104 this . path = path . resolve ( APP_ROOT , config . path ?? DEFAULT_CONFIG . path ) ;
110105 }
106+
107+ if ( this . styles !== 'styled-components' ) {
108+ this . cssModules = config . cssModules ?? this . cssModules ;
109+ } else if ( config . cssModules ) {
110+ Logger . warn (
111+ chalk =>
112+ `CSS Modules are incompatible with stylesheet format - ${ chalk . white (
113+ 'styled-components'
114+ ) } `
115+ ) ;
116+ }
111117 }
112118
113119 private setFilesExtension ( ) {
114- const styleExt = this . styles . toLowerCase ( ) ;
120+ const component = this . typescript ? 'tsx' : `j${ this . jsxExt ? 'sx' : 's' } ` ;
121+ const script = `${ this . typescript ? 't' : 'j' } s` ;
122+
123+ let style = this . styles . toLowerCase ( ) ;
124+ if ( style === 'styled-components' ) {
125+ style = script ;
126+ } else if ( style === 'stylus' ) {
127+ style = 'styl' ;
128+ }
115129
116- this . ext = {
117- component : this . typescript ? 'tsx' : `j${ this . jsxExt ? 'sx' : 's' } ` ,
118- script : `${ this . typescript ? 't' : 'j' } s` ,
119- style : styleExt === 'stylus' ? 'styl' : styleExt ,
120- } ;
130+ this . ext = { component, script, style } ;
121131 }
122132
123133 private setPrefixes ( ) {
0 commit comments