Skip to content

Commit f529bed

Browse files
committed
chore: update Typescript version to 6
1 parent ad4faa0 commit f529bed

File tree

13 files changed

+60
-42
lines changed

13 files changed

+60
-42
lines changed

builder/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212
"@types/node": "^24.12.0"
1313
},
1414
"devDependencies": {
15-
"@adguard/agtree": "^4.0.1",
15+
"@adguard/agtree": "^4.0.4",
1616
"@npmcli/package-json": "^7.0.5",
1717
"@types/npmcli__package-json": "^4.0.4",
1818
"@types/semver": "^7.7.1",
19-
"@typescript-eslint/eslint-plugin": "^8.57.0",
20-
"@typescript-eslint/parser": "^8.57.0",
19+
"@typescript-eslint/eslint-plugin": "^8.58.0",
20+
"@typescript-eslint/parser": "^8.58.0",
2121
"@typescriptprime/parsing": "^2.0.0",
2222
"@typescriptprime/securereq": "^1.2.0",
2323
"chokidar": "^5.0.0",
24-
"esbuild": "^0.27.3",
25-
"eslint": "^10.0.3",
24+
"esbuild": "^0.27.4",
25+
"eslint": "^10.1.0",
2626
"semver": "^7.7.4",
27-
"tldts": "^7.0.25",
27+
"tldts": "^7.0.27",
2828
"tsx": "^4.21.0",
29-
"typescript": "^5.9.3",
30-
"typescript-eslint": "^8.57.0",
29+
"typescript": "^6.0.2",
30+
"typescript-eslint": "^8.58.0",
3131
"zod": "^4.3.6"
3232
}
3333
}

builder/source/debug.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Build } from './build.js'
88
import { SafeInitCwd } from './utils/safe-init-cwd.js'
99

