Skip to content

Commit

Permalink
client: Upgrade eslint
Browse files Browse the repository at this point in the history
Needed to replace insecure hasOwnProperty to avoid https://eslint.org/docs/rules/no-prototype-builtins
  • Loading branch information
jtojnar committed Oct 4, 2019
1 parent 97182c2 commit c2cfc02
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 74 deletions.
2 changes: 1 addition & 1 deletion assets/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"jquery": true
},
"globals": {
"selfoss": {}
"selfoss": "writable"
}
}
26 changes: 11 additions & 15 deletions assets/js/selfoss-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,11 @@ selfoss.dbOffline = {
storeStats: function(stats) {
return selfoss.dbOffline._tr('rw', selfoss.db.storage.stats,
function() {
for (var stat in stats) {
if (stats.hasOwnProperty(stat)) {
selfoss.db.storage.stats.put({
name: stat,
value: stats[stat]
});
}
for (let [name, value] of Object.entries(stats)) {
selfoss.db.storage.stats.put({
name,
value
});
}
});
},
Expand Down Expand Up @@ -780,15 +778,13 @@ selfoss.dbOffline = {
});

if (updateStats) {
for (var statusName in statsDiff) {
if (statsDiff.hasOwnProperty(statusName)) {
selfoss.db.storage.stats.get(statusName, function(stat) {
selfoss.db.storage.stats.put({
name: statusName,
value: stat.value + statsDiff[statusName]
});
for (let [name, value] of Object.entries(statsDiff)) {
selfoss.db.storage.stats.get(name, function(stat) {
selfoss.db.storage.stats.put({
name,
value: stat.value + value
});
}
});
}
}
}).then(selfoss.dbOffline.refreshStats);
Expand Down
36 changes: 17 additions & 19 deletions assets/js/selfoss-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,27 +733,25 @@ selfoss.ui = {


refreshOfflineCounts: function(offlineCounts) {
for (var ck in offlineCounts) {
if (offlineCounts.hasOwnProperty(ck)) {
var selector = '#nav-filter-' + ck;
if (ck == 'unread') {
selector = selector + ', #nav-mobile-count';
}
var widget = $(selector);
var offlineWidget = $('span.offline-count', widget);
for (let [kind, count] of Object.entries(offlineCounts)) {
var selector = '#nav-filter-' + kind;
if (kind == 'unread') {
selector = selector + ', #nav-mobile-count';
}
var widget = $(selector);
var offlineWidget = $('span.offline-count', widget);

if (offlineCounts[ck] == 'keep') {
offlineCounts[ck] = parseInt(offlineWidget.html());
} else {
offlineWidget.html(offlineCounts[ck]);
}
if (count == 'keep') {
count = parseInt(offlineWidget.html());
} else {
offlineWidget.html(count);
}

if (parseInt($('span.count', widget).html()) !=
offlineCounts[ck]) {
offlineWidget.addClass('diff');
} else {
offlineWidget.removeClass('diff');
}
if (parseInt($('span.count', widget).html()) !=
count) {
offlineWidget.addClass('diff');
} else {
offlineWidget.removeClass('diff');
}
}
}
Expand Down
101 changes: 63 additions & 38 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"spectrum-colorpicker": "^1.8.0"
},
"devDependencies": {
"eslint": "^5.16.0",
"eslint": "^6.5.1",
"parcel-bundler": "^1.12.3",
"parcel-plugin-static-files-copy": "^2.2.1",
"parcel-plugin-sw-cache": "^0.3.1"
Expand Down

0 comments on commit c2cfc02

Please sign in to comment.