diff --git a/old/src/App.test.tsx b/old/src/App.test.tsx index 2a68616..d76787e 100644 --- a/old/src/App.test.tsx +++ b/old/src/App.test.tsx @@ -1,8 +1,8 @@ -import React from 'react'; -import { render, screen } from '@testing-library/react'; -import App from './App'; +import React from "react"; +import { render, screen } from "@testing-library/react"; +import App from "./App"; -test('renders learn react link', () => { +test("renders learn react link", () => { render(); const linkElement = screen.getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); diff --git a/old/src/App.tsx b/old/src/App.tsx index 1ed5b66..a4df869 100644 --- a/old/src/App.tsx +++ b/old/src/App.tsx @@ -1,5 +1,5 @@ -import './App.css'; -import Editor from './Editor'; +import "./App.css"; +import Editor from "./Editor"; function App() { return ( diff --git a/old/src/index.css b/old/src/index.css index ec2585e..4a1df4d 100644 --- a/old/src/index.css +++ b/old/src/index.css @@ -1,13 +1,13 @@ body { margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } diff --git a/old/src/index.tsx b/old/src/index.tsx index 032464f..4fa2a47 100644 --- a/old/src/index.tsx +++ b/old/src/index.tsx @@ -1,16 +1,16 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; +import React from "react"; +import ReactDOM from "react-dom/client"; +import "./index.css"; +import App from "./App"; +import reportWebVitals from "./reportWebVitals"; const root = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement + document.getElementById("root") as HTMLElement, ); root.render( - + , ); // If you want to start measuring performance in your app, pass a function diff --git a/old/src/reportWebVitals.ts b/old/src/reportWebVitals.ts index 49a2a16..5fa3583 100644 --- a/old/src/reportWebVitals.ts +++ b/old/src/reportWebVitals.ts @@ -1,8 +1,8 @@ -import { ReportHandler } from 'web-vitals'; +import { ReportHandler } from "web-vitals"; const reportWebVitals = (onPerfEntry?: ReportHandler) => { if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { getCLS(onPerfEntry); getFID(onPerfEntry); getFCP(onPerfEntry); diff --git a/old/src/setupTests.ts b/old/src/setupTests.ts index 8f2609b..1dd407a 100644 --- a/old/src/setupTests.ts +++ b/old/src/setupTests.ts @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom'; +import "@testing-library/jest-dom"; diff --git a/old/tsconfig.json b/old/tsconfig.json index a273b0c..aca306e 100644 --- a/old/tsconfig.json +++ b/old/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "es5", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, @@ -18,9 +14,7 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", }, - "include": [ - "src" - ] + "include": ["src"], } diff --git a/src/Editor.tsx b/src/Editor.tsx index 2354a54..b9d44ec 100644 --- a/src/Editor.tsx +++ b/src/Editor.tsx @@ -15,7 +15,7 @@ function Editor({ defaultValue = "I have a text value." }) { function addHighlight(start: number, end: number) { let new_highlights = [...highlights, new Highlight(start, end)]; - new_highlights.sort(function (a,b) { + new_highlights.sort(function (a, b) { if (a.start < b.start) return -1; if (a.start > b.start) return 1; return 0; diff --git a/src/OrgAst.tsx b/src/OrgAst.tsx index 2332548..7267013 100644 --- a/src/OrgAst.tsx +++ b/src/OrgAst.tsx @@ -1,35 +1,32 @@ import React, { ReactNode, useState } from "react"; -import { - parse_org, -} from "../../organic/target/wasm32-unknown-unknown/js/wasm"; +import { parse_org } from "../../organic/target/wasm32-unknown-unknown/js/wasm"; import styles from "./OrgAst.module.css"; -const OrgAst = (props: {addHighlight: Function, value: string}) => { +const OrgAst = (props: { addHighlight: Function; value: string }) => { console.log(styles); const ast_tree = parse_org(props.value); console.log(JSON.stringify(ast_tree)); if (ast_tree.status !== "success") { - return ( -
Error! {ast_tree.content}
- ); + return
Error! {ast_tree.content}
; } else { return ( -
+
+ +
); - } -} +}; -const OrgAstNode = (props: {node: any}) => { +const OrgAstNode = (props: { node: any }) => { return (
{props.node["ast-node"]}
- {Array.isArray(props.node.children) && props.node.children.length > 0 ? (<> - Has children - ) : null} + {Array.isArray(props.node.children) && props.node.children.length > 0 ? ( + <>Has children + ) : null}
); -} +}; export default OrgAst; diff --git a/src/shadow.tsx b/src/shadow.tsx index acc1e3d..6c82d55 100644 --- a/src/shadow.tsx +++ b/src/shadow.tsx @@ -9,7 +9,10 @@ function buildShadow(highlights: Highlight[], text: string): ReactNode[] { let buffer = ""; for (let chr of text) { if (state == ShadowState.Text) { - if (remaining_highlights.length > 0 && i == remaining_highlights[0].start) { + if ( + remaining_highlights.length > 0 && + i == remaining_highlights[0].start + ) { // Start a span output.push(buffer); buffer = chr; @@ -35,9 +38,9 @@ function buildShadow(highlights: Highlight[], text: string): ReactNode[] { if (buffer.length > 0) { if (state == ShadowState.Text) { - output.push(buffer); + output.push(buffer); } else if (state == ShadowState.Highlight) { - output.push({buffer}); + output.push({buffer}); } } return output; @@ -64,6 +67,4 @@ const enum ShadowState { Highlight, } -export { -buildShadow -} +export { buildShadow }; diff --git a/webpack.config.js b/webpack.config.js index 43ee625..a1ce3fe 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,10 +5,10 @@ const CSSModuleLoader = { loader: "css-loader", options: { importLoaders: 2, - sourceMap: true, - modules: { - localIdentName: '[name]_[local]_[hash:base64:5]', - } + sourceMap: true, + modules: { + localIdentName: "[name]_[local]_[hash:base64:5]", + }, }, };