11// eslint-disable-next-line import/no-extraneous-dependencies, import/extensions
22import { CompositeDisposable } from 'atom'
33import { hasValidScope } from './validate/editor'
4+ import * as helpers from './helpers'
5+ import { migrateConfigOptions } from './migrate-config-options'
46
57// Internal variables
68const idleCallbacks = new Set ( )
79
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-
2010const makeIdleCallback = ( work ) => {
2111 let callbackId
2212 const callBack = ( ) => {
@@ -31,15 +21,12 @@ const scheduleIdleTasks = () => {
3121 const linterEslintInstallPeerPackages = ( ) => {
3222 require ( 'atom-package-deps' ) . install ( 'linter-eslint' )
3323 }
34- const linterEslintLoadDependencies = loadDeps
3524 const linterEslintStartWorker = ( ) => {
36- loadDeps ( )
3725 helpers . startWorker ( )
3826 }
3927
4028 if ( ! atom . inSpecMode ( ) ) {
4129 makeIdleCallback ( linterEslintInstallPeerPackages )
42- makeIdleCallback ( linterEslintLoadDependencies )
4330 makeIdleCallback ( linterEslintStartWorker )
4431 }
4532}
@@ -71,9 +58,6 @@ module.exports = {
7158 activate ( ) {
7259 this . subscriptions = new CompositeDisposable ( )
7360
74- if ( ! migrateConfigOptions ) {
75- migrateConfigOptions = require ( './migrate-config-options' )
76- }
7761 migrateConfigOptions ( )
7862
7963 const embeddedScope = 'source.js.embedded.html'
@@ -115,7 +99,6 @@ module.exports = {
11599
116100 this . subscriptions . add ( atom . commands . add ( 'atom-text-editor' , {
117101 'linter-eslint:debug' : async ( ) => {
118- loadDeps ( )
119102 const debugString = await helpers . generateDebugString ( )
120103 const notificationOptions = { detail : debugString , dismissable : true }
121104 atom . notifications . addInfo ( 'linter-eslint debugging information' , notificationOptions )
@@ -203,7 +186,6 @@ module.exports = {
203186 return null
204187 }
205188
206- loadDeps ( )
207189
208190 if ( filePath . includes ( '://' ) ) {
209191 // If the path is a URL (Nuclide remote file) return a message
@@ -262,8 +244,6 @@ module.exports = {
262244 return
263245 }
264246
265- loadDeps ( )
266-
267247 if ( textEditor . isModified ( ) ) {
268248 // Abort for invalid or unsaved text editors
269249 const message = 'Linter-ESLint: Please save before fixing'
0 commit comments