Skip to content

Commit

Permalink
style: use prettier's default config
Browse files Browse the repository at this point in the history
  • Loading branch information
wescopeland committed Mar 3, 2024
1 parent 1d17e80 commit dd7ae72
Show file tree
Hide file tree
Showing 75 changed files with 379 additions and 387 deletions.
10 changes: 5 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = {
parserOptions: {
ecmaVersion: 2020,
sourceType: "module"
sourceType: "module",
},
env: {
browser: true,
node: true,
es6: true
es6: true,
},
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "simple-import-sort", "import"],
Expand All @@ -15,7 +15,7 @@ module.exports = {
"plugin:@typescript-eslint/recommended",
"plugin:sonarjs/recommended",
"plugin:unicorn/recommended",
"prettier"
"prettier",
],
rules: {
"@typescript-eslint/consistent-type-imports": "error",
Expand Down Expand Up @@ -47,6 +47,6 @@ module.exports = {
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-spread": "off",
"unicorn/prefer-switch": "off",
"unicorn/prevent-abbreviations": "off"
}
"unicorn/prevent-abbreviations": "off",
},
};
10 changes: 1 addition & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
{
"tabWidth": 2,
"printWidth": 80,
"trailingComma": "none",
"semi": true,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true
}
{}
2 changes: 1 addition & 1 deletion commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('@commitlint/types').UserConfig} */
module.exports = {
extends: ["@commitlint/config-conventional"]
extends: ["@commitlint/config-conventional"],
};
2 changes: 1 addition & 1 deletion src/__playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const main = async () => {
const authorization = buildAuthorization({ userName, webApiKey });

const achievementCount = await getAchievementCount(authorization, {
gameId: 14_402
gameId: 14_402,
});
console.log(achievementCount);
};
Expand Down
20 changes: 10 additions & 10 deletions src/achievement/getAchievementUnlocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Function: getAchievementUnlocks", () => {
// ARRANGE
const authorization = buildAuthorization({
userName: "mockUserName",
webApiKey: "mockWebApiKey"
webApiKey: "mockWebApiKey",
});

const mockResponse: GetAchievementUnlocksResponse = {
Expand All @@ -35,7 +35,7 @@ describe("Function: getAchievementUnlocks", () => {
TrueRatio: "6",
Author: "Scott",
DateCreated: "2012-11-02 00:03:12",
DateModified: "2022-06-11 16:52:35"
DateModified: "2022-06-11 16:52:35",
},
Console: { ID: "1", Title: "Mega Drive" },
Game: { ID: "1", Title: "Sonic the Hedgehog" },
Expand All @@ -46,9 +46,9 @@ describe("Function: getAchievementUnlocks", () => {
User: "Tiotroll2022",
RAPoints: "348",
DateAwarded: "2023-01-29 21:45:41",
HardcoreMode: "0"
}
]
HardcoreMode: "0",
},
],
};

let requestUrl = "";
Expand All @@ -64,7 +64,7 @@ describe("Function: getAchievementUnlocks", () => {
const response = await getAchievementUnlocks(authorization, {
achievementId: 18_000,
count: 1,
offset: 1
offset: 1,
});

// ASSERT
Expand All @@ -81,7 +81,7 @@ describe("Function: getAchievementUnlocks", () => {
trueRatio: 6,
author: "Scott",
dateCreated: "2012-11-02 00:03:12",
dateModified: "2022-06-11 16:52:35"
dateModified: "2022-06-11 16:52:35",
},
console: { id: 1, title: "Mega Drive" },
game: { id: 1, title: "Sonic the Hedgehog" },
Expand All @@ -92,9 +92,9 @@ describe("Function: getAchievementUnlocks", () => {
user: "Tiotroll2022",
raPoints: 348,
dateAwarded: "2023-01-29 21:45:41",
hardcoreMode: false
}
]
hardcoreMode: false,
},
],
});
});
});
6 changes: 3 additions & 3 deletions src/achievement/getAchievementUnlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {
apiBaseUrl,
buildRequestUrl,
call,
serializeProperties
serializeProperties,
} from "../utils/internal";
import type { AuthObject } from "../utils/public";
import type {
AchievementUnlocksMetadata,
GetAchievementUnlocksResponse
GetAchievementUnlocksResponse,
} from "./models";

