1
0
mirror of https://github.com/gorhill/uBlock.git synced 2025-01-31 12:11:36 +01:00

Fix "make lint" command; fix more lint errors

This commit is contained in:
Raymond Hill 2025-01-19 09:35:51 -05:00
parent 60ed584fc1
commit 8629f07138
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
17 changed files with 23 additions and 73 deletions

View File

@ -4,7 +4,7 @@
"description": "npm dev tools",
"main": "index.js",
"scripts": {
"lint": "eslint --no-warn-ignored -- ./src/js/*.js ./src/js/**/*.js ./**/*.json ./platform/**/*.js ",
"lint": "eslint --no-warn-ignored -- \"./src/js/*.js\" \"./src/js/**/*.js\" \"./**/*.json\" \"./platform/**/*.js\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {

View File

@ -64,7 +64,7 @@ export async function localRead(key) {
const bin = await browser.storage.local.get(key);
if ( bin instanceof Object === false ) { return; }
return bin[key] ?? undefined;
} catch(ex) {
} catch {
}
}
@ -89,7 +89,7 @@ export async function sessionRead(key) {
const bin = await browser.storage.session.get(key);
if ( bin instanceof Object === false ) { return; }
return bin[key] ?? undefined;
} catch(ex) {
} catch {
}
}
@ -114,7 +114,7 @@ export async function adminRead(key) {
const bin = await browser.storage.managed.get(key);
if ( bin instanceof Object === false ) { return; }
return bin[key] ?? undefined;
} catch(ex) {
} catch {
}
}

View File

