@@ -18,20 +18,24 @@ import type {
18
18
StyleModuleMapType
19
19
} from './types' ;
20
20
21
- type FileTypeOptions = { |
21
+ type FiletypeOptionsType = { |
22
22
+ syntax : string ,
23
- // eslint-disable-next-line no-undef
24
23
+ plugins ?: $ReadOnlyArray < string >
25
24
| } ;
26
25
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 => {
28
31
const extension = cssSourceFilePath . substr ( cssSourceFilePath . lastIndexOf ( '.' ) ) ;
29
32
const filetype = filetypes ? filetypes [ extension ] : null ;
30
33
31
34
return filetype ;
32
35
} ;
33
36
34
- const getSyntax = ( filetypeOptions : FileTypeOptions ) : ?( Function | Object ) = > {
37
+ // eslint-disable-next-line flowtype/no-weak-types
38
+ const getSyntax = ( filetypeOptions : FiletypeOptionsType ) : ?( Function | Object ) = > {
35
39
if ( ! filetypeOptions || ! filetypeOptions . syntax ) {
36
40
return null ;
37
41
}
@@ -40,8 +44,8 @@ const getSyntax = (filetypeOptions: FileTypeOptions): ?(Function|Object) => {
40
44
return require ( filetypeOptions . syntax ) ;
41
45
} ;
42
46
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 < * > => {
45
49
if ( ! filetypeOptions || ! filetypeOptions . plugins ) {
46
50
return [ ] ;
47
51
}
@@ -52,7 +56,8 @@ const getExtraPlugins = (filetypeOptions: ?FileTypeOptions): $ReadOnlyArray<any>
52
56
} ) ;
53
57
} ;
54
58
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
56
61
const options : Object = {
57
62
from : cssSourceFilePath
58
63
} ;
@@ -75,8 +80,8 @@ const getTokens = (runner, cssSourceFilePath: string, filetypeOptions: ?FileType
75
80
} ;
76
81
77
82
type OptionsType = { |
78
- filetypes : Object ,
79
83
generateScopedName ? : string ,
84
+ filetypes : FiletypesConfigurationType ,
80
85
context ?: string
81
86
| } ;
82
87
0 commit comments