Skip to content

Commit

Permalink
chore(deps): update dependency eslint-config-prettier to v7 (#313)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency eslint-config-prettier to v7

* chore(deps): update dependency eslint-config-prettier to v7

* chore(eslint): update for arrow-body-style rule

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: hoonoh <[email protected]>
  • Loading branch information
3 people authored Dec 9, 2020
1 parent 786f308 commit e857575
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 66 deletions.
20 changes: 6 additions & 14 deletions .pnp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"cz-conventional-changelog": "3.3.0",
"eslint": "7.15.0",
"eslint-config-airbnb-typescript": "12.0.0",
"eslint-config-prettier": "6.15.0",
"eslint-config-prettier": "7.0.0",
"eslint-import-resolver-typescript": "2.3.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "24.1.3",
Expand Down
4 changes: 1 addition & 3 deletions scripts/generate-ec2-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import { getEc2Info } from '../src/lib/core';
(async () => {
const res = (
await Promise.all(defaultRegions.map(async region => getEc2Info({ region, log: true })))
).reduce((rtn, cur) => {
return { ...rtn, ...cur };
}, {} as { vCpu?: number; memoryGiB?: number });
).reduce((rtn, cur) => ({ ...rtn, ...cur }), {} as { vCpu?: number; memoryGiB?: number });
const sorted = Object.fromEntries(Object.entries(res).sort(([a], [b]) => -(a < b)));
console.log(`found ${Object.keys(sorted).length} instance types`);

Expand Down
49 changes: 27 additions & 22 deletions scripts/generate-spot-prices-mock-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,35 @@ const { argv } = yargs()
console.log('fetched total:', allPrices.length);

// check for any duplicates
const unique = uniqWith(allPrices, (val1: EC2.SpotPrice, val2: EC2.SpotPrice) => {
return (
const unique = uniqWith(
allPrices,
(val1: EC2.SpotPrice, val2: EC2.SpotPrice) =>
val1.AvailabilityZone === val2.AvailabilityZone &&
val1.InstanceType === val2.InstanceType &&
val1.ProductDescription === val2.ProductDescription
);
});
val1.ProductDescription === val2.ProductDescription,
);
console.log('unique total:', unique.length);

if (args.processDetail) {
const uniqueProductDescription = uniqWith(
allPrices,
(val1: EC2.SpotPrice, val2: EC2.SpotPrice) => {
return val1.ProductDescription === val2.ProductDescription;
},
(val1: EC2.SpotPrice, val2: EC2.SpotPrice) =>
val1.ProductDescription === val2.ProductDescription,
);
const uniqueType = uniqWith(
allPrices,
(val1: EC2.SpotPrice, val2: EC2.SpotPrice) => val1.InstanceType === val2.InstanceType,
);
const uniqueFamily = uniqWith(
allPrices,
(val1: EC2.SpotPrice, val2: EC2.SpotPrice) =>
val1.InstanceType?.split('.').shift() === val2.InstanceType?.split('.').shift(),
);
const uniqueSize = uniqWith(
allPrices,
(val1: EC2.SpotPrice, val2: EC2.SpotPrice) =>
val1.InstanceType?.split('.').pop() === val2.InstanceType?.split('.').pop(),
);
const uniqueType = uniqWith(allPrices, (val1: EC2.SpotPrice, val2: EC2.SpotPrice) => {
return val1.InstanceType === val2.InstanceType;
});
const uniqueFamily = uniqWith(allPrices, (val1: EC2.SpotPrice, val2: EC2.SpotPrice) => {
return val1.InstanceType?.split('.').shift() === val2.InstanceType?.split('.').shift();
});
const uniqueSize = uniqWith(allPrices, (val1: EC2.SpotPrice, val2: EC2.SpotPrice) => {
return val1.InstanceType?.split('.').pop() === val2.InstanceType?.split('.').pop();
});
console.log('uniqueType total:', uniqueType.length);
console.log('uniqueProductDescription total:', uniqueProductDescription.length);
console.log('uniqueFamily total:', uniqueFamily.length);
Expand All @@ -92,13 +96,14 @@ const { argv } = yargs()
// compare with previous
const prevList = JSON.parse(readFileSync(jsonPath).toString('utf8'));

const xor = xorWith(unique, prevList, (val1: EC2.SpotPrice, val2: EC2.SpotPrice) => {
return (
const xor = xorWith(
unique,
prevList,
(val1: EC2.SpotPrice, val2: EC2.SpotPrice) =>
val1.AvailabilityZone === val2.AvailabilityZone &&
val1.InstanceType === val2.InstanceType &&
val1.ProductDescription === val2.ProductDescription
);
});
val1.ProductDescription === val2.ProductDescription,
);
console.log('xor total:', xor.length);
const xorPrev: EC2.SpotPrice[] = [];
const xorCur: EC2.SpotPrice[] = [];
Expand Down
5 changes: 2 additions & 3 deletions src/constants/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ export const platformWildcards = {

export type PlatformsWildcards = keyof typeof platformWildcards;

export const instanceOfPlatforms = (pd: string): pd is Platform => {
return allPlatforms.includes(pd as Platform);
};
export const instanceOfPlatforms = (pd: string): pd is Platform =>
allPlatforms.includes(pd as Platform);
8 changes: 4 additions & 4 deletions src/lib/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ export const getGlobalSpotPrices = async (options?: {
}),
);
})
.then(results => {
return results
.then(results =>
results
.filter(
// filter out info without region or price greater than priceLimit
info => {
Expand All @@ -431,8 +431,8 @@ export const getGlobalSpotPrices = async (options?: {
return true;
},
)
.sort(sortSpotPriceExtended);
});
.sort(sortSpotPriceExtended),
);

// limit output
if (limit && rtn.length > limit) rtn.splice(limit);
Expand Down
7 changes: 4 additions & 3 deletions test/mock-ec2-endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ const data = JSON.parse(
type RegionalData = { [region in Region]: SpotPrice[] };

const regionalData: RegionalData = allRegions.reduce((list, region) => {
list[region] = filter(data, (o: SpotPrice) => {
return o.AvailabilityZone && o.AvailabilityZone.startsWith(region);
});
list[region] = filter(
data,
(o: SpotPrice) => o.AvailabilityZone && o.AvailabilityZone.startsWith(region),
);
return list;
}, {} as RegionalData);

Expand Down
23 changes: 7 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3128,7 +3128,7 @@ __metadata:
cz-conventional-changelog: 3.3.0
eslint: 7.15.0
eslint-config-airbnb-typescript: 12.0.0
eslint-config-prettier: 6.15.0
eslint-config-prettier: 7.0.0
eslint-import-resolver-typescript: 2.3.0
eslint-plugin-import: 2.22.1
eslint-plugin-jest: 24.1.3
Expand Down Expand Up @@ -5470,16 +5470,14 @@ __metadata:
languageName: node
linkType: hard

"eslint-config-prettier@npm:6.15.0":
version: 6.15.0
resolution: "eslint-config-prettier@npm:6.15.0"
dependencies:
get-stdin: ^6.0.0
"eslint-config-prettier@npm:7.0.0":
version: 7.0.0
resolution: "eslint-config-prettier@npm:7.0.0"
peerDependencies:
eslint: ">=3.14.1"
eslint: ">=7.0.0"
bin:
eslint-config-prettier-check: bin/cli.js
checksum: a790bc61699e43a2edc5453488576cd977fad3b3cf99c129c10760ce6970d422923fddf80b65b2b10a93c00af0180a854e4b7824cc268e5957826cbe5b969e90
eslint-config-prettier: bin/cli.js
checksum: b7c543080e32829dba5f3db970c5f3c3b47f1de8df89b4226105afbecae561e026b6fe9f2cb16bf08ab1a6f1f544d9303c9c8c0919cbb51a9d2c8a640779624a
languageName: node
linkType: hard

Expand Down Expand Up @@ -6566,13 +6564,6 @@ fsevents@^2.1.2:
languageName: node
linkType: hard

"get-stdin@npm:^6.0.0":
version: 6.0.0
resolution: "get-stdin@npm:6.0.0"
checksum: b51d664838aef7f8353dc57371ce59cea54d8d584fec015a9d89d24561e95b97806d5b5ba120bc81574c9ed63cb3e210176ffa0ff9263c7e7ba4d56d0fe54913
languageName: node
linkType: hard

"get-stream@npm:^3.0.0":
version: 3.0.0
resolution: "get-stream@npm:3.0.0"
Expand Down

0 comments on commit e857575

Please sign in to comment.