File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -2,26 +2,24 @@ module.exports = {
2
2
meta : {
3
3
type : 'problem' ,
4
4
hasSuggestions : true ,
5
- fixable : true ,
5
+ docs : {
6
+ description : "All style components files must be imported via a single variable" ,
7
+ } ,
8
+ fixable : false ,
6
9
} ,
7
10
create ( context ) {
8
11
return {
9
12
ImportDeclaration ( node ) {
10
- const pathArray = node . source . raw . substr ( 1 , node . source . raw . length - 2 ) ;
11
- console . log ( node , node . specifiers [ 0 ] . type )
13
+ const pathArray = node . source . raw . substr ( 1 , node . source . raw . length - 2 ) . split ( '.' ) ;
12
14
13
15
if (
14
16
pathArray . includes ( 'styled' ) &&
15
17
node . specifiers [ 0 ] . type !== 'ImportNamespaceSpecifier'
16
18
) {
17
- console . log ( 'error' )
18
19
19
20
return context . report ( {
20
21
node : node ,
21
- message : 'Неправильный импорт. Измените на * as S' ,
22
- fix ( fixer ) {
23
- return [ fixer . replaceTextRange ( [ node . start , node . end ] , `import * as S from ${ node . source . raw } ` ) ]
24
- }
22
+ message : 'Incorrect import for the styled file. Replace with import in one variable * as' ,
25
23
} )
26
24
}
27
25
}
You can’t perform that action at this time.
0 commit comments