feat: add eslint-plugin-tsdoc (#430)

* feat: add eslint-plugin-tsdoc

* feat(doc): update current jsdoc to tsdoc specification

* chore: update deps

* feat: update warn to error for jsdoc and tsdoc

* chore(doc): lint
This commit is contained in:
doprz
2024-11-16 00:20:36 -06:00
committed by GitHub
parent c41467c617
commit e987fbbe8e
55 changed files with 1439 additions and 1317 deletions

View File

@@ -46,8 +46,9 @@ export class CourseCatalogScraper {
/**
* Pass in a list of HTMLtable rows and scrape every course from them
* @param rows the rows of the course catalog table
* @param keepHeaders whether to keep the header rows (which contain the course name) in the output
*
* @param rows - the rows of the course catalog table
* @param keepHeaders - whether to keep the header rows (which contain the course name) in the output
* @returns an array of course row objects (which contain courses corresponding to the htmltable row)
*/
public scrape(rows: NodeListOf<HTMLTableRowElement> | HTMLTableRowElement[], keepHeaders = false): ScrapedRow[] {
@@ -109,8 +110,12 @@ export class CourseCatalogScraper {
/**
* Separate the course name into its department, number, and name
* @example separateCourseName("CS 314H - Honors Discrete Structures") => ["Honors Discrete Structures", "CS", "314H"]
* @param courseFullName the full name of the course (e.g. "CS 314H - Honors Discrete Structures")
*
* @example
* ```
* separateCourseName("CS 314H - Honors Discrete Structures") => ["Honors Discrete Structures", "CS", "314H"]
* ```
* @param courseFullName - the full name of the course (e.g. "CS 314H - Honors Discrete Structures")
* @returns an array of the course name , department, and number
*/
separateCourseName(courseFullName: string): [courseName: string, department: string, number: string] {
@@ -124,8 +129,9 @@ export class CourseCatalogScraper {
/**
* Gets how many credit hours the course is worth
* @param courseNumber the course number, CS 314H
* @return the number of credit hours the course is worth
*
* @param courseNumber - the course number, CS 314H
* @returns the number of credit hours the course is worth
*/
getCreditHours(courseNumber: string): number {
let creditHours = Number(courseNumber.split('')[0]);
@@ -149,7 +155,8 @@ export class CourseCatalogScraper {
/**
* Scrape the Unique ID from the course catalog table row
* @param row the row of the course catalog table
*
* @param row - the row of the course catalog table
* @returns the uniqueid of the course as a number
*/
getUniqueId(row: HTMLTableRowElement): number {
@@ -162,7 +169,8 @@ export class CourseCatalogScraper {
/**
* Scrapes the individual URL for a given course that takes you to the course details page
* @param row the row of the course catalog table
*
* @param row - the row of the course catalog table
* @returns the url of the course details page for the course in the row
*/
getURL(row: HTMLTableRowElement): string {
@@ -172,7 +180,8 @@ export class CourseCatalogScraper {
/**
* Scrape who is teaching the course from the course catalog table row with meta-data about their name
* @param row the row of the course catalog table
*
* @param row - the row of the course catalog table
* @returns an array of instructors for the course
*/
getInstructors(row: HTMLTableRowElement): Instructor[] {
@@ -197,7 +206,8 @@ export class CourseCatalogScraper {
/**
* Whether or not this is a header row for a course within the course catalog list (we can't scrape courses from header rows)
* @param row the row of the course catalog table
*
* @param row - the row of the course catalog table
* @returns true if this is a header row, false otherwise
*/
isHeaderRow(row: HTMLTableRowElement): boolean {
@@ -206,7 +216,8 @@ export class CourseCatalogScraper {
/**
* Scrape whether the class is being taught online, in person, or a hybrid of the two
* @param row the row of the course catalog table
*
* @param row - the row of the course catalog table
* @returns the instruction mode of the course
*/
getInstructionMode(row: HTMLTableRowElement): InstructionMode {
@@ -223,7 +234,8 @@ export class CourseCatalogScraper {
/**
* Scrapes the description of the course from the course details page and separates it into an array of cleaned up lines
* @param doc the document of the course details page to scrape
*
* @param doc - the document of the course details page to scrape
* @returns an array of lines of the course description
*/
getDescription(doc: Document): string[] {
@@ -273,7 +285,8 @@ export class CourseCatalogScraper {
/**
* Get the full name of the course from the course catalog table row (e.g. "CS 314H - Honors Discrete Structures")
* @param row the row of the course catalog table
*
* @param row - the row of the course catalog table
* @returns the full name of the course
*/
getFullName(row?: HTMLTableRowElement): string {
@@ -286,7 +299,8 @@ export class CourseCatalogScraper {
/**
* When registration is open, the registration URL will show up in the course catalog table row as a link. This will scrape it from the row.
* @param row the row of the course catalog table
*
* @param row - the row of the course catalog table
* @returns the registration URL for the course if it is currently displayed, undefined otherwise
*/
getRegisterURL(row: HTMLTableRowElement): string | undefined {
@@ -296,8 +310,9 @@ export class CourseCatalogScraper {
/**
* Scrapes whether the course is open, closed, waitlisted, or cancelled
* @param row the row of the course catalog table
* @returns
*
* @param row - the row of the course catalog table
* @returns a tuple of the status of the course and whether the course is reserved
*/
getStatus(row: HTMLTableRowElement): [status: StatusType, isReserved: boolean] {
const div = row.querySelector(TableDataSelector.STATUS);
@@ -327,7 +342,8 @@ export class CourseCatalogScraper {
/**
* At UT, some courses have certain "flags" which aid in graduation. This will scrape the flags from the course catalog table row.
* @param row
*
* @param row - the row of the course catalog table
* @returns an array of flags for the course
*/
getFlags(row: HTMLTableRowElement): string[] {
@@ -337,7 +353,8 @@ export class CourseCatalogScraper {
/**
* Get the list of core curriculum requirements the course satisfies
* @param row
*
* @param row - the row of the course catalog table
* @returns an array of core curriculum codes
*/
getCore(row: HTMLTableRowElement): string[] {
@@ -352,7 +369,8 @@ export class CourseCatalogScraper {
/**
* This will scrape all the time information from the course catalog table row and return it as a CourseSchedule object, which represents all of the meeting timiestimes/places of the course.
* @param row the row of the course catalog table
*
* @param row - the row of the course catalog table
* @returns a CourseSchedule object representing all of the meetings of the course
*/
getSchedule(row: HTMLTableRowElement): CourseSchedule {