diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b4545dd..2d3077f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM denoland/deno:2.4.5 +FROM denoland/deno:2.4.3 # Install tools RUN apt-get update && \ diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index f348f33..121b579 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -17,10 +17,10 @@ jobs: with: fetch-depth: 0 - - name: Setup Deno v2.5.2 + - name: Setup Deno v2.5.3 uses: denoland/setup-deno@v2 with: - deno-version: v2.5.2 + deno-version: v2.5.3 - name: Setup LCOV run: sudo apt install -y lcov @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - deno-version: [v1.46.3, v2.5.2] + deno-version: [v1.46.3, v2.5.3] os: [ ubuntu-latest, windows-latest ] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index faae352..c86f38e 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -33,10 +33,10 @@ jobs: ref: ${{ steps.pr.outputs.head_sha }} fetch-depth: 0 - - name: Setup Deno v2.5.2 + - name: Setup Deno v2.5.3 uses: denoland/setup-deno@v2 with: - deno-version: v2.5.2 + deno-version: v2.5.3 - name: Setup LCOV run: sudo apt install -y lcov diff --git a/src/lib/remoteAuth.ts b/src/lib/remoteAuth.ts index b551f82..7f00840 100644 --- a/src/lib/remoteAuth.ts +++ b/src/lib/remoteAuth.ts @@ -18,7 +18,7 @@ export class Auth { static setRetryOptions(silentMode: string) { this.retryOptions = { - retryTime: parseInt(silentMode.slice(0, -1)), + retryTime: Number.parseInt(silentMode.slice(0, -1)), retryDurationIn: silentMode.slice(-1), }; } diff --git a/src/lib/snapshot.ts b/src/lib/snapshot.ts index 3632b6d..21581f3 100644 --- a/src/lib/snapshot.ts +++ b/src/lib/snapshot.ts @@ -120,7 +120,7 @@ export const checkSwitchersLocal = (snapshot: Snapshot, switcherKeys: string[]) found = false; const { config } = g; - if (config.find((c: { key: string }) => c.key === switcher)) { + if (config.some((c: { key: string }) => c.key === switcher)) { found = true; break; } @@ -177,7 +177,7 @@ function processNETWORK_Exist( cidrRegex: RegExp, ) { for (const value of values) { - if (RegExp(cidrRegex).exec(value)) { + if (cidrRegex.exec(value)) { const cidr = new IPCIDR(value); if (cidr.isIp4InCidr(input)) { return true; @@ -195,7 +195,7 @@ function processNETWORK_NotExist( cidrRegex: RegExp, ) { const result = values.filter((element) => { - if (RegExp(cidrRegex).exec(element)) { + if (cidrRegex.exec(element)) { const cidr = new IPCIDR(element); if (cidr.isIp4InCidr(input)) { return true; @@ -301,7 +301,7 @@ function processPAYLOAD(operation: string, input: string, values: string[]) { const keys = payloadReader(inputJson); switch (operation) { case OperationsType.HAS_ONE: - return keys.filter((key) => values.includes(key)).length > 0; + return keys.some((key) => values.includes(key)); case OperationsType.HAS_ALL: return values.every((element) => keys.includes(element)); } diff --git a/src/lib/utils/ipcidr.ts b/src/lib/utils/ipcidr.ts index bb10ed8..2783b43 100644 --- a/src/lib/utils/ipcidr.ts +++ b/src/lib/utils/ipcidr.ts @@ -6,7 +6,7 @@ export default class IPCIDR { } private ip4ToInt(ip: string) { - return ip.split('.').reduce((int, oct) => (int << 8) + parseInt(oct, 10), 0) >>> 0; + return ip.split('.').reduce((int, oct) => (int << 8) + Number.parseInt(oct, 10), 0) >>> 0; } isIp4InCidr(ip: string) { diff --git a/src/lib/utils/payloadReader.ts b/src/lib/utils/payloadReader.ts index 9c02a02..3f6aa32 100644 --- a/src/lib/utils/payloadReader.ts +++ b/src/lib/utils/payloadReader.ts @@ -12,7 +12,7 @@ export function payloadReader(payload: any): string[] { ...payloadReader(payload[field]) .map((nestedField) => `${field}.${nestedField}`), ]) - .filter((field) => isNaN(Number(field))) + .filter((field) => Number.isNaN(Number(field))) .reduce((acc: string[], curr) => { if (!acc.includes(curr)) { acc.push(curr); diff --git a/src/lib/utils/timed-match/match.ts b/src/lib/utils/timed-match/match.ts index 5e04c8b..3349f7f 100644 --- a/src/lib/utils/timed-match/match.ts +++ b/src/lib/utils/timed-match/match.ts @@ -1,7 +1,7 @@ export default function tryMatch(values: string[], input: string): boolean { let result = false; for (const value of values) { - if (RegExp(value).exec(input)) { + if (new RegExp(value).exec(input)) { result = true; break; }