@ -19,10 +19,6 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
'use strict';
/******************************************************************************/
function fetchJSON(path) {

View File

@ -79,7 +79,7 @@ async function commitFilteringMode() {
granted = await browser.permissions.request({
origins: [ `*://*.${targetHostname}/*` ],
});
} catch(ex) {
} catch {
}
if ( granted !== true ) {
setFilteringMode(beforeLevel);
@ -287,7 +287,7 @@ dom.on('[data-i18n-title="popupTipReport"]', 'click', ev => {
let url;
try {
url = new URL(currentTab.url);
} catch(_) {
} catch {
}
if ( url === undefined ) { return; }
const reportURL = new URL(runtime.getURL('/report.html'));
@ -325,7 +325,7 @@ async function init() {
url = new URL(url.hash.slice(1));
}
tabURL.href = url.href || '';
} catch(ex) {
} catch {
}
if ( url !== undefined ) {
@ -393,7 +393,7 @@ async function init() {
async function tryInit() {
try {
await init();
} catch(ex) {
} catch {
setTimeout(tryInit, 100);
}
}

View File

@ -52,7 +52,7 @@ const reportedPage = (( ) => {
hostname: parsedURL.hostname.replace(/^(m|mobile|www)\./, ''),
mode: url.searchParams.get('mode'),
};
} catch(ex) {
} catch {
}
return null;
})();

View File

@ -19,12 +19,6 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
'use strict';
/******************************************************************************/
// Important!
// Isolate from global scope
(function uBOL_cssDeclarative() {
@ -39,7 +33,7 @@ delete self.declarativeImports;
const hnParts = [];
try { hnParts.push(...document.location.hostname.split('.')); }
catch(ex) { }
catch { }
const hnpartslen = hnParts.length;
if ( hnpartslen === 0 ) { return; }

View File

@ -19,10 +19,6 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
/******************************************************************************/
// Important!
// Isolate from global scope
(function uBOL_cssProcedural() {
@ -37,7 +33,7 @@ delete self.proceduralImports;
const hnParts = [];
try { hnParts.push(...document.location.hostname.split('.')); }
catch(ex) { }
catch { }
const hnpartslen = hnParts.length;
if ( hnpartslen === 0 ) { return; }
@ -621,14 +617,14 @@ class PSelectorRoot extends PSelector {
prime(input) {
try {
return super.prime(input);
} catch (ex) {
} catch {
}
return [];
}
exec(input) {
try {
return super.exec(input);
} catch (ex) {
} catch {
}
return [];
}

View File

@ -19,12 +19,6 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
'use strict';
/******************************************************************************/
// Important!
// Isolate from global scope
(function uBOL_cssSpecific() {
@ -39,7 +33,7 @@ delete self.specificImports;
const hnParts = [];
try { hnParts.push(...document.location.hostname.split('.')); }
catch(ex) { }
catch { }
const hnpartslen = hnParts.length;
if ( hnpartslen === 0 ) { return; }

View File

@ -195,7 +195,7 @@ function getStagedTrustedSites() {
return punycode.toASCII(
(new URL(`https://${hn}/`)).hostname
);
} catch(_) {
} catch {
}
return '';
}).filter(hn => hn !== '');
@ -292,7 +292,7 @@ sendMessage({
renderFilterLists(cachedRulesetData);
renderWidgets();
dom.cl.remove(dom.body, 'loading');
} catch(ex) {
} catch {
}
listen();
}).catch(reason => {

View File

@ -42,7 +42,7 @@ function urlToFragment(raw) {
b.append(hn);
fragment.append(raw.slice(0,i), b, raw.slice(i+hn.length));
return fragment;
} catch(_) {
} catch {
}
return raw;
}
@ -55,7 +55,7 @@ const toFinalURL = new URL('about:blank');
try {
toURL.href = self.location.hash.slice(1);
toFinalURL.href = toURL.href;
} catch(_) {
} catch {
}
dom.clear('#theURL > p > span:first-of-type');
@ -144,7 +144,7 @@ function fragmentFromTemplate(template, placeholder, text, details) {
let url;
try {
url = new URL(rawURL);
} catch(ex) {
} catch {
return false;
}

View File

@ -19,10 +19,6 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
'use strict';
import { dom } from './dom.js';
/******************************************************************************/

View File

@ -24,7 +24,7 @@
function parsedURLromOrigin(origin) {
try {
return new URL(origin);
} catch(ex) {
} catch {
}
}

View File

@ -19,14 +19,8 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
'use strict';
// ruleset: $rulesetId$
/******************************************************************************/
// Important!
// Isolate from global scope
(function uBOL_cssDeclarativeImport() {

View File

@ -19,11 +19,7 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
'use strict';
/******************************************************************************/
// $rulesetId$
// Important!
// Isolate from global scope
@ -31,8 +27,6 @@
/******************************************************************************/
// $rulesetId$
const toImport = self.$genericSelectorMap$;
const genericSelectorMap = self.genericSelectorMap || new Map();

View File

@ -19,14 +19,8 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
'use strict';
// ruleset: $rulesetId$
/******************************************************************************/
// Important!
// Isolate from global scope
(function uBOL_cssProceduralImport() {

View File

@ -19,14 +19,8 @@
Home: https://github.com/gorhill/uBlock
*/
/* jshint esversion:11 */
'use strict';
// ruleset: $rulesetId$
/******************************************************************************/
// Important!
// Isolate from global scope
(function uBOL_cssSpecificImports() {

View File

@ -24,8 +24,6 @@
// ruleset: $rulesetId$
/******************************************************************************/
// Important!
// Isolate from global scope
@ -66,8 +64,8 @@ try {
const pos = origin.lastIndexOf('://');
if ( pos === -1 ) { return; }
hnParts.push(...origin.slice(pos+3).split('.'));
} catch {
}
catch(ex) { }
const hnpartslen = hnParts.length;
if ( hnpartslen === 0 ) { return; }
@ -124,7 +122,7 @@ if ( entitiesMap.size !== 0 ) {
// Apply scriplets
for ( const i of todoIndices ) {
try { $scriptletName$(...argsList[i]); }
catch(ex) {}
catch { }
}
argsList.length = 0;