-
Notifications
You must be signed in to change notification settings - Fork 0
React compiler #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React compiler #278
Changes from all commits
06a2734
a07c73f
4134017
bdcfcfe
57edebd
4ec0848
714af64
1dfc302
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import path from "path"; | ||
| import { fileURLToPath } from "url"; | ||
|
|
||
| import prettierPlugin from "eslint-plugin-prettier"; | ||
| import promisePlugin from "eslint-plugin-promise"; | ||
| import reactPlugin from "eslint-plugin-react"; | ||
| import nextPlugin from "@next/eslint-plugin-next"; | ||
| import reactHooks from "eslint-plugin-react-hooks"; | ||
| import tseslint from "typescript-eslint"; | ||
| import sortKeys from "eslint-plugin-sort-keys"; | ||
| import sortDestructureKeys from "eslint-plugin-sort-destructure-keys"; | ||
|
|
||
| import prettierConfig from "./.prettierrc.cjs"; | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
|
|
||
| export default [ | ||
| // ======================== | ||
| // Global ignores | ||
| // ======================== | ||
| { | ||
| ignores: [ | ||
| "**/node_modules/**", | ||
| "packages/db/src/entities/*.ts", | ||
| "packages/client/tailwind.config.ts", | ||
| "**/.next/**", | ||
| "**/dist/**", | ||
| "**/build/**", | ||
| "**/.turbo/**", | ||
| ], | ||
| }, | ||
|
|
||
| ...tseslint.configs.recommendedTypeChecked.map((config) => ({ | ||
| ...config, | ||
| files: ["**/*.ts", "**/*.tsx"], // We use TS config only for TS files | ||
| })), | ||
|
|
||
| // ======================== | ||
| // Base TypeScript rules (ALL packages) | ||
| // ======================== | ||
| { | ||
| files: ["**/*.ts", "**/*.tsx"], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| projectService: true, | ||
| tsconfigRootDir: __dirname, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| "@typescript-eslint": tseslint.plugin, | ||
| prettier: prettierPlugin, | ||
| promise: promisePlugin, | ||
| "sort-keys": sortKeys, | ||
| "sort-destructure-keys": sortDestructureKeys, | ||
| }, | ||
| rules: { | ||
| "@typescript-eslint/no-unused-vars": [ | ||
| "warn", | ||
| { argsIgnorePattern: "^_" }, | ||
| ], | ||
|
|
||
| eqeqeq: ["error", "smart"], | ||
| "no-console": "error", | ||
| "no-eval": "error", | ||
| "no-var": "error", | ||
|
|
||
| "prettier/prettier": ["error", prettierConfig], | ||
|
|
||
| "sort-destructure-keys/sort-destructure-keys": "error", | ||
| "sort-keys/sort-keys-fix": "error", | ||
| }, | ||
| }, | ||
|
|
||
| // ======================== | ||
| // CLIENT (Next.js + React) | ||
| // ======================== | ||
| { | ||
| files: ["packages/client/**/*.{ts,tsx}"], | ||
| plugins: { | ||
| react: reactPlugin, | ||
| "@next/next": nextPlugin, | ||
| "react-hooks": reactHooks, | ||
| }, | ||
| settings: { | ||
| react: { | ||
| version: "detect", | ||
| }, | ||
| next: { | ||
| rootDir: "packages/client", | ||
| }, | ||
| }, | ||
| rules: { | ||
| ...reactPlugin.configs.recommended.rules, | ||
| ...nextPlugin.configs["core-web-vitals"].rules, | ||
| ...reactHooks.configs.recommended.rules, | ||
|
|
||
| "react/jsx-sort-props": "error", | ||
| "react/sort-comp": "off", | ||
| "react/react-in-jsx-scope": "off", | ||
| "@next/next/no-html-link-for-pages": ["error", "packages/client/src"], | ||
| }, | ||
| }, | ||
|
burtonjong marked this conversation as resolved.
|
||
|
|
||
| // ======================== | ||
| // SERVER (Node only) | ||
| // ======================== | ||
| { | ||
| files: ["packages/server/**/*.ts"], | ||
| rules: { | ||
| // Server-specific overrides go here | ||
| // (currently same as base except no React rules) | ||
| }, | ||
| }, | ||
| ]; | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,4 @@ | ||
| { | ||
| "extends": "../../tsconfig.json", | ||
| "include": [ | ||
| "amplify", | ||
| ".eslintrc.cjs" | ||
| ], | ||
| "include": ["amplify"] | ||
| } |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||||||||
| "use client"; | ||||||||||||||
|
|
||||||||||||||
| import axios from "axios"; | ||||||||||||||
| import { useTheme } from "next-themes"; | ||||||||||||||
| import { useEffect, useState } from "react"; | ||||||||||||||
| import type { PlotParams } from "react-plotly.js"; | ||||||||||||||
|
|
@@ -26,9 +27,9 @@ export default function MLContainer({ | |||||||||||||
| useEffect(() => { | ||||||||||||||
| const fetchPlot = async () => { | ||||||||||||||
| try { | ||||||||||||||
| const response = await fetch(plotType); | ||||||||||||||
| const graph = await response.json(); | ||||||||||||||
| const data = JSON.parse(graph) as PlotParams; | ||||||||||||||
| // TODO: check to see if data is being parsed correctly. | ||||||||||||||
| const response = await axios.get<string>(plotType); | ||||||||||||||
| const data = JSON.parse(response.data) as PlotParams; | ||||||||||||||
|
Comment on lines
+30
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Since axios defaults to Fix by removing Proposed fix- const response = await axios.get<string>(plotType);
- const data = JSON.parse(response.data) as PlotParams;
+ const response = await axios.get<PlotParams>(plotType);
+ const data = response.data;Alternatively, if the upstream API truly returns a JSON-encoded string (double-serialized), add 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be fixed later
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🧠 Learnings used |
||||||||||||||
| const layout: PlotParams["layout"] = { | ||||||||||||||
| autosize: true, | ||||||||||||||
| font: { | ||||||||||||||
|
|
@@ -49,7 +50,8 @@ export default function MLContainer({ | |||||||||||||
| setPlot({ error: true }); | ||||||||||||||
| } | ||||||||||||||
| }; | ||||||||||||||
| fetchPlot(); | ||||||||||||||
|
|
||||||||||||||
| void fetchPlot(); | ||||||||||||||
| }, [plotType, resolvedTheme]); | ||||||||||||||
|
|
||||||||||||||
| if (!plot || !resolvedTheme || resolvedTheme === undefined) { | ||||||||||||||
|
|
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.