@@ -40,6 +40,8 @@ module.exports = function(context) {
40
40
var indentType = 'space' ;
41
41
var indentSize = 4 ;
42
42
43
+ var sourceCode = context . getSourceCode ( ) ;
44
+
43
45
if ( context . options . length ) {
44
46
if ( context . options [ 0 ] === 'tab' ) {
45
47
indentSize = 1 ;
@@ -66,9 +68,18 @@ module.exports = function(context) {
66
68
} ;
67
69
68
70
if ( loc ) {
69
- context . report ( node , loc , MESSAGE , msgContext ) ;
71
+ context . report ( {
72
+ node : node ,
73
+ loc : loc ,
74
+ message : MESSAGE ,
75
+ data : msgContext
76
+ } ) ;
70
77
} else {
71
- context . report ( node , MESSAGE , msgContext ) ;
78
+ context . report ( {
79
+ node : node ,
80
+ message : MESSAGE ,
81
+ data : msgContext
82
+ } ) ;
72
83
}
73
84
}
74
85
@@ -83,7 +94,7 @@ module.exports = function(context) {
83
94
byLastLine = byLastLine || false ;
84
95
excludeCommas = excludeCommas || false ;
85
96
86
- var src = context . getSource ( node , node . loc . start . column + extraColumnStart ) ;
97
+ var src = sourceCode . getText ( node , node . loc . start . column + extraColumnStart ) ;
87
98
var lines = src . split ( '\n' ) ;
88
99
if ( byLastLine ) {
89
100
src = lines [ lines . length - 1 ] ;
@@ -111,7 +122,7 @@ module.exports = function(context) {
111
122
* @return {Boolean } true if its the first in the its start line
112
123
*/
113
124
function isNodeFirstInLine ( node , byEndLocation ) {
114
- var firstToken = byEndLocation === true ? context . getLastToken ( node , 1 ) : context . getTokenBefore ( node ) ;
125
+ var firstToken = byEndLocation === true ? sourceCode . getLastToken ( node , 1 ) : sourceCode . getTokenBefore ( node ) ;
115
126
var startLine = byEndLocation === true ? node . loc . end . line : node . loc . start . line ;
116
127
var endLine = firstToken ? firstToken . loc . end . line : - 1 ;
117
128
0 commit comments