From 1011d5b1ef14a59c9f2bd74e1468e2d11c107686 Mon Sep 17 00:00:00 2001 From: Shen Zhang Date: Mon, 3 Nov 2025 12:22:21 -0600 Subject: [PATCH] Fixed def and added prettier --- .github/workflows/precommit.yml | 2 +- .pre-commit-config.yaml | 4 +- .prettierrc.json | 10 + README.md | 4 + package-lock.json | 17 + package.json | 4 +- public/index.html | 21 +- src/App.css | 9 +- src/components/DatasetCompositionChart.css | 3 - src/components/DatasetCompositionChart.tsx | 197 ++++++------ src/components/DeferralCurve.tsx | 33 +- src/components/Header.tsx | 19 +- src/components/SpiderChart.css | 4 +- src/components/SpiderChart.tsx | 35 +- src/data/mockData.ts | 305 ++++++++++-------- src/index.css | 9 +- src/pages/HomePage.css | 26 +- src/pages/HomePage.tsx | 157 ++++++--- src/pages/LeaderboardPage.css | 44 +-- src/pages/LeaderboardPage.tsx | 353 +++++++++++---------- src/pages/SubmitPromptPage.css | 8 +- src/pages/SubmitPromptPage.tsx | 16 +- tsconfig.json | 10 +- 23 files changed, 709 insertions(+), 581 deletions(-) create mode 100644 .prettierrc.json diff --git a/.github/workflows/precommit.yml b/.github/workflows/precommit.yml index c450db6..aad9625 100644 --- a/.github/workflows/precommit.yml +++ b/.github/workflows/precommit.yml @@ -7,6 +7,6 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.x" + python-version: '3.x' - run: pip install pre-commit - run: pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6c98982..2503436 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: check-json - id: check-yaml - id: check-added-large-files - args: ["--maxkb=2048"] + args: ['--maxkb=2048'] - id: check-merge-conflict - id: check-case-conflict - id: detect-private-key @@ -32,5 +32,5 @@ repos: rev: v2.2.6 hooks: - id: codespell - args: ["--ignore-words-list=teh,fo"] + args: ['--ignore-words-list=teh,fo'] exclude: '^package-lock\.json$' diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..1ec47f2 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,10 @@ +{ + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "semi": true, + "trailingComma": "es5", + "printWidth": 100, + "bracketSpacing": true, + "arrowParens": "avoid" +} diff --git a/README.md b/README.md index bd8d64e..9776bcc 100644 --- a/README.md +++ b/README.md @@ -24,17 +24,20 @@ RouterArena is the first open platform enabling comprehensive evaluation and com ### Installation 1. Clone the repository: + ```bash git clone https://github.com/rice-university/routerarena.git cd routerarena ``` 2. Install dependencies: + ```bash npm install ``` 3. Start the development server: + ```bash npm start ``` @@ -104,6 +107,7 @@ src/ ``` ### Router Data Structure + ```typescript interface Router { id: string; diff --git a/package-lock.json b/package-lock.json index ca9ab25..8782c44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "@types/react-katex": "^3.0.4", "gh-pages": "^6.3.0", "html-webpack-plugin": "^4.5.2", + "prettier": "3.6.2", "react-scripts": "^5.0.1", "typescript": "^4.9.5" } @@ -15191,6 +15192,22 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/package.json b/package.json index f895cbf..4107ef9 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@types/react-katex": "^3.0.4", "gh-pages": "^6.3.0", "html-webpack-plugin": "^4.5.2", + "prettier": "3.6.2", "react-scripts": "^5.0.1", "typescript": "^4.9.5" }, @@ -33,7 +34,8 @@ "test": "react-scripts test", "eject": "react-scripts eject", "predeploy": "npm run build", - "deploy": "gh-pages -d build" + "deploy": "gh-pages -d build", + "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md,markdown,yml,yaml,html}\"" }, "eslintConfig": { "extends": [ diff --git a/public/index.html b/public/index.html index 12c9ff8..5ea0267 100644 --- a/public/index.html +++ b/public/index.html @@ -1,14 +1,11 @@ - + - +