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

Commit 1d2ca4f

Browse files
committed
Handled file without name (issue #5)
Removed notification when a package update fails
1 parent 6a86dd9 commit 1d2ca4f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/worker.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ export class NpmWorker {
150150
if (pck) {
151151
if (this.isRefreshNeeded(pck)) {
152152
this.updatePackages(dependency)
153-
.catch((dependency) => atom.notifications.addWarning(`Unable to update ${dependency.name}`));
153+
/* eslint-disable no-console */
154+
.catch((dependency) => console.warn(`Unable to update ${dependency.name}`));
155+
/* eslint-enable no-console */
154156
}
155157

156158
return Promise.resolve({
@@ -213,7 +215,7 @@ export class NpmWorker {
213215
*/
214216
check(textEditor) {
215217
const filepath = textEditor.getPath();
216-
if (!this.isTargettingFile(filepath)) {
218+
if (!filepath || !this.isTargettingFile(filepath)) {
217219
return [];
218220
}
219221

@@ -261,9 +263,10 @@ export class NpmWorker {
261263
*/
262264
suggestion (textEditor, bufferPosition) {
263265
const filepath = textEditor.getPath();
264-
if (!this.isTargettingFile(filepath)) {
266+
if (!filepath || !this.isTargettingFile(filepath)) {
265267
return [];
266268
}
269+
267270
const lineRegex = /^"([^"]+)" *: *"([^"]*)$/g;
268271

269272
const line = textEditor.lineTextForBufferRow(bufferPosition.row);
@@ -308,7 +311,7 @@ export class NpmWorker {
308311
link (textEditor, text, range) {
309312
const filepath = textEditor.getPath();
310313

311-
if (!this.isTargettingFile(filepath)) {
314+
if (!filepath || !this.isTargettingFile(filepath)) {
312315
return ;
313316
}
314317

0 commit comments

Comments
 (0)