1
1
// eslint-disable-next-line import/no-extraneous-dependencies, import/extensions
2
2
import { CompositeDisposable } from 'atom'
3
3
import { hasValidScope } from './validate/editor'
4
+ import * as helpers from './helpers'
5
+ import { migrateConfigOptions } from './migrate-config-options'
4
6
5
7
// Internal variables
6
8
const idleCallbacks = new Set ( )
7
9
8
- // Dependencies
9
- // NOTE: We are not directly requiring these in order to reduce the time it
10
- // takes to require this file as that causes delays in Atom loading this package
11
- let helpers
12
- let migrateConfigOptions
13
-
14
- const loadDeps = ( ) => {
15
- if ( ! helpers ) {
16
- helpers = require ( './helpers' )
17
- }
18
- }
19
-
20
10
const makeIdleCallback = ( work ) => {
21
11
let callbackId
22
12
const callBack = ( ) => {
@@ -31,15 +21,12 @@ const scheduleIdleTasks = () => {
31
21
const linterEslintInstallPeerPackages = ( ) => {
32
22
require ( 'atom-package-deps' ) . install ( 'linter-eslint' )
33
23
}
34
- const linterEslintLoadDependencies = loadDeps
35
24
const linterEslintStartWorker = ( ) => {
36
- loadDeps ( )
37
25
helpers . startWorker ( )
38
26
}
39
27
40
28
if ( ! atom . inSpecMode ( ) ) {
41
29
makeIdleCallback ( linterEslintInstallPeerPackages )
42
- makeIdleCallback ( linterEslintLoadDependencies )
43
30
makeIdleCallback ( linterEslintStartWorker )
44
31
}
45
32
}
@@ -71,9 +58,6 @@ module.exports = {
71
58
activate ( ) {
72
59
this . subscriptions = new CompositeDisposable ( )
73
60
74
- if ( ! migrateConfigOptions ) {
75
- migrateConfigOptions = require ( './migrate-config-options' )
76
- }
77
61
migrateConfigOptions ( )
78
62
79
63
const embeddedScope = 'source.js.embedded.html'
@@ -115,7 +99,6 @@ module.exports = {
115
99
116
100
this . subscriptions . add ( atom . commands . add ( 'atom-text-editor' , {
117
101
'linter-eslint:debug' : async ( ) => {
118
- loadDeps ( )
119
102
const debugString = await helpers . generateDebugString ( )
120
103
const notificationOptions = { detail : debugString , dismissable : true }
121
104
atom . notifications . addInfo ( 'linter-eslint debugging information' , notificationOptions )
@@ -203,7 +186,6 @@ module.exports = {
203
186
return null
204
187
}
205
188
206
- loadDeps ( )
207
189
208
190
if ( filePath . includes ( '://' ) ) {
209
191
// If the path is a URL (Nuclide remote file) return a message
@@ -262,8 +244,6 @@ module.exports = {
262
244
return
263
245
}
264
246
265
- loadDeps ( )
266
-
267
247
if ( textEditor . isModified ( ) ) {
268
248
// Abort for invalid or unsaved text editors
269
249
const message = 'Linter-ESLint: Please save before fixing'
0 commit comments