Skip to content

Commit 8629f07

Browse files
committed
Fix "make lint" command; fix more lint errors
1 parent 60ed584 commit 8629f07

17 files changed

+23
-73
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "npm dev tools",
55
"main": "index.js",
66
"scripts": {
7-
"lint": "eslint --no-warn-ignored -- ./src/js/*.js ./src/js/**/*.js ./**/*.json ./platform/**/*.js ",
7+
"lint": "eslint --no-warn-ignored -- \"./src/js/*.js\" \"./src/js/**/*.js\" \"./**/*.json\" \"./platform/**/*.js\"",
88
"test": "echo \"Error: no test specified\" && exit 1"
99
},
1010
"repository": {

platform/mv3/extension/js/ext.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export async function localRead(key) {
6464
const bin = await browser.storage.local.get(key);
6565
if ( bin instanceof Object === false ) { return; }
6666
return bin[key] ?? undefined;
67-
} catch(ex) {
67+
} catch {
6868
}
6969
}
7070

@@ -89,7 +89,7 @@ export async function sessionRead(key) {
8989
const bin = await browser.storage.session.get(key);
9090
if ( bin instanceof Object === false ) { return; }
9191
return bin[key] ?? undefined;
92-
} catch(ex) {
92+
} catch {
9393
}
9494
}
9595

@@ -114,7 +114,7 @@ export async function adminRead(key) {
114114
const bin = await browser.storage.managed.get(key);
115115
if ( bin instanceof Object === false ) { return; }
116116
return bin[key] ?? undefined;
117-
} catch(ex) {
117+
} catch {
118118
}
119119
}
120120

platform/mv3/extension/js/fetch.js

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
'use strict';
25-
2622
/******************************************************************************/
2723

