Skip to content

Commit 98b0f5d

Browse files
Enable unused var lint check as an error
1 parent d949edd commit 98b0f5d

File tree

12 files changed

+22
-23
lines changed

12 files changed

+22
-23
lines changed

.eslintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"root": true,
44
"parserOptions": {
55
"ecmaVersion": "latest",
6-
"project": "./tsconfig.json"
6+
"project": "./tsconfig.json",
77
},
88
"parser": "@typescript-eslint/parser",
99
"plugins": ["promise","@typescript-eslint"],
@@ -20,7 +20,8 @@
2020
"indent": ["error", 4],
2121
"require-await": ["error"],
2222
"promise/prefer-await-to-then": ["error"],
23-
"@typescript-eslint/await-thenable": "error"
23+
"@typescript-eslint/await-thenable": "error",
24+
"@typescript-eslint/no-unused-vars": "error"
2425
},
2526
"env": {
2627
"webextensions": true,

inject/integration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function getTopLevelURL () {
1414
}
1515
}
1616

17-
function generateConfig (data, userList) {
17+
function generateConfig () {
1818
const topLevelUrl = getTopLevelURL()
1919
const trackerLookup = import.meta.trackerLookup
2020
return {

integration-test/pages/runtimeChecks/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ function init () {
77
document.body.appendChild(script)
88
}
99
// Wait for setup
10-
window.addEventListener('initialize', (e) => {
10+
window.addEventListener('initialize', () => {
1111
init()
1212
})

integration-test/test-pages/shared/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ const isReadyPromise = new Promise((resolve) => {
6161
const url = new URL(window.location.href)
6262
if (url.searchParams.get('automation')) {
6363
isInAutomation = true
64-
window.addEventListener('content-scope-init-complete', (e) => {
64+
window.addEventListener('content-scope-init-complete', () => {
6565
isReadyPromiseResolve()
6666
})
6767
}
6868

6969
// @ts-expect-error - ongoingTests is not defined in the type definition
7070
window.ongoingTests = []
71-
// eslint-disable-next-line no-unused-vars
71+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7272
function test (name, test) {
7373
// @ts-expect-error - ongoingTests is not defined in the type definition
7474
window.ongoingTests.push({ name, test })
7575
}
7676

77-
// eslint-disable-next-line no-unused-vars
77+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7878
async function renderResults () {
7979
const results = {}
8080
if (isInAutomation) {

packages/special-pages/tests/page-objects/mocks.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
mockResponses,
32
mockWindowsMessaging,
43
readOutgoingMessages,
54
simulateSubscriptionMessage,

src/content-feature.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { camelcase, getTabHostname, matchHostname, processAttr, computeEnabledFeatures, parseFeatureSettings } from './utils.js'
1+
import { camelcase, matchHostname, processAttr, computeEnabledFeatures, parseFeatureSettings } from './utils.js'
22
import { immutableJSONPatch } from 'immutable-json-patch'
33
import { PerformanceMonitor } from './performance.js'
44

@@ -156,7 +156,7 @@ export default class ContentFeature {
156156
})
157157
}
158158

159-
// eslint-disable-next-line @typescript-eslint/no-empty-function
159+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
160160
init (args) {
161161
}
162162

@@ -169,7 +169,7 @@ export default class ContentFeature {
169169
this.measure()
170170
}
171171

172-
// eslint-disable-next-line @typescript-eslint/no-empty-function
172+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
173173
load (args) {
174174
}
175175

src/features/element-hiding.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ function collapseDomNode (element, rule, previousElement) {
5454
* Unhide previously hidden DOM element if content loaded into it
5555
* @param {HTMLElement} element
5656
* @param {Object} rule
57-
* @param {HTMLElement} [previousElement]
5857
*/
59-
function expandNonEmptyDomNode (element, rule, previousElement) {
58+
function expandNonEmptyDomNode (element, rule) {
6059
if (!element) {
6160
return
6261
}
@@ -76,7 +75,7 @@ function expandNonEmptyDomNode (element, rule, previousElement) {
7675
// iterate upwards from matching DOM elements until we arrive at previously
7776
// hidden element. Unhide element if it contains visible content.
7877
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
79-
expandNonEmptyDomNode(element.parentNode, rule, element)
78+
expandNonEmptyDomNode(element.parentNode, rule)
8079
}
8180
break
8281
default:
@@ -215,7 +214,7 @@ function extractTimeoutRules (rules) {
215214
const strictHideRules = []
216215
const timeoutRules = []
217216

218-
rules.forEach((rule, i) => {
217+
rules.forEach((rule) => {
219218
if (rule.type === 'hide') {
220219
strictHideRules.push(rule)
221220
} else {
@@ -315,7 +314,7 @@ export default class ElementHiding extends ContentFeature {
315314

316315
// now have the final list of rules to apply, so we apply them when document is loaded
317316
if (document.readyState === 'loading') {
318-
window.addEventListener('DOMContentLoaded', (event) => {
317+
window.addEventListener('DOMContentLoaded', () => {
319318
applyRules(activeRules)
320319
})
321320
} else {
@@ -331,7 +330,7 @@ export default class ElementHiding extends ContentFeature {
331330
})
332331
historyMethodProxy.overload()
333332
// listen for popstate events in order to run on back/forward navigations
334-
window.addEventListener('popstate', (event) => {
333+
window.addEventListener('popstate', () => {
335334
applyRules(activeRules)
336335
})
337336
}

src/features/runtime-checks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ function overrideCreateElement () {
471471
initialCreateElement = proxy._native
472472
}
473473

474+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
474475
function getTaintFromScope (scope, args) {
475476
try {
476477
scope = args.callee.caller

src/features/runtime-checks/script-overload.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { processAttr, getContextId } from '../../utils.js'
22

3+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
34
const globalStates = new Set()
45

56
function generateUniqueID () {
@@ -123,7 +124,7 @@ function constructProxy (scope, outputs) {
123124
return scope
124125
}
125126
return new Proxy(scope, {
126-
get (target, property, receiver) {
127+
get (target, property) {
127128
const targetObj = target[property]
128129
let targetOut = target
129130
if (typeof property === 'string' && property in outputs) {
@@ -213,7 +214,7 @@ export function wrapScriptCodeOverload (code, config) {
213214
currentScope = aggregatedLookup
214215
const pathOut = path[path.length - 1]
215216
// Traverse the path and create the nested objects
216-
path.slice(0, -1).forEach((pathPart, index) => {
217+
path.slice(0, -1).forEach((pathPart) => {
217218
if (!currentScope.has(pathPart)) {
218219
currentScope.set(pathPart, new Map())
219220
}

src/features/web-compat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function safariObjectFix () {
6868
}
6969
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
7070
defineProperty(window.safari.pushNotification, 'permission', {
71-
value: (name) => {
71+
value: () => {
7272
return new SafariRemoteNotificationPermission()
7373
},
7474
configurable: true,

src/features/windows-permission-usage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export default class WindowsPermissionUsage extends ContentFeature {
271271
// @ts-expect-error - trackEnabledPropertyDescriptor is possibly undefined
272272
return trackEnabledPropertyDescriptor.get.bind(this)()
273273
},
274-
set: function (value) {
274+
set: function () {
275275
// @ts-expect-error - trackEnabledPropertyDescriptor is possibly undefined
276276
const result = trackEnabledPropertyDescriptor.set.bind(this)(...arguments)
277277
if (videoTracks.has(this)) {

src/utils.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,6 @@ export function processConfig (data, userList, preferences, platformSpecificFeat
591591
const topLevelHostname = getTabHostname()
592592
const site = computeLimitedSiteObject()
593593
const allowlisted = userList.filter(domain => domain === topLevelHostname).length > 0
594-
const remoteFeatureNames = Object.keys(data.features)
595-
const platformSpecificFeaturesNotInRemoteConfig = platformSpecificFeatures.filter((featureName) => !remoteFeatureNames.includes(featureName))
596594
/** @type {Record<string, any>} */
597595
const output = { ...preferences }
598596
if (output.platform) {

0 commit comments

Comments
 (0)