Skip to content

Commit 61a2d45

Browse files
committed
Linting
1 parent a2d67fb commit 61a2d45

File tree

18 files changed

+56
-47
lines changed

18 files changed

+56
-47
lines changed

.eslintrc.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-env node */
12
module.exports = {
23
root: true,
34
env: {
@@ -9,6 +10,7 @@ module.exports = {
910
ecmaVersion: "latest",
1011
},
1112
extends: [
13+
"eslint:recommended",
1214
"plugin:@cspell/recommended",
1315
"plugin:security/recommended-legacy",
1416

@@ -18,7 +20,9 @@ module.exports = {
1820

1921
//! Prettier should always be the last configuration in the extends array.
2022
],
21-
rules: {},
23+
rules: {
24+
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }], // Ignore variables whose names begin with an underscore.
25+
},
2226
overrides: [
2327
/*
2428
* Userscript files.

April_Fools_CSS/April_Fools_CSS.user.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ if (window.top === window) {
9191
interval + duration + 10,
9292
);
9393

94-
for (var aprilFool in aprilFools) {
94+
for (var aprilFoolText in aprilFools) {
9595
GM_addStyle(
9696
".aprilfool" +
97-
aprilFool +
97+
aprilFoolText +
9898
" " +
99-
aprilFools[aprilFool].replace("{duration}", duration / 1000),
99+
aprilFools[aprilFoolText].replace(
100+
"{duration}",
101+
duration / 1000,
102+
),
100103
);
101104
}
102105
}

Dakar_Extender/208433.user.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ==/UserScript==
1414

1515
// cSpell:ignore dakar
16+
/* global $ */
1617

1718
(function () {
1819
var countryCode = "NLD";

Github_Comment_Enhancer/Github_Comment_Enhancer.user.js

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
/* eslint security/detect-object-injection: "off" */
2626
/* eslint security/detect-unsafe-regex: "off" */
2727
/* eslint security/detect-non-literal-regexp: "off" */
28-
/* global unsafeWindow */
2928

3029
(function (unsafeWindow) {
3130
String.format = function (string) {

Github_Commit_Diff/Github_Commit_Diff.user.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
/\/compare\//.test(location.href)) &&
3131
(e = document.getElementById("toc"))
3232
) {
33-
var r = e.querySelector(".GithubCommitDiffButton");
33+
let r = e.querySelector(".GithubCommitDiffButton");
3434
if (r) {
3535
r.parentElement.removeChild(r);
3636
}
3737

38-
var b = e.querySelector(".toc-diff-stats");
38+
let b = e.querySelector(".toc-diff-stats");
3939

4040
const s = document.createElementNS(
4141
"http://www.w3.org/2000/svg",
@@ -57,7 +57,7 @@
5757
);
5858
s.appendChild(p);
5959

60-
var a = document.createElement("a");
60+
let a = document.createElement("a");
6161
a.classList.add("btn", "btn-sm", "tooltipped", "tooltipped-n");
6262
a.setAttribute("href", getPatchOrDiffHref("diff"));
6363
a.setAttribute("rel", "nofollow");
@@ -68,7 +68,7 @@
6868
a.appendChild(s);
6969
a.appendChild(document.createTextNode(" Diff"));
7070

71-
var g = document.createElement("div");
71+
let g = document.createElement("div");
7272
g.classList.add("GithubCommitDiffButton", "float-right");
7373
g.style.margin = "0 10px 0 0"; // Give us some room
7474
g.appendChild(a);
@@ -89,7 +89,7 @@
8989
"#files_bucket .pr-toolbar .diffbar > .float-right",
9090
))
9191
) {
92-
var r = e.querySelector(".GithubCommitDiffButton");
92+
let r = e.querySelector(".GithubCommitDiffButton");
9393
if (r) {
9494
r.parentElement.removeChild(r);
9595
}
@@ -114,7 +114,7 @@
114114
);
115115
s.appendChild(p);
116116

117-
var a = document.createElement("a");
117+
let a = document.createElement("a");
118118
a.classList.add(
119119
"btn",
120120
"btn-sm",
@@ -131,7 +131,7 @@
131131
a.appendChild(s);
132132
a.appendChild(document.createTextNode(" Diff"));
133133

134-
var g = document.createElement("div");
134+
let g = document.createElement("div");
135135
g.classList.add("GithubCommitDiffButton", "diffbar-item");
136136
g.appendChild(a);
137137

Github_Commit_Whitespace/Github_Commit_Whitespace.user.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
/\/compare\//.test(location.href)) &&
2929
(e = document.getElementById("toc"))
3030
) {
31-
var r = e.querySelector(".GithubCommitWhitespaceButton");
31+
let r = e.querySelector(".GithubCommitWhitespaceButton");
3232
if (r) {
3333
r.parentElement.removeChild(r);
3434
}
3535

36-
var on = /w=/.test(location.search); // Any occurrence results in enabling
36+
let on = /w=/.test(location.search); // Any occurrence results in enabling
3737

38-
var b = e.querySelector(".toc-diff-stats");
38+
let b = e.querySelector(".toc-diff-stats");
3939

40-
var a = document.createElement("a");
40+
let a = document.createElement("a");
4141
a.classList.add("btn", "btn-sm", "tooltipped", "tooltipped-n");
4242
if (on) {
4343
a.classList.add("selected");
@@ -50,7 +50,7 @@
5050
);
5151
a.appendChild(document.createTextNode("\u2423"));
5252

53-
var g = document.createElement("div");
53+
let g = document.createElement("div");
5454
g.classList.add("GithubCommitWhitespaceButton", "float-right");
5555
g.style.margin = "0 10px 0 0"; // Give us some room
5656
g.appendChild(a);
@@ -62,14 +62,14 @@
6262
"#files_bucket .pr-toolbar .diffbar > .pr-review-tools",
6363
))
6464
) {
65-
var r = e.querySelector(".GithubCommitWhitespaceButton");
65+
let r = e.querySelector(".GithubCommitWhitespaceButton");
6666
if (r) {
6767
r.parentElement.removeChild(r);
6868
}
6969

70-
var on = /w=/.test(location.search); // Any occurrence result in enabling
70+
let on = /w=/.test(location.search); // Any occurrence result in enabling
7171

72-
var a = document.createElement("a");
72+
let a = document.createElement("a");
7373
a.classList.add(
7474
"btn",
7575
"btn-sm",
@@ -85,7 +85,7 @@
8585
);
8686
a.appendChild(document.createTextNode("\u2423"));
8787

88-
var g = document.createElement("div");
88+
let g = document.createElement("div");
8989
g.classList.add("GithubCommitWhitespaceButton", "diffbar-item");
9090
g.appendChild(a);
9191

Github_Gist_Share/157850.user.js

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
const menu = new Menu(nav);
196196

197197
// Twitter
198+
// eslint-disable-next-line no-constant-condition
198199
if (true) {
199200
const stats = [];
200201
if (data.files > 1) {

Github_JSON_Dependencies_Linker/Github_JSON_Dependencies_Linker.user.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
// cSpell:ignore linkify, Sindre Sorhus
2727
/* eslint security/detect-object-injection: "off" */
28-
/* global GM_xmlhttpRequest */
2928

3029
(function () {
3130
var blobElm = document.querySelector(".highlight"),
@@ -182,18 +181,18 @@
182181
modules[dependencyKey].forEach(function (module) {
183182
if (isAtom && dependencyKey === "packageDependencies") {
184183
// Atom needs to be before NPM.
185-
var url = "https://atom.io/packages/" + module;
184+
let url = "https://atom.io/packages/" + module;
186185
linkify(module, url);
187186
} else if (isNPM) {
188-
var url = "https://www.npmjs.org/package/" + module;
187+
let url = "https://www.npmjs.org/package/" + module;
189188
linkify(module, url);
190189
} else if (isBower) {
191190
GM_xmlhttpRequest({
192191
method: "GET",
193192
url: "http://bower.herokuapp.com/packages/" + module,
194193
onload: function (response) {
195194
var data = JSON.parse(response.responseText);
196-
var re = /github\.com\/([\w\-\.]+)\/([\w\-\.]+)/i;
195+
var re = /github\.com\/([\w\-.]+)\/([\w\-.]+)/i;
197196
var parsedUrl = re.exec(data.url.replace(/\.git$/, ""));
198197
if (parsedUrl) {
199198
var user = parsedUrl[1];

Github_Reply_Comments/Github_Reply_Comments.user.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
// cSpell:ignore textareas, previewable, tooltipped
2626
/* eslint security/detect-object-injection: "off" */
27+
/* global TurndownService,turndownPluginGfm,turndownPluginGithubCodeSnippet */
2728

2829
(function () {
2930
String.format = function (string) {

Multiple_Windows_Live_IDs/Multiple_Windows_Live_IDs.user.js

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
// cSpell:ignore MWLID, maincontent, phholder, transform
2424
/* eslint security/detect-object-injection: "off" */
25-
/* global GM_getValue,GM_setValue */
2625

2726
(function () {
2827
var autoLogin = true;

Twitter_profile_replies_hider/Twitter_profile_replies_hider.user.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114

115115
// new tweets are loaded, handle accordingly;
116116
new MutationObserver(function (mutations) {
117-
mutations.forEach(function (mutation) {
117+
mutations.forEach(function () {
118118
toggle(!!~~localStorage.getItem(settingsKey, +true));
119119
});
120120
}).observe(timeline, { childList: true });

Twitter_profile_retweets_hider/Twitter_profile_retweets_hider.user.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114

115115
// new tweets are loaded, handle accordingly;
116116
new MutationObserver(function (mutations) {
117-
mutations.forEach(function (mutation) {
117+
mutations.forEach(function () {
118118
toggle(!!~~localStorage.getItem(settingsKey, +true));
119119
});
120120
}).observe(timeline, { childList: true });

Userscripts.org_Diff_Extender/38909.user.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6666
/*/ /////////////////////////////////////////////////////////////////////////
6767

6868
// cSpell:ignore andale, lucida, cellspacing
69+
/* eslint no-redeclare: "off" */
6970

7071
//*** USERSCRIPT ***//
71-
(function (win, doc, und) {
72+
(function (win, doc, _und) {
7273
var xPath = function (xpath, root) {
7374
var next,
7475
got = doc.evaluate(xpath, root || doc, null, null, null),
@@ -173,10 +174,10 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
173174
tr.appendChild(tdAdd);
174175

175176
var iOld = meta.textContent.match(
176-
/^@@\s\-(\d+),\d+\s\+(\d+),\d+\s@@/,
177+
/^@@\s-(\d+),\d+\s\+(\d+),\d+\s@@/,
177178
)[1];
178179
var iNew = meta.textContent.match(
179-
/^@@\s\-(\d+),\d+\s\+(\d+),\d+\s@@/,
180+
/^@@\s-(\d+),\d+\s\+(\d+),\d+\s@@/,
180181
)[2];
181182
while (
182183
meta.nextSibling &&
@@ -200,7 +201,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
200201
tdDel.appendChild(doc.createTextNode(iOld));
201202
iOld++;
202203
}
203-
if (!item.match(/^\-/)) {
204+
if (!item.match(/^-/)) {
204205
tdAdd.className = "diffDel";
205206
tdAdd.appendChild(doc.createTextNode(iNew));
206207
iNew++;
@@ -226,7 +227,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
226227
var temp = del.textContent;
227228
del.style.width = scrollWidth;
228229
del.style.marginLeft = "-15px";
229-
del.style.borderColor = /^\-/.test(temp)
230+
del.style.borderColor = /^-/.test(temp)
230231
? "#AA3333"
231232
: "#33AA33";
232233
del.style.borderStyle = "solid";
@@ -240,13 +241,13 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
240241
while (del.hasChildNodes())
241242
del.removeChild(del.firstChild);
242243
del.appendChild(
243-
doc.createTextNode(temp.replace(/^[\+\-]/, "")),
244+
doc.createTextNode(temp.replace(/^[+-]/, "")),
244245
);
245246
var span = doc.createElement("span");
246247
span.className =
247-
(/^\-/.test(temp) ? "diffAdd" : "diffDel") +
248+
(/^-/.test(temp) ? "diffAdd" : "diffDel") +
248249
" diffSim";
249-
span.innerHTML = temp.match(/^[\+\-]/);
250+
span.innerHTML = temp.match(/^[+-]/);
250251
del.insertBefore(span, del.firstChild);
251252
},
252253
);

Userscripts.org_Source_Numbering/38912.user.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
var maxLines = 10000; // [Integer] maximum number of lines (prevent browser from hanging and possibly crashing);
3636

3737
//*** USERSCRIPT ***//
38-
(function (win, doc, und) {
38+
(function (win, doc, _und) {
3939
try {
4040
var getStyle = function (node, attr) {
4141
if (doc.defaultView && doc.defaultView.getComputedStyle) {

Userscripts.org_Timed_Updater/37853.user.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6161
/*/ /////////////////////////////////////////////////////////////////////////
6262

6363
// cSpell:ignore plusmn
64+
/* eslint no-inner-declarations: "off" */
6465
/* eslint security/detect-object-injection: "off" */
6566

6667
//*** USERSCRIPT ***//
67-
(function (win, doc, und) {
68+
(function (win, doc, _und) {
6869
var addEvent = function (node, type, fn, useCapture) {
6970
if (node.addEventListener) {
7071
node.addEventListener(type, fn, useCapture);

Userscripts.org_Topics_Column/38597.user.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6868
var updateTime = 3 * 60 * 60 * 1000; // [Number] update time (we don't want to flood userscripts.org);
6969

7070
//*** USERSCRIPT ***//
71-
(function (win, doc, und) {
71+
(function (win, doc, _und) {
7272
try {
7373
var UTC = {
7474
init: function () {
@@ -88,7 +88,7 @@ var updateTime = 3 * 60 * 60 * 1000; // [Number] update time (we don't want to f
8888
if (trs.length && postsIndex) {
8989
Array.forEach(trs, function (tr) {
9090
var column = tr.cells[postsIndex];
91-
if (!/scripts\-/.test(tr.id)) {
91+
if (!/scripts-/.test(tr.id)) {
9292
// Header;
9393
var th = doc.createElement("th");
9494
th.className = "la";
@@ -130,7 +130,7 @@ var updateTime = 3 * 60 * 60 * 1000; // [Number] update time (we don't want to f
130130
return function countTopics(x) {
131131
var t = 0,
132132
n = x.responseText.match(
133-
/\"\>(\d+)\s+topics?,\s+\d+\s+posts?/,
133+
/">(\d+)\s+topics?,\s+\d+\s+posts?/,
134134
);
135135
if (
136136
n &&

Userscripts.org_Versions_Column/38595.user.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6969
var updateTime = 3 * 60 * 60 * 1000; // [Integer] update time (we don't want to flood userscripts.org);
7070

7171
//*** USERSCRIPT ***//
72-
(function (win, doc, und) {
72+
(function (win, doc, _und) {
7373
try {
7474
var UVC = {
7575
init: function () {
@@ -89,7 +89,7 @@ var updateTime = 3 * 60 * 60 * 1000; // [Integer] update time (we don't want to
8989
if (trs.length && postsIndex) {
9090
Array.forEach(trs, function (tr) {
9191
var column = tr.cells[postsIndex];
92-
if (!/scripts\-/.test(tr.id)) {
92+
if (!/scripts-/.test(tr.id)) {
9393
// Header;
9494
var th = doc.createElement("th");
9595
th.className = "la";
@@ -131,7 +131,7 @@ var updateTime = 3 * 60 * 60 * 1000; // [Integer] update time (we don't want to
131131
return function count(x) {
132132
var i = 0,
133133
n = x.responseText.match(
134-
/\"\>(\d+)\s+previous versions?<\/a\>/,
134+
/">(\d+)\s+previous versions?<\/a>/,
135135
);
136136
if (
137137
n &&

0 commit comments

Comments
 (0)