Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 23f20af

Browse files
committed
fix: remove loading workarounds
1 parent 2acfa43 commit 23f20af

File tree

4 files changed

+6
-26
lines changed

4 files changed

+6
-26
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@
167167
"test": "npm run babel && atom --test spec",
168168
"clean": "shx rm -rf dist",
169169
"babel": "cross-env NODE_ENV=development cross-env BABEL_KEEP_MODULES=false babel src --out-dir dist --delete-dir-on-start",
170-
"dev": "npm run clean && cross-env NODE_ENV=development cross-env BABEL_KEEP_MODULES=true rollup -c -w",
171-
"build": "npm run clean && cross-env NODE_ENV=production cross-env BABEL_KEEP_MODULES=true rollup -c ",
170+
"dev": "npm run babel && cross-env NODE_ENV=development cross-env BABEL_KEEP_MODULES=true rollup -c -w",
171+
"build": "npm run babel && cross-env NODE_ENV=production cross-env BABEL_KEEP_MODULES=true rollup -c ",
172172
"prepare": "npm run build"
173173
},
174174
"dependencies": {

spec/migrate-config-options-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use babel'
22

3-
import migrateConfigOptions from '../dist/migrate-config-options'
3+
import { migrateConfigOptions } from '../dist/migrate-config-options'
44
import makeSpy from './make-spy'
55

66
describe('migrateConfigOptions()', () => {

src/main.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
// eslint-disable-next-line import/no-extraneous-dependencies, import/extensions
22
import { CompositeDisposable } from 'atom'
33
import { hasValidScope } from './validate/editor'
4+
import * as helpers from './helpers'
5+
import { migrateConfigOptions } from './migrate-config-options'
46

57
// Internal variables
68
const 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-
2010
const 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'

src/migrate-config-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ function migrateConfigOptions(migrations = activeMigrations) {
101101
}
102102
}
103103

104-
module.exports = migrateConfigOptions
104+
exports.migrateConfigOptions = migrateConfigOptions

0 commit comments

Comments
 (0)