1010
let ProjectRoot = SafeInitCwd({ Cwd: Process.cwd(), InitCwd: Process.env.INIT_CWD })
11-
const WatchingGlob = [];
11+
const WatchingGlob: string[] = [];
1212
['builder/', 'userscript/', ''].forEach(Dir => {
1313
WatchingGlob.push(...Fs.globSync(`${ProjectRoot}/${Dir}source/**/*.ts`))
1414
WatchingGlob.push(...Fs.globSync(`${ProjectRoot}/${Dir}source/**/*.json`))
@@ -18,11 +18,13 @@ const Watcher = Chokidar.watch([...WatchingGlob], {
1818
ignored: '**/node_modules/**',
1919
})
2020

21-
let BuildCooldownTimer: NodeJS.Timeout = null
21+
let BuildCooldownTimer: NodeJS.Timeout | null = null
2222
let ShouldPreventHTTPResponse = false
2323
let Version: number = 0
2424
Watcher.on('all', async (WatcherEvent, WatcherPath) => {
25-
clearTimeout(BuildCooldownTimer)
25+
if (BuildCooldownTimer) {
26+
clearTimeout(BuildCooldownTimer)
27+
}
2628
BuildCooldownTimer = setTimeout(async () => {
2729
console.log(`Detected file change (${WatcherEvent}):`, WatcherPath)
2830
ShouldPreventHTTPResponse = true

builder/source/references/filterslists/ADG.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export async function IndexAdShieldDomainsFromAG(): Promise<Set<string>> {
1414
let StartingLine = -1
1515
let EndingLine = -1
1616
for (const [Index, Filter] of AGTreeFiltersList.children.entries()) {
17-
if (Filter.category === 'Comment' && typeof Filter.raws.text === 'string' && Filter.raws.text.includes(AGBaseFilterListAdShieldKeys.Starting)) {
17+
if (Filter.category === 'Comment' && typeof Filter.raws?.text === 'string' && Filter.raws?.text.includes(AGBaseFilterListAdShieldKeys.Starting)) {
1818
StartingLine = Index
19-
} else if (Filter.category === 'Comment' && typeof Filter.raws.text === 'string' && Filter.raws.text.includes(AGBaseFilterListAdShieldKeys.Ending)) {
19+
} else if (Filter.category === 'Comment' && typeof Filter.raws?.text === 'string' && Filter.raws?.text.includes(AGBaseFilterListAdShieldKeys.Ending)) {
2020
EndingLine = Index
2121
} else if (StartingLine !== -1 && EndingLine !== -1) {
2222
break
@@ -33,8 +33,10 @@ export async function IndexAdShieldDomainsFromAG(): Promise<Set<string>> {
3333
} else if (Filter.category === 'Cosmetic' && Filter.type === 'JsInjectionRule') {
3434
Filter.domains.children.forEach(Domain => AdShieldDomains.add(Domain.value))
3535
} else if (Filter.category === 'Network' && Filter.type === 'NetworkRule' && typeof Filter.modifiers !== 'undefined' && Filter.modifiers.children.some(M => M.name.value === 'domain')) {
36-
let DomainValue = Filter.modifiers.children.find(M => M.name.value === 'domain').value.value
37-
DomainValue.split('|').forEach(Domain => AdShieldDomains.add(Domain))
36+
const DomainModifier = Filter.modifiers.children.find(M => M.name.value === 'domain')
37+
if (typeof DomainModifier?.value?.value === 'string') {
38+
DomainModifier.value.value.split('|').forEach(Domain => AdShieldDomains.add(Domain))
39+
}
3840
}
3941
}
4042

builder/source/references/filterslists/uBO.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export async function IndexAdShieldDomainsFromUBO(): Promise<Set<string>> {
1414
let StartingLine = -1
1515
let EndingLine = -1
1616
for (const [Index, Filter] of AGTreeFiltersList.children.entries()) {
17-
if (Filter.category === 'Comment' && typeof Filter.raws.text === 'string' && Filter.raws.text.includes(UBOFilterListAdShieldKeys.Starting)) {
17+
if (Filter.category === 'Comment' && typeof Filter.raws?.text === 'string' && Filter.raws.text.includes(UBOFilterListAdShieldKeys.Starting)) {
1818
StartingLine = Index
19-
} else if (Filter.category === 'Comment' && typeof Filter.raws.text === 'string' && Filter.raws.text.includes(UBOFilterListAdShieldKeys.Ending)) {
19+
} else if (Filter.category === 'Comment' && typeof Filter.raws?.text === 'string' && Filter.raws.text.includes(UBOFilterListAdShieldKeys.Ending)) {
2020
EndingLine = Index
2121
} else if (StartingLine !== -1 && EndingLine !== -1) {
2222
break
@@ -33,8 +33,10 @@ export async function IndexAdShieldDomainsFromUBO(): Promise<Set<string>> {
3333
} else if (Filter.category === 'Cosmetic' && Filter.type === 'JsInjectionRule') {
3434
Filter.domains.children.forEach(Domain => AdShieldDomains.add(Domain.value))
3535
} else if (Filter.category === 'Network' && Filter.type === 'NetworkRule' && typeof Filter.modifiers !== 'undefined' && Filter.modifiers.children.some(M => M.name.value === 'domain')) {
36-
let DomainValue = Filter.modifiers.children.find(M => M.name.value === 'domain').value.value
37-
DomainValue.split('|').forEach(Domain => AdShieldDomains.add(Domain))
36+
const DomainModifier = Filter.modifiers.children.find(M => M.name.value === 'domain')
37+
if (typeof DomainModifier?.value?.value === 'string') {
38+
DomainModifier.value.value.split('|').forEach(Domain => AdShieldDomains.add(Domain))
39+
}
3840
}
3941
}
4042

builder/source/references/iabsellers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { HTTPSRequest } from '@typescriptprime/securereq'
55
const IABSellersJsonURL = 'https://info.ad-shield.io/sellers.json'
66

77
export async function FetchIABSellersJsonData(): Promise<string[]> {
8-
const IABSellersJsonResponse: { StatusCode: number, Headers: Record<string, string | string[]>, Body: unknown } = await HTTPSRequest(new URL(IABSellersJsonURL), { ExpectedAs: 'JSON' })
9-
let IABSellersJsonData =IABSellersJsonResponse.Body as {
8+
const IABSellersJsonResponse = await HTTPSRequest(new URL(IABSellersJsonURL), { ExpectedAs: 'JSON' })
9+
let IABSellersJsonData = IABSellersJsonResponse.Body as {
1010
// eslint-disable-next-line @typescript-eslint/naming-convention
1111
sellers: Array<{
1212
// eslint-disable-next-line @typescript-eslint/naming-convention

builder/source/utils/http-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as Process from 'node:process'
44
import * as Path from 'node:path'
55
import { SafeInitCwd } from './safe-init-cwd.js'
66

7-
function IsLoopBack(IP: string) {
7+
function IsLoopBack(IP?: string) {
88
return IP === '127.0.0.1' || IP === '::1' || IP === '::ffff:127.0.0.1'
99
}
1010

builder/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
"include": [
44
"source/**/*.ts",
55
"test/**/*.ts"
6-
]
6+
],
7+
"compilerOptions": {
8+
"types": ["node"]
9+
}
710
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
"builder"
3333
],
3434
"devDependencies": {
35-
"@typescript-eslint/eslint-plugin": "^8.57.0",
36-
"@typescript-eslint/parser": "^8.57.0",
37-
"eslint": "^10.0.3",
38-
"typescript-eslint": "^8.57.0"
35+
"@typescript-eslint/eslint-plugin": "^8.58.0",
36+
"@typescript-eslint/parser": "^8.58.0",
37+
"eslint": "^10.1.0",
38+
"typescript-eslint": "^8.58.0"
3939
}
4040
}

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"target": "ES2024",
55
"moduleResolution": "NodeNext",
66
"removeComments": false,
7-
"alwaysStrict": false,
87
"skipLibCheck": true,
98
"paths": {
109
"@builder/*": ["./builder/source/*"],

userscript/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
},
88
"devDependencies": {
99
"@types/web": "^0.0.342",
10-
"@typescript-eslint/eslint-plugin": "^8.57.0",
11-
"@typescript-eslint/parser": "^8.57.0",
12-
"eslint": "^10.0.3",
13-
"typescript-eslint": "^8.57.0"
10+
"@typescript-eslint/eslint-plugin": "^8.58.0",
11+
"@typescript-eslint/parser": "^8.58.0",
12+
"eslint": "^10.1.0",
13+
"typescript-eslint": "^8.58.0"
14+
},
15+
"dependencies": {
16+
"typescript": "^6.0.2"
1417
}
1518
}

0 commit comments

Comments
 (0)