Skip to content

Commit

Permalink
style: linting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyshlyaev177 committed Jun 29, 2024
1 parent a0306fb commit 150400f
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 34 deletions.
6 changes: 5 additions & 1 deletion packages/example-nextjs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
}
};

export default nextConfig;
14 changes: 8 additions & 6 deletions packages/example-nextjs/src/app/Refresh.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use client'
'use client';
import { Button } from './components/Button';


export const RefreshButton = ({ className}: {className: string}) => {

return <Button onClick={() => window.location.reload()} className={className}>Reload page</Button>
}
export const RefreshButton = ({ className }: { className: string }) => {
return (
<Button onClick={() => window.location.reload()} className={className}>
Reload page
</Button>
);
};
10 changes: 5 additions & 5 deletions packages/example-nextjs/src/app/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import { form } from './form';

export const Status = ({ className }: { className?: string }) => {
const { parse } = useUrlState(form);
const params = useSearchParams()
const params = useSearchParams();

return (
<div className={className}>
<h2 className='font-bold mb-4'>Other client component</h2>
<Field className='h-full'>
<h2 className="font-bold mb-4">Other client component</h2>
<Field className="h-full">
<h3 className="font-extrabold text-lg">Types of data are presered</h3>
<pre
className="h-full p-2 rounded-sm bg-slate-100
dark:text-black text-wrap break-all whitespace-pre-wrap self-stretch overflow-y-auto grow-0"
dark:text-black text-wrap break-all whitespace-pre-wrap
self-stretch overflow-y-auto grow-0"
>
{JSON.stringify(parse(params), null, 2)}
</pre>
</Field>
</div>

);
};
4 changes: 2 additions & 2 deletions packages/example-nextjs/src/app/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
interface Props extends React.DOMAttributes<HTMLButtonElement> {
className?: string;
children: React.ReactNode;
disabled?: boolean
disabled?: boolean;
}
export const Button = ({ className, children, disabled, ...props }: Props) => {
return (
<button
disabled={disabled}
disabled={disabled}
className={`p-4 font-semibold rounded-md
bg-sky-200 dark:bg-sky-200
hover:bg-sky-300 hover:dark:bg-sky-300
Expand Down
4 changes: 2 additions & 2 deletions packages/example-nextjs/src/app/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ export const form: Form = {
name: '',
age: '',
'agree to terms': false,
tags: []
tags: [],
};

type Form = {
name: string;
age: number | string;
'agree to terms': boolean;
tags: { id: string, value: { text: string, time: Date }}[]
tags: { id: string; value: { text: string; time: Date } }[];
};
13 changes: 6 additions & 7 deletions packages/example-nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import "./globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
const inter = Inter({ subsets: ["latin"] });

import './globals.css';
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
const inter = Inter({ subsets: ['latin'] });

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: 'Create Next App',
description: 'Generated by create next app',
};

export default function RootLayout({
Expand Down
4 changes: 1 addition & 3 deletions packages/example-nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export default function Home() {
</Suspense>
<RefreshButton className="basis-1/7 text-center self-center" />
<Suspense>
<Status
className="basis-3/7 min-h-[300px] w-full"
/>
<Status className="basis-3/7 min-h-[300px] w-full" />
</Suspense>
</div>
</main>
Expand Down
9 changes: 7 additions & 2 deletions packages/example-nextjs/src/app/test/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Suspense } from 'react';
import { Comp1 } from './Comp1';
import { Comp2 } from './Comp2';

Expand All @@ -8,8 +9,12 @@ const Page = () => {
<h2>Page for testing purposes</h2>
</div>
<div className="flex gap-4">
<Comp1 className="basis-1/2" />
<Comp2 className="basis-1/2" />
<Suspense>
<Comp1 className="basis-1/2" />
</Suspense>
<Suspense>
<Comp2 className="basis-1/2" />
</Suspense>
</div>
</div>
);
Expand Down
8 changes: 4 additions & 4 deletions packages/example-nextjs/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Config } from "tailwindcss";
import type { Config } from 'tailwindcss';
// import colors from "tailwindcss/colors";

const config: Config = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
// theme: { colors: { ...colors } },
plugins: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/url-state/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('typeOf', () => {
});

it('date', () => {
const d = new Date()
const d = new Date();
expect(typeOf(d)).toEqual('date');
});

Expand Down
3 changes: 2 additions & 1 deletion packages/url-state/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ export type Type =
| 'symbol'
| 'array';

// eslint-disable-next-line complexity
export const typeOf = (val: unknown): Type => {
const isNull = val === null;
const isArray = Array.isArray(val);
const isDate = val instanceof Date
const isDate = val instanceof Date;
const isObject = !isNull && !isDate && !isArray && typeof val === 'object';

return (
Expand Down

0 comments on commit 150400f

Please sign in to comment.