mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 19:59:37 +00:00
style: eslint
This commit is contained in:
parent
0801d3aae0
commit
df58288b2c
6 changed files with 1146 additions and 3 deletions
4
.eslintignore
Normal file
4
.eslintignore
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
dist
|
||||||
|
docs
|
||||||
|
node_modules
|
||||||
|
.eslintrc.js
|
||||||
10
.eslintrc.js
Normal file
10
.eslintrc.js
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
|
plugins: ["@typescript-eslint"],
|
||||||
|
extends: [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"eslint-config-prettier",
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
@ -20,6 +20,10 @@
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^17.0.13",
|
"@types/node": "^17.0.13",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
||||||
|
"@typescript-eslint/parser": "^5.10.2",
|
||||||
|
"eslint": "^8.8.0",
|
||||||
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"typedoc": "^0.22.11",
|
"typedoc": "^0.22.11",
|
||||||
"typescript": "^4.5.5"
|
"typescript": "^4.5.5"
|
||||||
|
|
|
||||||
1123
pnpm-lock.yaml
generated
1123
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -76,11 +76,12 @@ export class ClasschartsClient {
|
||||||
});
|
});
|
||||||
if (request.statusCode != 302 || !request.headers["set-cookie"])
|
if (request.statusCode != 302 || !request.headers["set-cookie"])
|
||||||
throw new Error("Unauthenticated: Classcharts returned an error");
|
throw new Error("Unauthenticated: Classcharts returned an error");
|
||||||
let cookies = request.headers["set-cookie"];
|
const cookies = request.headers["set-cookie"];
|
||||||
for (let i = 0; i < cookies.length; i++) {
|
for (let i = 0; i < cookies.length; i++) {
|
||||||
cookies[i] = cookies[i].substring(0, cookies[i].indexOf(";"));
|
cookies[i] = cookies[i].substring(0, cookies[i].indexOf(";"));
|
||||||
}
|
}
|
||||||
this.authCookies = cookies;
|
this.authCookies = cookies
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let sessionID: any = decodeURI(cookies[2])
|
let sessionID: any = decodeURI(cookies[2])
|
||||||
.replace(/%3A/g, ":")
|
.replace(/%3A/g, ":")
|
||||||
.replace(/%2C/g, ",");
|
.replace(/%2C/g, ",");
|
||||||
|
|
@ -151,7 +152,7 @@ export class ClasschartsClient {
|
||||||
params.append("display_date", String(options?.displayDate));
|
params.append("display_date", String(options?.displayDate));
|
||||||
options?.fromDate && params.append("from", String(options?.fromDate));
|
options?.fromDate && params.append("from", String(options?.fromDate));
|
||||||
options?.toDate && params.append("to", String(options?.toDate));
|
options?.toDate && params.append("to", String(options?.toDate));
|
||||||
let data: Array<Homework> = await this.makeAuthedRequest(
|
const data: Array<Homework> = await this.makeAuthedRequest(
|
||||||
API_BASE + "/homeworks/" + this.studentId + "?" + params.toString(),
|
API_BASE + "/homeworks/" + this.studentId + "?" + params.toString(),
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
export interface Student {
|
export interface Student {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue