@@ -68,6 +68,8 @@ exports.default = {
68
68
}
69
69
} ,
70
70
activate : function ( ) {
71
+ var _this = this ;
72
+
71
73
require ( 'atom-package-deps' ) . install ( ) ;
72
74
73
75
this . subscriptions = new _atom . CompositeDisposable ( ) ;
@@ -76,17 +78,17 @@ exports.default = {
76
78
this . scopes = [ 'source.js' , 'source.jsx' , 'source.js.jsx' , 'source.babel' , 'source.js-semantic' ] ;
77
79
78
80
const embeddedScope = 'source.js.embedded.html' ;
79
- this . subscriptions . add ( atom . config . observe ( 'linter-eslint.lintHtmlFiles' , lintHtmlFiles => {
81
+ this . subscriptions . add ( atom . config . observe ( 'linter-eslint.lintHtmlFiles' , function ( lintHtmlFiles ) {
80
82
if ( lintHtmlFiles ) {
81
- this . scopes . push ( embeddedScope ) ;
83
+ _this . scopes . push ( embeddedScope ) ;
82
84
} else {
83
- if ( this . scopes . indexOf ( embeddedScope ) !== - 1 ) {
84
- this . scopes . splice ( this . scopes . indexOf ( embeddedScope ) , 1 ) ;
85
+ if ( _this . scopes . indexOf ( embeddedScope ) !== - 1 ) {
86
+ _this . scopes . splice ( _this . scopes . indexOf ( embeddedScope ) , 1 ) ;
85
87
}
86
88
}
87
89
} ) ) ;
88
90
this . subscriptions . add ( atom . commands . add ( 'atom-text-editor' , {
89
- 'linter-eslint:fix-file' : ( ) => {
91
+ 'linter-eslint:fix-file' : function ( ) {
90
92
const textEditor = atom . workspace . getActiveTextEditor ( ) ;
91
93
const filePath = textEditor . getPath ( ) ;
92
94
const fileDir = _path2 . default . dirname ( filePath ) ;
@@ -97,13 +99,13 @@ exports.default = {
97
99
return ;
98
100
}
99
101
100
- if ( this . worker === null ) {
102
+ if ( _this . worker === null ) {
101
103
// Abort if worker is not yet ready
102
104
atom . notifications . addError ( 'Linter-ESLint: Not ready, please try again' ) ;
103
105
return ;
104
106
}
105
107
106
- this . worker . request ( 'FIX' , {
108
+ _this . worker . request ( 'FIX' , {
107
109
fileDir : fileDir ,
108
110
filePath : filePath ,
109
111
global : atom . config . get ( 'linter-eslint.useGlobalEslint' ) ,
@@ -121,18 +123,18 @@ exports.default = {
121
123
// process while atom is starting up, it can increase startup
122
124
// time by several seconds, But if we do this after 5 seconds,
123
125
// we barely feel a thing.
124
- const initializeWorker = ( ) => {
125
- if ( this . active ) {
126
+ const initializeWorker = function ( ) {
127
+ if ( _this . active ) {
126
128
var _spawnWorker = ( 0 , _helpers . spawnWorker ) ( ) ;
127
129
128
130
const child = _spawnWorker . child ;
129
131
const worker = _spawnWorker . worker ;
130
132
const subscription = _spawnWorker . subscription ;
131
133
132
- this . worker = worker ;
133
- this . subscriptions . add ( subscription ) ;
134
- child . on ( 'exit-linter' , shouldLive => {
135
- this . worker = null ;
134
+ _this . worker = worker ;
135
+ _this . subscriptions . add ( subscription ) ;
136
+ child . on ( 'exit-linter' , function ( shouldLive ) {
137
+ _this . worker = null ;
136
138
// Respawn if it crashed. See atom/electron#3446
137
139
if ( shouldLive ) {
138
140
initializeWorker ( ) ;
@@ -147,13 +149,15 @@ exports.default = {
147
149
this . subscriptions . dispose ( ) ;
148
150
} ,
149
151
provideLinter : function ( ) {
152
+ var _this2 = this ;
153
+
150
154
const Helpers = require ( 'atom-linter' ) ;
151
155
return {
152
156
name : 'ESLint' ,
153
157
grammarScopes : this . scopes ,
154
158
scope : 'file' ,
155
159
lintOnFly : true ,
156
- lint : textEditor => {
160
+ lint : function ( textEditor ) {
157
161
const text = textEditor . getText ( ) ;
158
162
if ( text . length === 0 ) {
159
163
return Promise . resolve ( [ ] ) ;
@@ -162,7 +166,7 @@ exports.default = {
162
166
const fileDir = _path2 . default . dirname ( filePath ) ;
163
167
const showRule = atom . config . get ( 'linter-eslint.showRuleIdInMessage' ) ;
164
168
165
- if ( this . worker === null ) {
169
+ if ( _this2 . worker === null ) {
166
170
return Promise . resolve ( [ {
167
171
filePath : filePath ,
168
172
type : 'Info' ,
@@ -171,7 +175,7 @@ exports.default = {
171
175
} ] ) ;
172
176
}
173
177
174
- return this . worker . request ( 'JOB' , {
178
+ return _this2 . worker . request ( 'JOB' , {
175
179
fileDir : fileDir ,
176
180
filePath : filePath ,
177
181
contents : text ,
0 commit comments