Skip to content

Commit

Permalink
ESLint Fix + Balance Method Name Change
Browse files Browse the repository at this point in the history
  • Loading branch information
raphckrman committed Mar 2, 2024
1 parent 68216ad commit 1d2f97c
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 50 deletions.
64 changes: 32 additions & 32 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
module.exports = [
{ // Apply to `cjs`, `.mjs` and `.js` files.
files: ["**/*.?([cm])js"]
},
{ // Apply to `cts`, `.mts` and `.ts` files.
files: ["**/*.?([cm])ts"],
languageOptions: {
parser: require("@typescript-eslint/parser"),
parserOptions: {
sourceType: "module"
}
{ // Apply to `cjs`, `.mjs` and `.js` files.
files: ["**/*.?([cm])js"]
},
{ // Apply to `cts`, `.mts` and `.ts` files.
files: ["**/*.?([cm])ts"],
languageOptions: {
parser: require("@typescript-eslint/parser"),
parserOptions: {
sourceType: "module"
}
}
},
{
ignores: ["dist/**", "docs/.astro/**", "docs/dist/**"],
plugins: {
stylistic: require("@stylistic/eslint-plugin")
},
{
ignores: ["dist/**", "docs/.astro/**", "docs/dist/**"],
plugins: {
stylistic: require("@stylistic/eslint-plugin")
},
rules: {
"stylistic/indent": ["error", 2],
"stylistic/semi": ["error", "always"],
"stylistic/eol-last": ["error", "always"],
"stylistic/quotes": ["error", "double"],
"stylistic/dot-location": ["error", "property"],
"stylistic/array-bracket-spacing": ["error", "never"],
"stylistic/arrow-parens": ["error", "always"],
"stylistic/arrow-spacing": "error",
"stylistic/block-spacing": ["error", "always"],
"stylistic/brace-style": ["error", "stroustrup"],
"stylistic/comma-dangle": ["error", "never"],
"stylistic/comma-spacing": ["error", { before: false, after: true }],
"stylistic/function-call-spacing": ["error", "never"],
"stylistic/no-trailing-spaces": "error"
}
rules: {
"stylistic/indent": ["error", 2],
"stylistic/semi": ["error", "always"],
"stylistic/eol-last": ["error", "always"],
"stylistic/quotes": ["error", "double"],
"stylistic/dot-location": ["error", "property"],
"stylistic/array-bracket-spacing": ["error", "never"],
"stylistic/arrow-parens": ["error", "always"],
"stylistic/arrow-spacing": "error",
"stylistic/block-spacing": ["error", "always"],
"stylistic/brace-style": ["error", "stroustrup"],
"stylistic/comma-dangle": ["error", "never"],
"stylistic/comma-spacing": ["error", { before: false, after: true }],
"stylistic/function-call-spacing": ["error", "never"],
"stylistic/no-trailing-spaces": "error"
}
];
}
];
2 changes: 2 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from "./auth/index";
export * from "./routes/User";
export * from "./structures/Client";
export * from "./routes/User";
export * from "./routes/School";
5 changes: 3 additions & 2 deletions lib/routes/School.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ export class School {
this.#manager = new RESTManager();
}

/** This method is used to get the user school informations.
/** This method is used to get the user school information.
* @param hoteId The ID of the hote.
*/
* @param token The token of the user.
*/
async getUserSchool(hoteId: number, token: string): Promise<SchoolResponse> {
return this.#manager.makeAuthRequest<userResponse>({
method: "GET",
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class User {
* @param hoteId The ID of the hote to get.
* @param token The token of the user.
*/
async getSolds(hoteId: number, token: string): Promise<balanceResponse[]> {
async getBalances(hoteId: number, token: string): Promise<balanceResponse[]> {
return this.#manager.makeAuthRequest<balanceResponse[]>({
method: "GET",
url: endpoints.USER_BALANCES(hoteId),
Expand Down Expand Up @@ -187,7 +187,7 @@ export class User {
* @param hoteId The ID of the hote to get.
* @param token The token of the user.
* @param state The state of the booking (1==true, 0==false).
* @param weekId The week number to get.
* @param weekNumber The week number to get.
* @param dayOfWeek The ID of the borne to get.
* @param bookEvening If the evening should be booked.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/structures/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class Turboself {
return this.#user.getLastPayment(this.hoteId, this.token);
}

public async getSolds() {
public async getBalances() {
if (await this.isExpire()) {
if (this.mail && this.password) {
await this.refreshToken();
Expand All @@ -92,7 +92,7 @@ export class Turboself {
}
}

return this.#user.getSolds(this.hoteId, this.token);
return this.#user.getBalances(this.hoteId, this.token);
}

public async getUserSchool() {
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "turboself-api",
"version": "0.1.0",
"version": "0.1.1",
"description": "A wrapper around Turboself internal API.",
"repository": "github:raphckrman/turboself-api",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -43,14 +44,15 @@
"@types/set-cookie-parser": "^2.4.7",
"@typescript-eslint/parser": "^6.18.0",
"eslint": "^8.56.0",
"gen-esm-wrapper": "^1.1.3",
"release-it": "^17.0.1",
"terser": "^5.26.0",
"tsup": "^8.0.1",
"tsx": "^4.7.0",
"typescript": "^5.3.3",
"gen-esm-wrapper": "^1.1.3"
"typescript": "^5.3.3"
},
"dependencies": {
"axios": "^1.6.7"
"axios": "^1.6.7",
"ts-node": "^10.9.2"
}
}
17 changes: 9 additions & 8 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// build script for the project

const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const fs = require("fs");
const path = require("path");
const { execSync } = require("child_process");

const rootDir = path.resolve(__dirname, '..');
const srcDir = path.resolve(rootDir, 'lib');
const distDir = path.resolve(rootDir, 'dist');
const rootDir = path.resolve(__dirname, "..");
const distDir = path.resolve(rootDir, "dist");

fs.rmdirSync(distDir, { recursive: true });
if (fs.existsSync(distDir)) {
fs.rmdirSync(distDir, { recursive: true });
}
fs.mkdirSync(distDir);

execSync(`tsc --project ${rootDir}/tsconfig.json`);
execSync(`tsc --project ${rootDir}/tsconfig.json`);

0 comments on commit 1d2f97c

Please sign in to comment.