From 00e3a13821c2899f1c5fe534d4ffbec7d88b7431 Mon Sep 17 00:00:00 2001 From: James Cook Date: Sun, 14 May 2023 00:59:21 +0100 Subject: [PATCH] chore: typo fixes + config files --- .eslintignore | 2 +- .eslintrc.js => .eslintrc.cjs | 0 .idea/.gitignore | 5 ++ .idea/classcharts-api-js.iml | 12 ++++ .idea/codeStyles/Project.xml | 58 ++++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 ++ .idea/inspectionProfiles/Project_Default.xml | 6 ++ .idea/modules.xml | 8 +++ .idea/prettier.xml | 6 ++ .idea/vcs.xml | 6 ++ docs/index.html | 2 +- package.json | 2 +- src/core/baseClient.ts | 8 +-- src/core/parentClient.ts | 6 +- src/core/studentClient.ts | 10 ++-- tests/baseClient.test.ts | 2 + tsconfig.json | 2 +- 17 files changed, 124 insertions(+), 16 deletions(-) rename .eslintrc.js => .eslintrc.cjs (100%) create mode 100644 .idea/.gitignore create mode 100644 .idea/classcharts-api-js.iml create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/prettier.xml create mode 100644 .idea/vcs.xml diff --git a/.eslintignore b/.eslintignore index 4462152..2e37f93 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,5 @@ dist/ docs/ node_modules/ -.eslintrc.js +.eslintrc.cjs tsconfig.json \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/classcharts-api-js.iml b/.idea/classcharts-api-js.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/classcharts-api-js.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..f986f2f --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ac983d9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/prettier.xml b/.idea/prettier.xml new file mode 100644 index 0000000..b0c1c68 --- /dev/null +++ b/.idea/prettier.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 7d11319..e005a08 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@ - Classcharts-API + ClassCharts-API { if (!this.email) throw new Error("Email not inputted"); @@ -33,7 +33,7 @@ export class ParentClient extends BaseClient { formData.append("email", this.email); formData.append("logintype", "existing"); formData.append("password", this.password); - formData.append("recaptcha-token", "no-token-avaliable"); + formData.append("recaptcha-token", "no-token-available"); const headers = new Headers({ "Content-Type": "application/x-www-form-urlencoded", }); @@ -45,7 +45,7 @@ export class ParentClient extends BaseClient { }); if (response.status != 302 || !response.headers.get("set-cookie")) throw new Error( - "Unauthenticated: Classcharts returned an error: " + + "Unauthenticated: ClassCharts returned an error: " + response.status + " " + response.statusText diff --git a/src/core/studentClient.ts b/src/core/studentClient.ts index 750c9b9..0ab9fc9 100644 --- a/src/core/studentClient.ts +++ b/src/core/studentClient.ts @@ -8,7 +8,7 @@ import ky from "ky-universal"; */ export class StudentClient extends BaseClient { /** - * @property studentCode Classcharts student code + * @property studentCode ClassCharts student code * @internal */ private studentCode = ""; @@ -20,7 +20,7 @@ export class StudentClient extends BaseClient { /** * - * @param studentCode Classcharts student code + * @param studentCode ClassCharts student code * @param dateOfBirth Student's date of birth */ constructor(studentCode: string, dateOfBirth?: string) { @@ -30,7 +30,7 @@ export class StudentClient extends BaseClient { } /** - * Authenticates with classcharts + * Authenticates with ClassCharts */ async login(): Promise { if (!this.studentCode) throw new Error("Student Code not inputted"); @@ -39,7 +39,7 @@ export class StudentClient extends BaseClient { formData.append("code", this.studentCode.toUpperCase()); formData.append("dob", this.dateOfBirth); formData.append("remember_me", "1"); - formData.append("recaptcha-token", "no-token-avaliable"); + formData.append("recaptcha-token", "no-token-available"); const request = await ky(BASE_URL + "/student/login", { method: "POST", body: formData, @@ -49,7 +49,7 @@ export class StudentClient extends BaseClient { }); if (request.status != 302 || !request.headers.get("set-cookie")) { throw new Error( - "Unauthenticated: Classcharts returned an error: " + + "Unauthenticated: ClassCharts returned an error: " + request.status + " " + request.statusText diff --git a/tests/baseClient.test.ts b/tests/baseClient.test.ts index 0a0b145..189cb24 100644 --- a/tests/baseClient.test.ts +++ b/tests/baseClient.test.ts @@ -1,4 +1,6 @@ import { StudentClient } from "../src"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore import { code, dob } from "./config.json"; import "jest-extended"; const client = new StudentClient(code, dob); diff --git a/tsconfig.json b/tsconfig.json index 346da08..8bc8621 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,7 @@ "noUnusedLocals": true, "noUnusedParameters": true, "skipLibCheck": true, - "isolatedModules": true + "isolatedModules": true, }, "include": ["./src/**/*"] }