This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from nada-deriv/nada/WEBREL-1317/prettier
feat: add prettier config
- Loading branch information
Showing
13 changed files
with
146 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
{} | ||
{ | ||
"endOfLine": "lf", | ||
"singleQuote": true, | ||
"useTabs": false, | ||
"tabWidth": 4, | ||
"trailingComma": "es5", | ||
"printWidth": 120, | ||
"jsxSingleQuote": true, | ||
"arrowParens": "avoid", | ||
"proseWrap": "preserve" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
{ | ||
"name": "smarttrader", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"preview": "vite preview", | ||
"test": "vitest" | ||
}, | ||
"dependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@testing-library/jest-dom": "^6.1.3", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.5.1", | ||
"@types/node": "^20.6.3", | ||
"@types/react": "^18.2.15", | ||
"@types/react-dom": "^18.2.7", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"@vitejs/plugin-react": "^4.0.3", | ||
"eslint": "^8.45.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-refresh": "^0.4.3", | ||
"jsdom": "^22.1.0", | ||
"prettier": "3.0.3", | ||
"typescript": "^5.0.2", | ||
"vite": "^4.4.5", | ||
"vitest": "^0.34.5" | ||
} | ||
"name": "smarttrader", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"prettier": "prettier --write \"./src/**/*.{js,jsx,ts,tsx}\"", | ||
"preview": "vite preview", | ||
"test": "vitest" | ||
}, | ||
"dependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@testing-library/jest-dom": "^6.1.3", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.5.1", | ||
"@types/node": "^20.6.3", | ||
"@types/react": "^18.2.15", | ||
"@types/react-dom": "^18.2.7", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"@vitejs/plugin-react": "^4.0.3", | ||
"eslint": "^8.45.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-refresh": "^0.4.3", | ||
"jsdom": "^22.1.0", | ||
"prettier": "3.0.3", | ||
"typescript": "^5.0.2", | ||
"vite": "^4.4.5", | ||
"vitest": "^0.34.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import ErrorBoundary from "Components/common/error-boundary"; | ||
import Layout from "Components/layout"; | ||
import AuthProvider from "Contexts/authProvider"; | ||
import ErrorBoundary from 'Components/common/error-boundary'; | ||
import Layout from 'Components/layout'; | ||
import AuthProvider from 'Contexts/authProvider'; | ||
|
||
const App = () => ( | ||
<AuthProvider> | ||
<ErrorBoundary> | ||
<Layout>App</Layout> | ||
</ErrorBoundary> | ||
</AuthProvider> | ||
<AuthProvider> | ||
<ErrorBoundary> | ||
<Layout>App</Layout> | ||
</ErrorBoundary> | ||
</AuthProvider> | ||
); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import ChartTemplate from "./chart-template"; | ||
import ChartType from "./chart-type"; | ||
import Comparisons from "./comparisons"; | ||
import DrawingTools from "./drawing-tools"; | ||
import Indicators from "./indicators"; | ||
import ShareChart from "./share-chart"; | ||
import TimeInterval from "./time-interval"; | ||
import ChartTemplate from './chart-template'; | ||
import ChartType from './chart-type'; | ||
import Comparisons from './comparisons'; | ||
import DrawingTools from './drawing-tools'; | ||
import Indicators from './indicators'; | ||
import ShareChart from './share-chart'; | ||
import TimeInterval from './time-interval'; | ||
|
||
const Tools = () => ( | ||
<div | ||
// test styles, we should not write inline styles :)) | ||
style={{ display: "flex", alignItems: "center", justifyContent: "center" }} | ||
> | ||
<ChartTemplate /> | ||
<ChartType /> | ||
<Comparisons /> | ||
<DrawingTools /> | ||
<Indicators /> | ||
<ShareChart /> | ||
<TimeInterval /> | ||
</div> | ||
<div | ||
// test styles, we should not write inline styles :)) | ||
style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }} | ||
> | ||
<ChartTemplate /> | ||
<ChartType /> | ||
<Comparisons /> | ||
<DrawingTools /> | ||
<Indicators /> | ||
<ShareChart /> | ||
<TimeInterval /> | ||
</div> | ||
); | ||
|
||
export default Tools; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// Test for passing the github actions | ||
// TODO should update this test later | ||
import { describe, expect, test } from "vitest"; | ||
import { render, screen } from "@testing-library/react"; | ||
import Loading from ".."; | ||
import { describe, expect, test } from 'vitest'; | ||
import { render, screen } from '@testing-library/react'; | ||
import Loading from '..'; | ||
|
||
describe("Loading component", () => | ||
test("should show loading text", () => { | ||
render(<Loading />); | ||
expect(screen.getByText("loading")).toBeInTheDocument(); | ||
})); | ||
describe('Loading component', () => | ||
test('should show loading text', () => { | ||
render(<Loading />); | ||
expect(screen.getByText('loading')).toBeInTheDocument(); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { Fragment, PropsWithChildren } from "react"; | ||
import Header from "./header"; | ||
import Footer from "./footer"; | ||
import { Fragment, PropsWithChildren } from 'react'; | ||
import Header from './header'; | ||
import Footer from './footer'; | ||
|
||
const Layout = ({ children }: PropsWithChildren<unknown>) => ( | ||
<Fragment> | ||
<Header /> | ||
{children} | ||
<Footer /> | ||
</Fragment> | ||
<Fragment> | ||
<Header /> | ||
{children} | ||
<Footer /> | ||
</Fragment> | ||
); | ||
|
||
export default Layout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
import { PropsWithChildren, createContext, useState } from "react"; | ||
import { PropsWithChildren, createContext, useState } from 'react'; | ||
|
||
// @ts-ignore | ||
export const AuthContext = createContext(); | ||
// @ts-ignore | ||
export const AuthDispatcher = createContext(); | ||
|
||
const AuthProvider = ({ children }: PropsWithChildren<unknown>) => { | ||
const [test, setTest] = useState(false); | ||
const [test, setTest] = useState(false); | ||
|
||
return ( | ||
<AuthContext.Provider value={{ test }}> | ||
<AuthDispatcher.Provider value={{ setTest }}> | ||
{children} | ||
</AuthDispatcher.Provider> | ||
</AuthContext.Provider> | ||
); | ||
return ( | ||
<AuthContext.Provider value={{ test }}> | ||
<AuthDispatcher.Provider value={{ setTest }}>{children}</AuthDispatcher.Provider> | ||
</AuthContext.Provider> | ||
); | ||
}; | ||
|
||
export default AuthProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const useResponsive = () => { | ||
return {}; | ||
return {}; | ||
}; | ||
|
||
export default useResponsive; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import App from "./App.tsx"; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App.tsx'; | ||
|
||
ReactDOM.createRoot(document.getElementById("root")!).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// we can make this better later, I just put it there as an example | ||
|
||
export const setToStorage = <T>(key: string, data: T) => { | ||
localStorage.setItem(key, JSON.stringify(data)); | ||
return true; | ||
localStorage.setItem(key, JSON.stringify(data)); | ||
return true; | ||
}; | ||
|
||
export const getFromStorage = <T>(key: string): T => { | ||
const data = localStorage.getItem(key) || ""; | ||
return JSON.parse(data); | ||
const data = localStorage.getItem(key) || ''; | ||
return JSON.parse(data); | ||
}; |