Skip to content

Commit dc1fde3

Browse files
dbajpeyishakyShane
andauthored
support noUnusedParameters (#1579)
Co-authored-by: Shane Osbourne <[email protected]>
1 parent cd85139 commit dc1fde3

File tree

36 files changed

+80
-94
lines changed

36 files changed

+80
-94
lines changed

.github/scripts/diff-directories.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function upperCaseFirstLetter(string) {
2626
return string.charAt(0).toUpperCase() + string.slice(1);
2727
}
2828

29-
function displayDiffs(dir1Files, dir2Files, isOpen) {
29+
function displayDiffs(dir1Files, dir2Files) {
3030
const rollupGrouping = {};
3131
/**
3232
* Rolls up multiple files with the same diff into a single entry
@@ -79,13 +79,13 @@ function displayDiffs(dir1Files, dir2Files, isOpen) {
7979
}
8080
}
8181
outString += '\n\n' + rollup.string;
82-
return renderDetails(title, outString, isOpen);
82+
return renderDetails(title, outString);
8383
})
8484
.join('\n');
8585
return outString;
8686
}
8787

88-
function renderDetails(section, text, isOpen) {
88+
function renderDetails(section, text) {
8989
if (section === 'dist') {
9090
section = 'apple';
9191
}
@@ -120,5 +120,5 @@ sortFiles(readFilesRecursively(dir1 + sourcesOutput), 'dir1');
120120
sortFiles(readFilesRecursively(dir2 + sourcesOutput), 'dir2');
121121

122122
// console.log(Object.keys(files))
123-
const fileOut = displayDiffs(sections.dir1, sections.dir2, true);
123+
const fileOut = displayDiffs(sections.dir1, sections.dir2);
124124
console.log(fileOut);

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default tseslint.config(
1111
'**/build/',
1212
'**/docs/',
1313
'injected/lib',
14+
'injected/playwright-report/',
1415
'Sources/ContentScopeScripts/dist/',
1516
'injected/integration-test/extension/contentScope.js',
1617
'injected/integration-test/test-pages/duckplayer/scripts/dist',

injected/src/content-feature.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export default class ContentFeature extends ConfigFeature {
137137
return processAttr(configSetting, defaultValue);
138138
}
139139

140-
init(args) {}
140+
init(_args) {}
141141

142142
callInit(args) {
143143
const mark = this.monitor.mark(this.name + 'CallInit');
@@ -153,7 +153,7 @@ export default class ContentFeature extends ConfigFeature {
153153
this.platform = args.platform;
154154
}
155155

156-
load(args) {}
156+
load(_args) {}
157157

158158
/**
159159
* This is a wrapper around `this.messaging.notify` that applies the
@@ -237,7 +237,7 @@ export default class ContentFeature extends ConfigFeature {
237237
if (typeof descriptorProp === 'function') {
238238
const addDebugFlag = this.addDebugFlag.bind(this);
239239
const wrapper = new Proxy(descriptorProp, {
240-
apply(target, thisArg, argumentsList) {
240+
apply(_, thisArg, argumentsList) {
241241
addDebugFlag();
242242
return Reflect.apply(descriptorProp, thisArg, argumentsList);
243243
},

injected/src/features/broker-protection/actions/build-url-transforms.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const optionalTransforms = new Map([
6161
['defaultIfEmpty', (value, argument) => value || argument || ''],
6262
[
6363
'ageRange',
64-
(value, argument, action) => {
64+
(value, _, action) => {
6565
if (!action.ageRange) return value;
6666
const ageNumber = Number(value);
6767
// find matching age range
@@ -142,7 +142,7 @@ export function processTemplateStringWithUserData(input, action, userData) {
142142
* Note: this regex covers both pathname + query params.
143143
* This is why we're handling both encoded and un-encoded.
144144
*/
145-
return String(input).replace(/\$%7B(.+?)%7D|\$\{(.+?)}/g, (match, encodedValue, plainValue) => {
145+
return String(input).replace(/\$%7B(.+?)%7D|\$\{(.+?)}/g, (_, encodedValue, plainValue) => {
146146
const comparison = encodedValue ?? plainValue;
147147
const [dataKey, ...transforms] = comparison.split(/\||%7C/);
148148
const data = userData[dataKey];

injected/src/features/broker-protection/actions/extract.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function extractProfiles(action, userData, root = document) {
9191

9292
return {
9393
results: profilesElementList.map((element) => {
94-
const elementFactory = (key, value) => {
94+
const elementFactory = (_, value) => {
9595
return value?.findElements
9696
? cleanArray(getElements(element, value.selector))
9797
: cleanArray(getElement(element, value.selector) || getElementMatches(element, value.selector));

injected/src/features/broker-protection/types.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ export class ProfileResult {
7676
*/
7777
export class Extractor {
7878
/**
79-
* @param {string[]} noneEmptyStringArray
80-
* @param {import("./actions/extract").ExtractorParams} extractorParams
79+
* @param {string[]} _noneEmptyStringArray
80+
* @param {import("./actions/extract").ExtractorParams} _extractorParams
8181
* @return {JsonValue}
8282
*/
8383

84-
extract(noneEmptyStringArray, extractorParams) {
84+
extract(_noneEmptyStringArray, _extractorParams) {
8585
throw new Error('must implement extract');
8686
}
8787
}
@@ -91,12 +91,12 @@ export class Extractor {
9191
*/
9292
export class AsyncProfileTransform {
9393
/**
94-
* @param {Record<string, any>} profile - The current profile value
95-
* @param {Record<string, any>} profileParams - the original action params from `action.profile`
94+
* @param {Record<string, any>} _profile - The current profile value
95+
* @param {Record<string, any>} _profileParams - the original action params from `action.profile`
9696
* @return {Promise<Record<string, any>>}
9797
*/
9898

99-
transform(profile, profileParams) {
99+
transform(_profile, _profileParams) {
100100
throw new Error('must implement extract');
101101
}
102102
}

injected/src/features/message-bridge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export class MessageBridge extends ContentFeature {
221221
}
222222
}
223223

224-
load(args) {}
224+
load(_args) {}
225225
}
226226

227227
export default MessageBridge;

injected/src/features/web-compat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ export class WebCompat extends ContentFeature {
445445
});
446446
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
447447
this.defineProperty(window.safari.pushNotification, 'requestPermission', {
448-
value: (name, domain, options, callback) => {
448+
value: (_name, _domain, _options, callback) => {
449449
if (typeof callback === 'function') {
450450
callback(new SafariRemoteNotificationPermission());
451451
return;

injected/src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export function isFeatureBroken(args, feature) {
226226
}
227227

228228
export function camelcase(dashCaseText) {
229-
return dashCaseText.replace(/-(.)/g, (match, letter) => {
229+
return dashCaseText.replace(/-(.)/g, (_, letter) => {
230230
return letter.toUpperCase();
231231
});
232232
}

injected/src/wrapper-utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function wrapFunction(functionValue, realTarget) {
104104
}
105105
return Reflect.get(target, prop, receiver);
106106
},
107-
apply(target, thisArg, argumentsList) {
107+
apply(_, thisArg, argumentsList) {
108108
// This is where we call our real function
109109
return Reflect.apply(functionValue, thisArg, argumentsList);
110110
},
@@ -228,7 +228,7 @@ export function shimInterface(interfaceName, ImplClass, options, definePropertyF
228228
// handle the case where the constructor is called without new
229229
if (fullOptions.allowConstructorCall) {
230230
// make the constructor function callable without new
231-
proxyHandler.apply = function (target, thisArg, argumentsList) {
231+
proxyHandler.apply = function (target, _thisArg, argumentsList) {
232232
return Reflect.construct(target, argumentsList, target);
233233
};
234234
}

injected/unit-test/content-feature.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('ContentFeature class', () => {
5353
// eslint-disable-next-line
5454
// @ts-ignore partial mock
5555
messaging = {
56-
notify(name, data) {},
56+
notify(_name, _data) {},
5757
};
5858
}
5959
let feature;

injected/unit-test/messaging.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ describe('Android', () => {
217217
function createMessaging() {
218218
/** @type {import("@duckduckgo/messaging").MessagingTransport} */
219219
const transport = {
220-
notify(msg) {
220+
notify(_) {
221221
// test
222222
},
223223

messaging/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,31 +136,31 @@ export class Messaging {
136136
*/
137137
export class MessagingTransport {
138138
/**
139-
* @param {NotificationMessage} msg
139+
* @param {NotificationMessage} _msg
140140
* @returns {void}
141141
*/
142142

143-
notify(msg) {
144-
throw new Error("must implement 'notify'");
143+
notify(_msg) {
144+
throw new Error('must implement');
145145
}
146146

147147
/**
148-
* @param {RequestMessage} msg
149-
* @param {{signal?: AbortSignal}} [options]
148+
* @param {RequestMessage} _msg
149+
* @param {{signal?: AbortSignal}} [_options]
150150
* @return {Promise<any>}
151151
*/
152152

153-
request(msg, options = {}) {
153+
request(_msg, _options = {}) {
154154
throw new Error('must implement');
155155
}
156156

157157
/**
158-
* @param {Subscription} msg
159-
* @param {(value: unknown) => void} callback
158+
* @param {Subscription} _msg
159+
* @param {(value: unknown) => void} _callback
160160
* @return {() => void}
161161
*/
162162

163-
subscribe(msg, callback) {
163+
subscribe(_msg, _callback) {
164164
throw new Error('must implement');
165165
}
166166
}

messaging/lib/typed-messages.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
* into only calls supported by your schema
88
*
99
* @template {Partial<import("./shared-types").MessagingBase>} BaseClass
10-
* @param {BaseClass} base - the class onto which you've added the properties from `MessagingBase`
11-
* @param {import("@duckduckgo/messaging").Messaging} messaging
10+
* @param {BaseClass} _base - the class onto which you've added the properties from `MessagingBase`
11+
* @param {import("@duckduckgo/messaging").Messaging} _messaging
1212
* @returns {BaseClass}
1313
*/
14-
export function createTypedMessages(base, messaging) {
15-
const asAny = /** @type {any} */ (messaging);
14+
export function createTypedMessages(_base, _messaging) {
15+
const asAny = /** @type {any} */ (_messaging);
1616
return /** @type {BaseClass} */ (asAny);
1717
}

special-pages/pages/duckplayer/app/features/iframe.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import { ErrorDetection } from './error-detection.js';
1212
*/
1313
export class IframeFeature {
1414
/**
15-
* @param {HTMLIFrameElement} iframe
15+
* @param {HTMLIFrameElement} _iframe
1616
* @returns {(() => void) | null}
1717
*/
1818

19-
iframeDidLoad(iframe) {
19+
iframeDidLoad(_iframe) {
2020
return () => {
2121
console.log('teardown');
2222
};

special-pages/pages/history/app/components/Sidebar.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,7 @@ export function Sidebar({ ranges }) {
8080
<nav class={styles.nav}>
8181
{ranges.value.map((range) => {
8282
return (
83-
<Item
84-
key={range.id}
85-
onClick={onClick}
86-
onDelete={onDelete}
87-
current={current}
88-
range={range.id}
89-
count={range.count}
90-
ranges={ranges}
91-
/>
83+
<Item key={range.id} onClick={onClick} onDelete={onDelete} current={current} range={range.id} count={range.count} />
9284
);
9385
})}
9486
</nav>
@@ -104,10 +96,9 @@ export function Sidebar({ ranges }) {
10496
* @param {RangeId} props.range The range represented by this item.
10597
* @param {(range: RangeId) => void} props.onClick Callback function triggered when the range is clicked.
10698
* @param {(range: RangeId) => void} props.onDelete Callback function triggered when the delete action is clicked.
107-
* @param {import("@preact/signals").Signal<Range[]>} props.ranges
10899
* @param {number} props.count The count value associated with the ranges.
109100
*/
110-
function Item({ current, range, onClick, onDelete, ranges, count }) {
101+
function Item({ current, range, onClick, onDelete, count }) {
111102
const { t } = useTypedTranslation();
112103
const { buttonLabel, linkLabel } = labels(range, t);
113104
const classNames = useComputed(() => {
@@ -133,7 +124,7 @@ function Item({ current, range, onClick, onDelete, ranges, count }) {
133124
</span>
134125
{titleMap[range](t)}
135126
</button>
136-
<DeleteAllButton onClick={onDelete} ariaLabel={buttonLabel} range={range} ranges={ranges} count={count} />
127+
<DeleteAllButton onClick={onDelete} ariaLabel={buttonLabel} range={range} count={count} />
137128
</div>
138129
);
139130
}
@@ -144,12 +135,11 @@ function Item({ current, range, onClick, onDelete, ranges, count }) {
144135
*
145136
* @param {Object} props - The properties passed to the component.
146137
* @param {RangeId} props.range - The range value used for filtering and identification.
147-
* @param {import('@preact/signals').Signal<Range[]>} props.ranges - A signal containing an array of range values used for navigation.
148138
* @param {string} props.ariaLabel - The accessible label for the delete button.
149139
* @param {(evt: RangeId) => void} props.onClick - The callback function triggered on button click.
150140
* @param {number} props.count - A signal representing the count of items in the range.
151141
*/
152-
function DeleteAllButton({ range, ranges, onClick, ariaLabel, count }) {
142+
function DeleteAllButton({ range, onClick, ariaLabel, count }) {
153143
const { t } = useTypedTranslationWith(/** @type {json} */ ({}));
154144

155145
const ariaDisabled = count === 0 ? 'true' : 'false';

special-pages/pages/history/app/components/VirtualizedList.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
2525
* @param {(end: number)=>void} props.onChange - called when the end number is changed
2626
*/
2727
export function VirtualizedList({ items, heights, overscan, scrollingElement, onChange, renderItem }) {
28-
const { start, end } = useVisibleRows(items, heights, scrollingElement, onChange, overscan);
28+
const { start, end } = useVisibleRows(items, heights, scrollingElement, overscan);
2929
const subset = items.slice(start, end + 1);
3030

3131
/**
@@ -61,10 +61,9 @@ export const VisibleItems = memo(VirtualizedList);
6161
* @param {number[]} heights - index lookup for known element heights
6262
* @param {string} scrollerSelector - A CSS selector for tracking the scrollable area
6363
* @param {number} overscan - how many items to fetch outside the window
64-
* @param {(end: number)=>void} onChange - called when the end number is changed
6564
* @return {Object} An object containing the calculated `start` and `end` indices of the visible rows.
6665
*/
67-
function useVisibleRows(rows, heights, scrollerSelector, onChange, overscan = 5) {
66+
function useVisibleRows(rows, heights, scrollerSelector, overscan = 5) {
6867
// set the start/end indexes of the elements
6968
const [{ start, end }, setVisibleRange] = useState({ start: 0, end: 1 });
7069

special-pages/pages/history/app/global/Providers/QueryProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const QueryContext = createContext(
3434

3535
const QueryDispatch = createContext(
3636
/** @type {(a: Action) => void} */ (
37-
(action) => {
37+
(_) => {
3838
throw new Error('missing QueryDispatch');
3939
}
4040
),

special-pages/pages/history/app/global/Providers/SelectionProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { useSelectionStateApi } from '../hooks/useSelectionState.js';
1414
* @import { ReadonlySignal } from '@preact/signals'
1515
*/
1616

17-
const SelectionDispatchContext = createContext(/** @type {(a: Action) => void} */ ((a) => {}));
17+
const SelectionDispatchContext = createContext(/** @type {(a: Action) => void} */ ((_) => {}));
1818
const SelectionStateContext = createContext(/** @type {ReadonlySignal<SelectionState>} */ (signal({})));
1919

2020
/**

special-pages/pages/new-tab/app/activity/components/Activity.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export function ActivityBody({ canBurn, visibility }) {
8181

8282
return (
8383
<ul class={styles.activity} data-busy={busy}>
84-
{keys.value.map((id, index) => {
84+
ts{' '}
85+
{keys.value.map((id, _index) => {
8586
if (canBurn && !isReducedMotion) return <BurnableItem id={id} key={id} documentVisibility={visibility} />;
8687
return <RemovableItem id={id} key={id} canBurn={canBurn} documentVisibility={visibility} />;
8788
})}
@@ -195,7 +196,7 @@ function TrackerStatus({ id, trackersFound }) {
195196
const other = status.value.trackerCompanies.slice(DDG_MAX_TRACKER_ICONS - 1);
196197
const companyIconsMax = other.length === 0 ? DDG_MAX_TRACKER_ICONS : DDG_MAX_TRACKER_ICONS - 1;
197198

198-
const icons = status.value.trackerCompanies.slice(0, companyIconsMax).map((item, index) => {
199+
const icons = status.value.trackerCompanies.slice(0, companyIconsMax).map((item, _index) => {
199200
return <CompanyIcon displayName={item.displayName} key={item} />;
200201
});
201202

special-pages/pages/new-tab/app/activity/components/ActivityItemAnimationWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function ActivityItemAnimationWrapper({ children, url }) {
3838
fill: 'both',
3939
easing: 'ease-in-out',
4040
});
41-
const handler = (e) => {
41+
const handler = (_) => {
4242
if (canceled) return;
4343
if (sent) return;
4444
sent = true;

special-pages/pages/new-tab/app/activity/integration-tests/activity.page.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ export class ActivityPage {
3030
this.ntp = ntp;
3131
}
3232

33-
/**
34-
* @param {object} params
35-
* @param {number} params.count
36-
*/
37-
async receive({ count }) {
33+
async receive() {
3834
/** @type {import("../../../types/new-tab.js").ActivityData} */
3935
const next = activityMocks.few;
4036
await this.ntp.mocks.simulateSubscriptionMessage('stats_onDataUpdate', next);

0 commit comments

Comments
 (0)