diff --git a/.prettierrc.js b/.prettierrc.js index 2ac0eed..762d841 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -6,4 +6,11 @@ module.exports = { trailingComma: 'all', useTabs: false, endOfLine: 'auto', + plugins: ['@ianvs/prettier-plugin-sort-imports'], + importOrder: [ + '', // Node.js built-in modules + '', // Imports not matched by other special words or groups. + '^(@src)(/.*)$', + '^[.]', // relative imports + ], }; diff --git a/package-lock.json b/package-lock.json index 48bd0f4..f395de9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "Skedge", - "version": "2.2.0", + "version": "2.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "Skedge", - "version": "2.2.0", + "version": "2.2.3", "dependencies": { "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.0", + "@ianvs/prettier-plugin-sort-imports": "^4.7.0", "@mui/icons-material": "^5.17.1", "@mui/material": "^5.17.1", "@plasmohq/messaging": "^0.7.1", @@ -37,7 +38,6 @@ "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", - "eslint-plugin-simple-import-sort": "^12.1.1", "postcss": "^8.5.3", "prettier": "^3.5.3", "tailwindcss": "^3.4.17", @@ -1110,6 +1110,40 @@ "url": "https://github.com/sponsors/nzakas" } }, + "node_modules/@ianvs/prettier-plugin-sort-imports": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@ianvs/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.7.0.tgz", + "integrity": "sha512-soa2bPUJAFruLL4z/CnMfSEKGznm5ebz29fIa9PxYtu8HHyLKNE1NXAs6dylfw1jn/ilEIfO2oLLN6uAafb7DA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/generator": "^7.26.2", + "@babel/parser": "^7.26.2", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", + "semver": "^7.5.2" + }, + "peerDependencies": { + "@prettier/plugin-oxc": "^0.0.4", + "@vue/compiler-sfc": "2.7.x || 3.x", + "content-tag": "^4.0.0", + "prettier": "2 || 3 || ^4.0.0-0", + "prettier-plugin-ember-template-tag": "^2.1.0" + }, + "peerDependenciesMeta": { + "@prettier/plugin-oxc": { + "optional": true + }, + "@vue/compiler-sfc": { + "optional": true + }, + "content-tag": { + "optional": true + }, + "prettier-plugin-ember-template-tag": { + "optional": true + } + } + }, "node_modules/@img/sharp-darwin-arm64": { "version": "0.33.5", "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", @@ -3409,9 +3443,9 @@ } }, "node_modules/@parcel/optimizer-swc/node_modules/@swc/helpers": { - "version": "0.5.17", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz", - "integrity": "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==", + "version": "0.5.18", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.18.tgz", + "integrity": "sha512-TXTnIcNJQEKwThMMqBXsZ4VGAza6bvN4pa41Rkqoio6QBKMvo+5lexeTMScGCIxtzgQJzElcvIltani+adC5PQ==", "license": "Apache-2.0", "optional": true, "peer": true, @@ -8380,73 +8414,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/css-select": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", - "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", - "license": "BSD-2-Clause", - "optional": true, - "peer": true, - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.1.0", - "domhandler": "^5.0.2", - "domutils": "^3.0.1", - "nth-check": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/css-select/node_modules/dom-serializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.2", - "entities": "^4.2.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/css-select/node_modules/domhandler": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", - "license": "BSD-2-Clause", - "optional": true, - "peer": true, - "dependencies": { - "domelementtype": "^2.3.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/css-select/node_modules/domutils": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", - "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", - "license": "BSD-2-Clause", - "optional": true, - "peer": true, - "dependencies": { - "dom-serializer": "^2.0.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, "node_modules/css-tree": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", @@ -8485,45 +8452,6 @@ "node": ">=4" } }, - "node_modules/csso": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", - "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "css-tree": "~2.2.0" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/csso/node_modules/css-tree": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", - "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "mdn-data": "2.0.28", - "source-map-js": "^1.0.1" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/csso/node_modules/mdn-data": { - "version": "2.0.28", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", - "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", - "license": "CC0-1.0", - "optional": true, - "peer": true - }, "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", @@ -9625,16 +9553,6 @@ "semver": "bin/semver.js" } }, - "node_modules/eslint-plugin-simple-import-sort": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz", - "integrity": "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "eslint": ">=5.0.0" - } - }, "node_modules/eslint-scope": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.3.0.tgz", @@ -13689,7 +13607,6 @@ "version": "3.5.3", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", - "dev": true, "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" @@ -14580,20 +14497,6 @@ "node": ">=0.10.0" } }, - "node_modules/srcset": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/srcset/-/srcset-5.0.1.tgz", - "integrity": "sha512-/P1UYbGfJVlxZag7aABNRrulEXAwCSDo7fklafOQrantuPTDmYgijJMks2zusPCVzgW9+4P69mq7w6pYuZpgxw==", - "license": "MIT", - "optional": true, - "peer": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stable": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", @@ -14964,33 +14867,6 @@ "integrity": "sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==", "license": "MIT" }, - "node_modules/svgo": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.2.tgz", - "integrity": "sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw==", - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "@trysound/sax": "0.2.0", - "commander": "^7.2.0", - "css-select": "^5.1.0", - "css-tree": "^2.3.1", - "css-what": "^6.1.0", - "csso": "^5.0.5", - "picocolors": "^1.0.0" - }, - "bin": { - "svgo": "bin/svgo" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/svgo" - } - }, "node_modules/tailwindcss": { "version": "3.4.17", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.17.tgz", diff --git a/package.json b/package.json index d714130..087030b 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "dependencies": { "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.0", + "@ianvs/prettier-plugin-sort-imports": "^4.7.0", "@mui/icons-material": "^5.17.1", "@mui/material": "^5.17.1", "@plasmohq/messaging": "^0.7.1", @@ -46,7 +47,6 @@ "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", - "eslint-plugin-simple-import-sort": "^12.1.1", "postcss": "^8.5.3", "prettier": "^3.5.3", "tailwindcss": "^3.4.17", @@ -65,7 +65,6 @@ ], "parser": "@typescript-eslint/parser", "plugins": [ - "simple-import-sort", "@typescript-eslint" ], "rules": { @@ -85,8 +84,6 @@ ] } ], - "simple-import-sort/imports": "error", - "simple-import-sort/exports": "error", "import/first": "error", "import/newline-after-import": "error", "import/no-duplicates": "error", diff --git a/src/app/index.tsx b/src/app/index.tsx index 9f4b6d4..1cf0161 100644 --- a/src/app/index.tsx +++ b/src/app/index.tsx @@ -1,6 +1,4 @@ import { sendToBackground } from '@plasmohq/messaging'; -import React, { useEffect, useState } from 'react'; - import type { ShowCourseTabPayload } from '~background'; import CourseOverview from '~components/CourseOverview'; import Landing from '~components/Landing'; @@ -17,10 +15,11 @@ import type { GenericFetchedData } from '~types/GenericFetchedData'; import type { GradesData, GradesType } from '~types/GradesType'; import { convertToProfOnly, - type SearchQuery, searchQueryEqual, searchQueryLabel, + type SearchQuery, } from '~types/SearchQuery'; +import React, { useEffect, useState } from 'react'; //Find GPA, total, and grade_distribution based on including some set of semesters function calculateGrades(grades: GradesData, academicSessions?: string[]) { diff --git a/src/background/index.ts b/src/background/index.ts index 9f287ec..0b20fe5 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -1,5 +1,4 @@ import { Storage } from '@plasmohq/storage'; - import { addGCalButtons, listenForTableChange, diff --git a/src/background/messages/getScrapeData.ts b/src/background/messages/getScrapeData.ts index 4135ddd..6d94fc0 100644 --- a/src/background/messages/getScrapeData.ts +++ b/src/background/messages/getScrapeData.ts @@ -1,5 +1,4 @@ import type { PlasmoMessaging } from '@plasmohq/messaging'; - import { getScrapedCourseData } from '..'; const handler: PlasmoMessaging.MessageHandler = async (req, res) => { diff --git a/src/components/BarGraph.tsx b/src/components/BarGraph.tsx index 0624b2a..29780bb 100644 --- a/src/components/BarGraph.tsx +++ b/src/components/BarGraph.tsx @@ -1,10 +1,9 @@ import { useMediaQuery } from '@mui/material'; +import { useRainbowColors } from '~utils/colors'; import { type ApexOptions } from 'apexcharts'; import dynamic from 'next/dynamic'; import React from 'react'; -import { useRainbowColors } from '~utils/colors'; - const Chart = dynamic(() => import('react-apexcharts'), { ssr: false }); type GraphProps = { diff --git a/src/components/CourseOverview.tsx b/src/components/CourseOverview.tsx index b319cfa..0f12aa9 100644 --- a/src/components/CourseOverview.tsx +++ b/src/components/CourseOverview.tsx @@ -1,11 +1,10 @@ import { Skeleton } from '@mui/material'; -import React from 'react'; - import { TRENDS_URL } from '~data/config'; import type { GenericFetchedData } from '~types/GenericFetchedData'; import type { GradesType } from '~types/GradesType'; -import { type SearchQuery, searchQueryLabel } from '~types/SearchQuery'; +import { searchQueryLabel, type SearchQuery } from '~types/SearchQuery'; import gpaToLetterGrade from '~utils/gpaToLetterGrade'; +import React from 'react'; type CourseOverviewProps = { header: string | SearchQuery; diff --git a/src/components/Landing.tsx b/src/components/Landing.tsx index e996281..54a52f3 100644 --- a/src/components/Landing.tsx +++ b/src/components/Landing.tsx @@ -1,14 +1,13 @@ import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import { Button, IconButton } from '@mui/material'; import { Storage } from '@plasmohq/storage'; +import NebulaLogo from '~components/NebulaLogo'; +import { TRENDS_URL } from '~data/config'; import gradient from 'data-base64:../../assets/gradient.png'; import tutorial1 from 'data-base64:../../assets/tutorial1.png'; import tutorial2 from 'data-base64:../../assets/tutorial2.png'; import React, { useEffect, useState } from 'react'; -import NebulaLogo from '~components/NebulaLogo'; -import { TRENDS_URL } from '~data/config'; - const STORAGE_KEY = 'page'; const ExplanatoryPage = ({ diff --git a/src/components/ProfessorOverview.tsx b/src/components/ProfessorOverview.tsx index 835ac40..44107f2 100644 --- a/src/components/ProfessorOverview.tsx +++ b/src/components/ProfessorOverview.tsx @@ -1,7 +1,5 @@ import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import { IconButton, Skeleton } from '@mui/material'; -import React, { useEffect, useState } from 'react'; - import SingleGradesInfo from '~components/SingleGradesInfo'; import SingleProfInfo from '~components/SingleProfInfo'; import { TRENDS_URL } from '~data/config'; @@ -12,7 +10,8 @@ import fetchWithCache, { } from '~data/fetchWithCache'; import type { GenericFetchedData } from '~types/GenericFetchedData'; import type { GradesType } from '~types/GradesType'; -import { type SearchQuery, searchQueryLabel } from '~types/SearchQuery'; +import { searchQueryLabel, type SearchQuery } from '~types/SearchQuery'; +import React, { useEffect, useState } from 'react'; const fallbackSrc = 'https://profiles.utdallas.edu/img/default.png'; diff --git a/src/components/SearchResultsTable.tsx b/src/components/SearchResultsTable.tsx index 737efb7..f61ec97 100644 --- a/src/components/SearchResultsTable.tsx +++ b/src/components/SearchResultsTable.tsx @@ -15,8 +15,6 @@ import { Tooltip, Typography, } from '@mui/material'; -import React, { useState } from 'react'; - import Rating from '~components/Rating'; import SingleGradesInfo from '~components/SingleGradesInfo'; import SingleProfInfo from '~components/SingleProfInfo'; @@ -27,11 +25,12 @@ import type { GradesType } from '~types/GradesType'; import { convertToCourseOnly, convertToProfOnly, - type SearchQuery, searchQueryLabel, + type SearchQuery, } from '~types/SearchQuery'; import { useRainbowColors } from '~utils/colors'; import gpaToLetterGrade from '~utils/gpaToLetterGrade'; +import React, { useState } from 'react'; type RowProps = { course: SearchQuery; diff --git a/src/components/SingleGradesInfo.tsx b/src/components/SingleGradesInfo.tsx index b4a7c83..2c7ecfb 100644 --- a/src/components/SingleGradesInfo.tsx +++ b/src/components/SingleGradesInfo.tsx @@ -1,6 +1,4 @@ import { Skeleton } from '@mui/material'; -import React from 'react'; - import BarGraph from '~components/BarGraph'; import { TRENDS_URL } from '~data/config'; import type { GenericFetchedData } from '~types/GenericFetchedData'; @@ -8,10 +6,11 @@ import type { GradesType } from '~types/GradesType'; import { convertToCourseOnly, convertToProfOnly, - type SearchQuery, searchQueryLabel, + type SearchQuery, } from '~types/SearchQuery'; import gpaToLetterGrade from '~utils/gpaToLetterGrade'; +import React from 'react'; function convertNumbersToPercents(distribution: GradesType): number[] { const total = distribution.total; diff --git a/src/components/SingleProfInfo.tsx b/src/components/SingleProfInfo.tsx index 4b27e4b..588e6c8 100644 --- a/src/components/SingleProfInfo.tsx +++ b/src/components/SingleProfInfo.tsx @@ -1,9 +1,8 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import { Chip, Collapse, Grid, IconButton, Skeleton } from '@mui/material'; -import React, { useState } from 'react'; - import type { RMPInterface } from '~data/fetchFromRmp'; import type { GenericFetchedData } from '~types/GenericFetchedData'; +import React, { useState } from 'react'; type Props = { rmp: GenericFetchedData; diff --git a/src/components/TopMenu.tsx b/src/components/TopMenu.tsx index 62d0542..a9df68f 100644 --- a/src/components/TopMenu.tsx +++ b/src/components/TopMenu.tsx @@ -1,8 +1,7 @@ -import gradient from 'data-base64:../../assets/gradient.png'; -import React from 'react'; - import NebulaLogo from '~components/NebulaLogo'; import { TRENDS_URL } from '~data/config'; +import gradient from 'data-base64:../../assets/gradient.png'; +import React from 'react'; /** * This is a component to hold Skedge branding diff --git a/src/content.ts b/src/content.ts index a23dfb1..a64827f 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1,6 +1,5 @@ -import type { PlasmoCSConfig } from 'plasmo'; - import { type SearchQuery } from '~types/SearchQuery'; +import type { PlasmoCSConfig } from 'plasmo'; // Plasmo CS config export export const config: PlasmoCSConfig = { diff --git a/src/popup.tsx b/src/popup.tsx index 646ac2f..643cc20 100644 --- a/src/popup.tsx +++ b/src/popup.tsx @@ -1,12 +1,10 @@ import '~/styles/globals.css'; - import { useMediaQuery } from '@mui/material'; import { createTheme, ThemeProvider } from '@mui/material/styles'; import * as Sentry from '@sentry/react'; -import React from 'react'; - import Index from '~/app'; import { neededOrigins } from '~data/config'; +import React from 'react'; const realBrowser = process.env.PLASMO_BROWSER === 'chrome' ? chrome : browser; diff --git a/src/tabs/permissions.tsx b/src/tabs/permissions.tsx index e58ce89..eb04083 100644 --- a/src/tabs/permissions.tsx +++ b/src/tabs/permissions.tsx @@ -1,10 +1,8 @@ import '~/styles/globals.css'; - import { Button } from '@mui/material'; import * as Sentry from '@sentry/react'; -import React, { useState } from 'react'; - import { neededOrigins } from '~data/config'; +import React, { useState } from 'react'; //Same as in src/popup.tsx Sentry.init({