2824
function fetchJSON(path) {

platform/mv3/extension/js/popup.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async function commitFilteringMode() {
7979
granted = await browser.permissions.request({
8080
origins: [ `*://*.${targetHostname}/*` ],
8181
});
82-
} catch(ex) {
82+
} catch {
8383
}
8484
if ( granted !== true ) {
8585
setFilteringMode(beforeLevel);
@@ -287,7 +287,7 @@ dom.on('[data-i18n-title="popupTipReport"]', 'click', ev => {
287287
let url;
288288
try {
289289
url = new URL(currentTab.url);
290-
} catch(_) {
290+
} catch {
291291
}
292292
if ( url === undefined ) { return; }
293293
const reportURL = new URL(runtime.getURL('/report.html'));
@@ -325,7 +325,7 @@ async function init() {
325325
url = new URL(url.hash.slice(1));
326326
}
327327
tabURL.href = url.href || '';
328-
} catch(ex) {
328+
} catch {
329329
}
330330

331331
if ( url !== undefined ) {
@@ -393,7 +393,7 @@ async function init() {
393393
async function tryInit() {
394394
try {
395395
await init();
396-
} catch(ex) {
396+
} catch {
397397
setTimeout(tryInit, 100);
398398
}
399399
}

platform/mv3/extension/js/report.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const reportedPage = (( ) => {
5252
hostname: parsedURL.hostname.replace(/^(m|mobile|www)\./, ''),
5353
mode: url.searchParams.get('mode'),
5454
};
55-
} catch(ex) {
55+
} catch {
5656
}
5757
return null;
5858
})();

platform/mv3/extension/js/scripting/css-declarative.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
'use strict';
25-
26-
/******************************************************************************/
27-
2822
// Important!
2923
// Isolate from global scope
3024
(function uBOL_cssDeclarative() {
@@ -39,7 +33,7 @@ delete self.declarativeImports;
3933

4034
const hnParts = [];
4135
try { hnParts.push(...document.location.hostname.split('.')); }
42-
catch(ex) { }
36+
catch { }
4337
const hnpartslen = hnParts.length;
4438
if ( hnpartslen === 0 ) { return; }
4539

platform/mv3/extension/js/scripting/css-procedural.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
/******************************************************************************/
25-
2622
// Important!
2723
// Isolate from global scope
2824
(function uBOL_cssProcedural() {
@@ -37,7 +33,7 @@ delete self.proceduralImports;
3733

3834
const hnParts = [];
3935
try { hnParts.push(...document.location.hostname.split('.')); }
40-
catch(ex) { }
36+
catch { }
4137
const hnpartslen = hnParts.length;
4238
if ( hnpartslen === 0 ) { return; }
4339

@@ -621,14 +617,14 @@ class PSelectorRoot extends PSelector {
621617
prime(input) {
622618
try {
623619
return super.prime(input);
624-
} catch (ex) {
620+
} catch {
625621
}
626622
return [];
627623
}
628624
exec(input) {
629625
try {
630626
return super.exec(input);
631-
} catch (ex) {
627+
} catch {
632628
}
633629
return [];
634630
}

platform/mv3/extension/js/scripting/css-specific.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
'use strict';
25-
26-
/******************************************************************************/
27-
2822
// Important!
2923
// Isolate from global scope
3024
(function uBOL_cssSpecific() {
@@ -39,7 +33,7 @@ delete self.specificImports;
3933

4034
const hnParts = [];
4135
try { hnParts.push(...document.location.hostname.split('.')); }
42-
catch(ex) { }
36+
catch { }
4337
const hnpartslen = hnParts.length;
4438
if ( hnpartslen === 0 ) { return; }
4539

platform/mv3/extension/js/settings.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function getStagedTrustedSites() {
195195
return punycode.toASCII(
196196
(new URL(`https://${hn}/`)).hostname
197197
);
198-
} catch(_) {
198+
} catch {
199199
}
200200
return '';
201201
}).filter(hn => hn !== '');
@@ -292,7 +292,7 @@ sendMessage({
292292
renderFilterLists(cachedRulesetData);
293293
renderWidgets();
294294
dom.cl.remove(dom.body, 'loading');
295-
} catch(ex) {
295+
} catch {
296296
}
297297
listen();
298298
}).catch(reason => {

platform/mv3/extension/js/strictblock.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function urlToFragment(raw) {
4242
b.append(hn);
4343
fragment.append(raw.slice(0,i), b, raw.slice(i+hn.length));
4444
return fragment;
45-
} catch(_) {
45+
} catch {
4646
}
4747
return raw;
4848
}
@@ -55,7 +55,7 @@ const toFinalURL = new URL('about:blank');
5555
try {
5656
toURL.href = self.location.hash.slice(1);
5757
toFinalURL.href = toURL.href;
58-
} catch(_) {
58+
} catch {
5959
}
6060

6161
dom.clear('#theURL > p > span:first-of-type');
@@ -144,7 +144,7 @@ function fragmentFromTemplate(template, placeholder, text, details) {
144144
let url;
145145
try {
146146
url = new URL(rawURL);
147-
} catch(ex) {
147+
} catch {
148148
return false;
149149
}
150150

platform/mv3/extension/js/theme.js

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
'use strict';
25-
2622
import { dom } from './dom.js';
2723

2824
/******************************************************************************/

platform/mv3/extension/js/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
function parsedURLromOrigin(origin) {
2525
try {
2626
return new URL(origin);
27-
} catch(ex) {
27+
} catch {
2828
}
2929
}
3030

platform/mv3/scriptlets/css-declarative.template.js

-6
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
'use strict';
25-
2622
// ruleset: $rulesetId$
2723

28-
/******************************************************************************/
29-
3024
// Important!
3125
// Isolate from global scope
3226
(function uBOL_cssDeclarativeImport() {

platform/mv3/scriptlets/css-generic.template.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,14 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
'use strict';
25-
26-
/******************************************************************************/
22+
// $rulesetId$
2723

2824
// Important!
2925
// Isolate from global scope
3026
(function uBOL_cssGenericImport() {
3127

3228
/******************************************************************************/
3329

34-
// $rulesetId$
35-
3630
const toImport = self.$genericSelectorMap$;
3731

3832
const genericSelectorMap = self.genericSelectorMap || new Map();

platform/mv3/scriptlets/css-procedural.template.js

-6
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
'use strict';
25-
2622
// ruleset: $rulesetId$
2723

28-
/******************************************************************************/
29-
3024
// Important!
3125
// Isolate from global scope
3226
(function uBOL_cssProceduralImport() {

platform/mv3/scriptlets/css-specific.template.js

-6
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@
1919
Home: https://github.com/gorhill/uBlock
2020
*/
2121

22-
/* jshint esversion:11 */
23-
24-
'use strict';
25-
2622
// ruleset: $rulesetId$
2723

28-
/******************************************************************************/
29-
3024
// Important!
3125
// Isolate from global scope
3226
(function uBOL_cssSpecificImports() {

platform/mv3/scriptlets/scriptlet.template.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
// ruleset: $rulesetId$
2626

27-
/******************************************************************************/
28-
2927
// Important!
3028
// Isolate from global scope
3129

@@ -66,8 +64,8 @@ try {
6664
const pos = origin.lastIndexOf('://');
6765
if ( pos === -1 ) { return; }
6866
hnParts.push(...origin.slice(pos+3).split('.'));
67+
} catch {
6968
}
70-
catch(ex) { }
7169
const hnpartslen = hnParts.length;
7270
if ( hnpartslen === 0 ) { return; }
7371

@@ -124,7 +122,7 @@ if ( entitiesMap.size !== 0 ) {
124122
// Apply scriplets
125123
for ( const i of todoIndices ) {
126124
try { $scriptletName$(...argsList[i]); }
127-
catch(ex) {}
125+
catch { }
128126
}
129127
argsList.length = 0;
130128

0 commit comments

Comments
 (0)