/**
Expand Down Expand Up @@ -76,6 +76,6 @@ export const getAchievementUnlocks = async (

return serializeProperties(rawResponse, {
shouldCastToNumbers: ["ID", "Points", "TrueRatio", "RAPoints"],
shouldMapToBooleans: ["HardcoreMode"]
shouldMapToBooleans: ["HardcoreMode"],
});
};
18 changes: 9 additions & 9 deletions src/console/getConsoleIds.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ describe("Function: getConsoleIds", () => {
// ARRANGE
const authorization = buildAuthorization({
userName: "mockUserName",
webApiKey: "mockWebApiKey"
webApiKey: "mockWebApiKey",
});

const mockResponse: GetConsoleIdsResponse = [
{
ID: "1",
Name: "Mega Drive",
IconURL:
"https://static.retroachievements.org/assets/images/system/md.png"
"https://static.retroachievements.org/assets/images/system/md.png",
},
{
ID: "2",
Name: "Nintendo 64",
IconURL:
"https://static.retroachievements.org/assets/images/system/n64.png"
"https://static.retroachievements.org/assets/images/system/n64.png",
},
{
ID: "3",
Name: "SNES",
IconURL:
"https://static.retroachievements.org/assets/images/system/snes.png"
}
"https://static.retroachievements.org/assets/images/system/snes.png",
},
];

server.use(
Expand All @@ -64,20 +64,20 @@ describe("Function: getConsoleIds", () => {
id: 1,
name: "Mega Drive",
iconUrl:
"https://static.retroachievements.org/assets/images/system/md.png"
"https://static.retroachievements.org/assets/images/system/md.png",
},
{
id: 2,
name: "Nintendo 64",
iconUrl:
"https://static.retroachievements.org/assets/images/system/n64.png"
"https://static.retroachievements.org/assets/images/system/n64.png",
},
{
id: 3,
name: "SNES",
iconUrl:
"https://static.retroachievements.org/assets/images/system/snes.png"
}
"https://static.retroachievements.org/assets/images/system/snes.png",
},
];

expect(response).toEqual(expectedResponse);
Expand Down
4 changes: 2 additions & 2 deletions src/console/getConsoleIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
apiBaseUrl,
buildRequestUrl,
call,
serializeProperties
serializeProperties,
} from "../utils/internal";
import type { AuthObject } from "../utils/public";
import type { ConsoleId, GetConsoleIdsResponse } from "./models";
Expand Down Expand Up @@ -42,6 +42,6 @@ export const getConsoleIds = async (
const rawResponse = await call<GetConsoleIdsResponse>({ url });

return serializeProperties(rawResponse, {
shouldCastToNumbers: ["ID"]
shouldCastToNumbers: ["ID"],
});
};
16 changes: 8 additions & 8 deletions src/console/getGameList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("Function: getGameList", () => {
// ARRANGE
const authorization = buildAuthorization({
userName: "mockUserName",
webApiKey: "mockWebApiKey"
webApiKey: "mockWebApiKey",
});

const mockResponse: GetGameListResponse = [
Expand All @@ -42,9 +42,9 @@ describe("Function: getGameList", () => {
ForumTopicID: 1972,
Hashes: [
"32e1a15161ef1f070b023738353bde51",
"9b04970a603ace521c7cca2acaf69804"
]
}
"9b04970a603ace521c7cca2acaf69804",
],
},
];

server.use(
Expand All @@ -56,7 +56,7 @@ describe("Function: getGameList", () => {
// ACT
const response = await getGameList(authorization, {
consoleId: 1,
shouldRetrieveGameHashes: true
shouldRetrieveGameHashes: true,
});

// ASSERT
Expand All @@ -74,9 +74,9 @@ describe("Function: getGameList", () => {
forumTopicId: 1972,
hashes: [
"32e1a15161ef1f070b023738353bde51",
"9b04970a603ace521c7cca2acaf69804"
]
}
"9b04970a603ace521c7cca2acaf69804",
],
},
]);
});
});
8 changes: 4 additions & 4 deletions src/console/getGameList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
apiBaseUrl,
buildRequestUrl,
call,
serializeProperties
serializeProperties,
} from "../utils/internal";
import type { AuthObject } from "../utils/public";
import type { GameList, GetGameListResponse } from "./models";
Expand Down Expand Up @@ -63,15 +63,15 @@ export const getGameList = async (
const {
consoleId,
shouldOnlyRetrieveGamesWithAchievements,
shouldRetrieveGameHashes
shouldRetrieveGameHashes,
} = payload;

let callPayload: Record<string, any> = { i: consoleId };

if (shouldOnlyRetrieveGamesWithAchievements !== undefined) {
callPayload = {
...callPayload,
f: shouldOnlyRetrieveGamesWithAchievements ? 1 : 0
f: shouldOnlyRetrieveGamesWithAchievements ? 1 : 0,
};
}

Expand All @@ -89,6 +89,6 @@ export const getGameList = async (
const rawResponse = await call<GetGameListResponse>({ url });

return serializeProperties(rawResponse, {
shouldCastToNumbers: ["ID", "ConsoleID"]
shouldCastToNumbers: ["ID", "ConsoleID"],
});
};
Loading

0 comments on commit dd7ae72

Please sign in to comment.