Skip to content

Commit

Permalink
Update Rollup, Jest, Typescript, EsLint
Browse files Browse the repository at this point in the history
1. Newer tools are better
2. Required to support native-NodeJS fetch in Jest (for FiatApi tests)
  • Loading branch information
sisou committed Jan 25, 2024
1 parent 69d2d16 commit 10fa0d3
Show file tree
Hide file tree
Showing 10 changed files with 2,851 additions and 3,020 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,11 @@ module.exports = {
'no-param-reassign': 'off',
'import/no-unresolved': 'off',
'no-use-before-define': 'off',
'no-shadow': 'off',
'no-dupe-class-members': 'off',
'no-undef': 'off',

// Allow importing TS files without extension, as Rollup takes care of that
'import/extensions': 'off',
},
};
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
/** @type {import('jest').Config} */
const config = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
};

module.exports = config;
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@
"big-integer": "^1.6.44"
},
"devDependencies": {
"@types/jest": "^24.0.23",
"@typescript-eslint/eslint-plugin": "^2.7.0",
"@typescript-eslint/parser": "^2.7.0",
"eslint": "^6.6.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.18.2",
"jest": "^24.9.0",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.29.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"rimraf": "^2.6.3",
"rollup": "^0.64.0",
"ts-jest": "^24.1.0",
"typescript": "^3.2.0"
"rollup": "^4.9.6",
"ts-jest": "^29.1.2",
"typescript": "^4.3.0"
}
}
1 change: 0 additions & 1 deletion rollup.config.js → rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ export default {
sourcemap: true
}
],
experimentalCodeSplitting: true
};
6 changes: 3 additions & 3 deletions src/currency-info/CurrencyInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class CurrencyInfo {
public readonly decimals!: number;
public readonly locale: string;

/* eslint-disable no-dupe-class-members, lines-between-class-members */
/* eslint-disable lines-between-class-members */
/**
* This constructor is convenient when manually defining a CurrencyInfo or when no locale is to be specified.
* @constructor
Expand Down Expand Up @@ -359,7 +359,7 @@ export class CurrencyInfo {
const cacheKey = `${this.code} ${this.locale}`;
const cachedCurrencyInfo = CurrencyInfo.CACHED_AUTO_GENERATED_CURRENCY_INFOS[cacheKey];
if (isAutoGenerated && cachedCurrencyInfo) {
return cachedCurrencyInfo;
return cachedCurrencyInfo; // eslint-disable-line no-constructor-return
}

let formattedString;
Expand Down Expand Up @@ -460,5 +460,5 @@ export class CurrencyInfo {
CurrencyInfo.CACHED_AUTO_GENERATED_CURRENCY_INFOS[cacheKey] = this;
}
}
/* eslint-enable no-dupe-class-members, lines-between-class-members */
/* eslint-enable lines-between-class-members */
}
2 changes: 1 addition & 1 deletion src/fiat-api/FiatApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ async function _fetch(input: RequestInfo, init?: RequestInit): Promise<any> {
// be resolved in random order.
if (retry) {
// eslint-disable-next-line no-await-in-loop
await new Promise((resolve) => setTimeout(resolve, 15000));
await new Promise((resolve) => { setTimeout(resolve, 15000); });
} else {
throw e;
}
Expand Down
2 changes: 1 addition & 1 deletion src/request-link-encoding/RequestLinkEncoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ function parseUnsignedInteger(value: string): number | bigint {
// Non-integer, non-safe integer larger than Number.MAX_SAFE_INTEGER or NaN (which it can't really be as
// toNonScientificNumberString parses only valid numbers). Try parsing again as bigint, which supports integers
// above Number.MAX_SAFE_INTEGER, and throws for actual invalid or non-integer numbers.
result = BigInt(value); // eslint-disable-line no-undef
result = BigInt(value);
}
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions src/utf8-tools/Utf8Tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class Utf8Tools {
return i === bytes.length;
}

/* eslint-disable lines-between-class-members, no-dupe-class-members */
/* eslint-disable lines-between-class-members */
public static truncateToUtf8ByteLength(input: string, length: number, applyEllipsis?: boolean)
: { result: string, didTruncate: boolean };
public static truncateToUtf8ByteLength(input: Uint8Array, length: number, applyEllipsis?: boolean)
Expand Down Expand Up @@ -257,5 +257,5 @@ export class Utf8Tools {
didTruncate: true,
};
}
/* eslint-enable lines-between-class-members, no-dupe-class-members */
/* eslint-enable lines-between-class-members */
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"dom",
"dom.iterable",
"scripthost"
]
],
"skipLibCheck": true,
},
"include": [
"src/**/*.ts",
Expand Down
Loading

0 comments on commit 10fa0d3

Please sign in to comment.