@@ -18,20 +18,24 @@ import type {
1818 StyleModuleMapType
1919} from './types' ;
2020
21- type FileTypeOptions = { |
21+ type FiletypeOptionsType = { |
2222 + syntax : string ,
23- // eslint-disable-next-line no-undef
2423 + plugins ?: $ReadOnlyArray < string >
2524| } ;
2625
27- const getFiletypeOptions = ( cssSourceFilePath : string , filetypes : { [ key : string ] : FileTypeOptions } ) : ?FileTypeOptions => {
26+ type FiletypesConfigurationType = {
27+ [ key : string ] : FiletypeOptionsType
28+ } ;
29+
30+ const getFiletypeOptions = ( cssSourceFilePath : string , filetypes : FiletypesConfigurationType ) : ?FiletypeOptionsType => {
2831 const extension = cssSourceFilePath . substr ( cssSourceFilePath . lastIndexOf ( '.' ) ) ;
2932 const filetype = filetypes ? filetypes [ extension ] : null ;
3033
3134 return filetype ;
3235} ;
3336
34- const getSyntax = ( filetypeOptions : FileTypeOptions ) : ?( Function | Object ) = > {
37+ // eslint-disable-next-line flowtype/no-weak-types
38+ const getSyntax = ( filetypeOptions : FiletypeOptionsType ) : ?( Function | Object ) = > {
3539 if ( ! filetypeOptions || ! filetypeOptions . syntax ) {
3640 return null ;
3741 }
@@ -40,8 +44,8 @@ const getSyntax = (filetypeOptions: FileTypeOptions): ?(Function|Object) => {
4044 return require ( filetypeOptions . syntax ) ;
4145} ;
4246
43- // eslint-disable-next-line no-undef
44- const getExtraPlugins = ( filetypeOptions : ?FileTypeOptions ) : $ReadOnlyArray < any > => {
47+ // eslint-disable-next-line flowtype/ no-weak-types
48+ const getExtraPlugins = ( filetypeOptions : ?FiletypeOptionsType ) : $ReadOnlyArray < * > => {
4549 if ( ! filetypeOptions || ! filetypeOptions . plugins ) {
4650 return [ ] ;
4751 }
@@ -52,7 +56,8 @@ const getExtraPlugins = (filetypeOptions: ?FileTypeOptions): $ReadOnlyArray<any>
5256 } ) ;
5357} ;
5458
55- const getTokens = ( runner , cssSourceFilePath : string , filetypeOptions : ?FileTypeOptions ) : StyleModuleMapType => {
59+ const getTokens = ( runner , cssSourceFilePath : string , filetypeOptions : ?FiletypeOptionsType ) : StyleModuleMapType => {
60+ // eslint-disable-next-line flowtype/no-weak-types
5661 const options : Object = {
5762 from : cssSourceFilePath
5863 } ;
@@ -75,8 +80,8 @@ const getTokens = (runner, cssSourceFilePath: string, filetypeOptions: ?FileType
7580} ;
7681
7782type OptionsType = { |
78- filetypes : Object ,
7983 generateScopedName ? : string ,
84+ filetypes : FiletypesConfigurationType ,
8085 context ?: string
8186| } ;
8287
0 commit comments