@@ -34,61 +34,60 @@ const ignorePredicate = (skipNames, value) => {
34
34
) ;
35
35
} ;
36
36
37
- module . exports = stylelint . createPlugin ( ruleName , function ( {
38
- cssDefinitions = [ ] ,
39
- ignoreProperties,
40
- ignoreValues,
41
- } ) {
42
- return function ( postcssRoot , postcssResult ) {
43
- if ( cssDefinitions . length === 0 ) {
44
- return ;
45
- }
46
- postcssRoot . walkDecls ( function ( decl ) {
47
- // ignore properties from ignore list
48
- if (
49
- ignorePredicate ( ignoreProperties , decl . prop ) ||
50
- ignorePredicate ( ignoreValues , decl . value )
51
- ) {
37
+ module . exports = stylelint . createPlugin (
38
+ ruleName ,
39
+ function ( { cssDefinitions = [ ] , ignoreProperties, ignoreValues } ) {
40
+ return function ( postcssRoot , postcssResult ) {
41
+ if ( cssDefinitions . length === 0 ) {
52
42
return ;
53
43
}
54
- let ast ;
55
-
56
- try {
57
- ast = csstree . parse ( decl . value , {
58
- context : "value" ,
59
- } ) ;
60
- } catch ( e ) {
61
- return stylelint . utils . report ( {
62
- message : messages . parseError ( decl . value ) ,
63
- node : decl ,
64
- result : postcssResult ,
65
- ruleName : ruleName ,
66
- } ) ;
67
- }
68
- cssDefinitions . forEach ( ( cssDefinition ) => {
69
- const fragments = csstree . lexer . findValueFragments (
70
- decl . prop ,
71
- ast ,
72
- "Type" ,
73
- cssDefinition
74
- ) ;
75
- if ( fragments . length ) {
76
- const message = messages . unexpectedDecl (
77
- decl . toString ( ) ,
78
- cssDefinition
79
- ) ;
44
+ postcssRoot . walkDecls ( function ( decl ) {
45
+ // ignore properties from ignore list
46
+ if (
47
+ ignorePredicate ( ignoreProperties , decl . prop ) ||
48
+ ignorePredicate ( ignoreValues , decl . value )
49
+ ) {
50
+ return ;
51
+ }
52
+ let ast ;
80
53
81
- stylelint . utils . report ( {
82
- message : message ,
54
+ try {
55
+ ast = csstree . parse ( decl . value , {
56
+ context : "value" ,
57
+ } ) ;
58
+ } catch ( e ) {
59
+ return stylelint . utils . report ( {
60
+ message : messages . parseError ( decl . value ) ,
83
61
node : decl ,
84
62
result : postcssResult ,
85
63
ruleName : ruleName ,
86
64
} ) ;
87
65
}
66
+ cssDefinitions . forEach ( ( cssDefinition ) => {
67
+ const fragments = csstree . lexer . findValueFragments (
68
+ decl . prop ,
69
+ ast ,
70
+ "Type" ,
71
+ cssDefinition
72
+ ) ;
73
+ if ( fragments . length ) {
74
+ const message = messages . unexpectedDecl (
75
+ decl . toString ( ) ,
76
+ cssDefinition
77
+ ) ;
78
+
79
+ stylelint . utils . report ( {
80
+ message : message ,
81
+ node : decl ,
82
+ result : postcssResult ,
83
+ ruleName : ruleName ,
84
+ } ) ;
85
+ }
86
+ } ) ;
88
87
} ) ;
89
- } ) ;
90
- } ;
91
- } ) ;
88
+ } ;
89
+ }
90
+ ) ;
92
91
93
92
module . exports . ruleName = ruleName ;
94
93
module . exports . messages = messages ;
0 commit comments