Skip to content

Commit

Permalink
fix: typescript errors with esm and cjs (#38)
Browse files Browse the repository at this point in the history
* chore: fix types

* chore: fixes for build using esm and cjs

* chore: linter
  • Loading branch information
Michael-Liendo authored Sep 5, 2024
1 parent dd4bcd1 commit f779593
Show file tree
Hide file tree
Showing 101 changed files with 3,072 additions and 3,169 deletions.
49 changes: 25 additions & 24 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "warn",
"useExhaustiveDependencies": "off"
},
"complexity": { "noStaticOnlyClass": "off" }
}
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "warn",
"noUnusedImports": "warn",
"useExhaustiveDependencies": "off"
},
"complexity": { "noStaticOnlyClass": "off", "noForEach": "info" }
}
},
"formatter": {
"enabled": true
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "single",
"quoteStyle": "single"
}
}
}
24 changes: 1 addition & 23 deletions client/biome.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "warn",
"useExhaustiveDependencies": "off"
},
"complexity": { "noStaticOnlyClass": "off", "noForEach": "off" }
}
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
"extends": ["../biome.json"]
}
24 changes: 12 additions & 12 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { LinksProvider } from './context/LinksContext';
import { ThemeProvider } from './context/ThemeContext';

function App() {
return (
<>
<AuthProvider>
<LinksProvider>
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
<Routes />
</ThemeProvider>
</LinksProvider>
</AuthProvider>
<Toaster />
</>
);
return (
<>
<AuthProvider>
<LinksProvider>
<ThemeProvider defaultTheme='dark' storageKey='vite-ui-theme'>
<Routes />
</ThemeProvider>
</LinksProvider>
</AuthProvider>
<Toaster />
</>
);
}

export default App;
58 changes: 29 additions & 29 deletions client/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,47 @@ import Signup from './pages/(auth)/Signup';
export enum PublicRoutesEnum {}

export enum AuthRoutesEnum {
login = '/',
Signup = '/signup',
Welcome = '/welcome',
login = '/',
Signup = '/signup',
Welcome = '/welcome',
}

export enum PrivateRoutesEnum {
Home = '/home',
Home = '/home',
}

export function Routes() {
const { user } = useAuth();
return (
<ReactRoutes>
{user
? PrivateRoutes.map((route) => route)
: AuthRoutes.map((route) => route)}
{PublicRoutes.map((route) => route)}
</ReactRoutes>
);
const { user } = useAuth();
return (
<ReactRoutes>
{user
? PrivateRoutes.map((route) => route)
: AuthRoutes.map((route) => route)}
{PublicRoutes.map((route) => route)}
</ReactRoutes>
);
}

const PrivateRoutes: JSX.Element[] = [
<Route
key={PrivateRoutesEnum.Home}
path={PrivateRoutesEnum.Home}
Component={HomeApp}
/>,
<Route key={'no-found'} path={'*'} Component={() => <>No Found</>} />,
<Route
key={PrivateRoutesEnum.Home}
path={PrivateRoutesEnum.Home}
Component={HomeApp}
/>,
<Route key={'no-found'} path={'*'} Component={() => <>No Found</>} />,
];

const AuthRoutes: JSX.Element[] = [
<Route
key={AuthRoutesEnum.Signup}
path={AuthRoutesEnum.Signup}
Component={Signup}
/>,
<Route
key={AuthRoutesEnum.login}
path={AuthRoutesEnum.login}
Component={Login}
/>,
<Route
key={AuthRoutesEnum.Signup}
path={AuthRoutesEnum.Signup}
Component={Signup}
/>,
<Route
key={AuthRoutesEnum.login}
path={AuthRoutesEnum.login}
Component={Login}
/>,
];

const PublicRoutes: JSX.Element[] = [];
58 changes: 29 additions & 29 deletions client/src/actions/copyTextToClipboard.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
function fallbackCopyTextToClipboard(text: string) {
const textArea = document.createElement('textarea');
textArea.value = text;
const textArea = document.createElement('textarea');
textArea.value = text;

// Avoid scrolling to bottom
textArea.style.top = '0';
textArea.style.left = '0';
textArea.style.position = 'fixed';
// Avoid scrolling to bottom
textArea.style.top = '0';
textArea.style.left = '0';
textArea.style.position = 'fixed';

document.body.appendChild(textArea);
textArea.focus();
textArea.select();
document.body.appendChild(textArea);
textArea.focus();
textArea.select();

try {
const successful = document.execCommand('copy');
const msg = successful ? 'successful' : 'unsuccessful';
console.log(`Fallback: Copying text command was ${msg}`);
} catch (err) {
console.error('Fallback: Oops, unable to copy', err);
}
try {
const successful = document.execCommand('copy');
const msg = successful ? 'successful' : 'unsuccessful';
console.log(`Fallback: Copying text command was ${msg}`);
} catch (err) {
console.error('Fallback: Oops, unable to copy', err);
}

document.body.removeChild(textArea);
document.body.removeChild(textArea);
}
export function copyTextToClipboard(text: string) {
if (!navigator.clipboard) {
fallbackCopyTextToClipboard(text);
return;
}
navigator.clipboard.writeText(text).then(
() => {
console.log('Async: Copying to clipboard was successful!');
},
(err) => {
console.error('Async: Could not copy text: ', err);
},
);
if (!navigator.clipboard) {
fallbackCopyTextToClipboard(text);
return;
}
navigator.clipboard.writeText(text).then(
() => {
console.log('Async: Copying to clipboard was successful!');
},
(err) => {
console.error('Async: Could not copy text: ', err);
},
);
}
64 changes: 32 additions & 32 deletions client/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
export default function Navbar() {
return (
<>
<nav className="p-4 border-b-2 border-blue-500">
<div className="container mx-auto flex justify-between items-center">
<div className="text-slate-950 text-2xl font-bold">
<img
className="w-20"
src="/public/logotypeLinx.png"
alt="Logotype Linx"
/>
</div>
<ul className="flex space-x-4">
<li>
<a href="#product" className="text-slate-950 hover:text-blue-700">
Product
</a>
</li>
<li>
<a href="#login" className="text-slate-950 hover:text-blue-700">
Login
</a>
</li>
<li>
<a href="#signup" className="text-slate-950 hover:text-blue-700">
Sign Up
</a>
</li>
</ul>
</div>
</nav>
</>
);
return (
<>
<nav className='p-4 border-b-2 border-blue-500'>
<div className='container mx-auto flex justify-between items-center'>
<div className='text-slate-950 text-2xl font-bold'>
<img
className='w-20'
src='/public/logotypeLinx.png'
alt='Logotype Linx'
/>
</div>
<ul className='flex space-x-4'>
<li>
<a href='#product' className='text-slate-950 hover:text-blue-700'>
Product
</a>
</li>
<li>
<a href='#login' className='text-slate-950 hover:text-blue-700'>
Login
</a>
</li>
<li>
<a href='#signup' className='text-slate-950 hover:text-blue-700'>
Sign Up
</a>
</li>
</ul>
</div>
</nav>
</>
);
}
Loading

0 comments on commit f779593

Please sign in to comment.