Skip to content

Commit 56d6d6a

Browse files
Update to our global eslint and other dependencies (#274)
* Update to our global eslint * Ignore node modules * Update lock * Update to node 20 * Update package log * Use node 22 * Update node actions * Update dependabot to update actions
1 parent 94794a7 commit 56d6d6a

File tree

24 files changed

+2397
-4119
lines changed

24 files changed

+2397
-4119
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ updates:
1111
eslint:
1212
patterns:
1313
- 'eslint*'
14+
- package-ecosystem: 'github-actions'
15+
directory: '/'
16+
schedule:
17+
interval: 'weekly'
18+
target-branch: 'main'
19+
labels:
20+
- 'dependencies'

.github/workflows/node.js.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@ jobs:
1414

1515
runs-on: ubuntu-latest
1616

17-
strategy:
18-
matrix:
19-
node-version: [16]
20-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21-
2217
steps:
23-
- uses: actions/checkout@v2
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v1
18+
- uses: actions/checkout@v4
19+
- name: Use Node.js
20+
uses: actions/setup-node@v4
2621
with:
27-
node-version: ${{ matrix.node-version }}
22+
node-version-file: '.nvmrc'
2823
- run: npm ci --ignore-scripts
2924
- run: npm run build --if-present
3025
- run: npm test

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
22

adClickFlow/ad/convert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function fireConvertPingStatus (status) {
66
window.dispatchEvent(new CustomEvent('resourceLoad', {
77
detail: {
88
url: pixelUrl.href,
9-
status: status
9+
status
1010
}
1111
}));
1212
}

adClickFlow/shared/utils.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function getAdUrl (id, hostname) {
3232
adUrl.searchParams.append('ID', id)
3333

3434
if (customRedirect) {
35-
adUrl.searchParams.append('customRedirect', ads[id]['customRedirect']);
35+
adUrl.searchParams.append('customRedirect', ads[id].customRedirect);
3636
}
3737

3838
// Build Search Redirection URL
@@ -72,7 +72,7 @@ function getAdUrl (id, hostname) {
7272
}
7373

7474
if (customRedirect) {
75-
searchUrl.searchParams.append('customRedirect', ads[id]['customRedirect']);
75+
searchUrl.searchParams.append('customRedirect', ads[id].customRedirect);
7676
}
7777

7878
// normal URLs use a different param, but we use 'u' here to avoid conflict with other params.
@@ -264,6 +264,7 @@ export function initializeBoilerplate () {
264264
const convertPixelUrl = new URL('/ping.gif', convertScriptUrl);
265265
const trackingPixelUrl = new URL('/ping.gif', trackingScriptUrl);
266266

267+
// eslint-disable-next-line no-new
267268
new FinishObserver([
268269
{
269270
url: convertScriptUrl,
@@ -332,7 +333,7 @@ export class FinishObserver {
332333
for (const resource of resources) {
333334
addUnique(resource.url);
334335
if (resource.subresources) {
335-
resource.subresources.every(subresource => {
336+
resource.subresources.forEach(subresource => {
336337
addUnique(subresource.url);
337338
if ('subresources' in subresource) {
338339
throw new Error('Child subresources are not supported');
@@ -344,7 +345,7 @@ export class FinishObserver {
344345

345346
this.observer = new PerformanceObserver((list) => {
346347
const entries = list.getEntries();
347-
entries.map((entry) => {
348+
entries.forEach((entry) => {
348349
// WebKit doesn't seem to support serverTiming for cross-origin loads
349350
if (entry.serverTiming && !isSafariOrDDG()) {
350351
if (entry.serverTiming.length === 0) {

eslint.config.mjs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import globals from 'globals';
2+
import ddgConfig from '@duckduckgo/eslint-config';
3+
import html from "@html-eslint/eslint-plugin";
4+
5+
const htmlRulesToDisable = Object.fromEntries(
6+
ddgConfig.flatMap(config => Object.keys(config.rules).map(rule => [rule, "off"]))
7+
);
8+
9+
export default [
10+
{
11+
ignores: [
12+
"privacy-protections/fingerprinting/helpers/diff.js",
13+
"node_modules/",
14+
]
15+
},
16+
...ddgConfig,
17+
{
18+
files: ["**/*.html"],
19+
plugins: {
20+
html,
21+
},
22+
language: "html/html",
23+
rules: {
24+
...htmlRulesToDisable
25+
}
26+
},
27+
{
28+
files: [
29+
"helpers/idb-wrapper.js",
30+
"privacy-protections/storage-partitioning/helpers/common.js",
31+
"privacy-protections/storage-partitioning/helpers/tests.js",
32+
"privacy-protections/fingerprinting/helpers/constants.js",
33+
"privacy-protections/storage-blocking/helpers/commonTests.js",
34+
"privacy-protections/storage-blocking/helpers/globals.js",
35+
"privacy-protections/fingerprinting/main.js",
36+
"privacy-protections/fingerprinting/helpers/canvas.js"
37+
],
38+
languageOptions: {
39+
sourceType: "script",
40+
},
41+
},
42+
{
43+
languageOptions: {
44+
globals: {
45+
...globals.commonjs,
46+
...globals.browser,
47+
...globals.jasmine,
48+
...globals.node,
49+
},
50+
},
51+
}
52+
];

0 commit comments

Comments
 (0)