Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

feat: no literals eslint rule #29

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
}
]
}
],
"react/jsx-no-literals": [
"error",
{
"noStrings": true,
"ignoreProps": true
}
]
}
}
13 changes: 7 additions & 6 deletions src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
'use client';

import { Inter } from 'next/font/google';

import SampleForm from '@/components/sample-form';
import serverLogger from '@/lib/axiom/log-server';
import { useScopedI18n } from '@/i18n/client';

const inter = Inter({ subsets: ['latin'] });

export default function Page() {
const t = useScopedI18n('common');

const logger = serverLogger();

logger.info('Hello from server logger!');

return (
<main
className={`flex h-screen flex-col items-center justify-center gap-8 text-center ${inter.className}`}>
<h1 className="text-4xl font-bold">
Next.js + Tailwind CSS + TypeScript
</h1>
<h2 className="text-lg font-bold text-gray-500">
with i18n, jest, zod, react-hook-form
</h2>
<h1 className="text-4xl font-bold">{t('title')}</h1>
<h2 className="text-lg font-bold text-gray-500">{t('subtitle')}</h2>
<SampleForm />
</main>
);
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/en/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export default {
'test#other': '{count} tests',
'test#one': 'test',

title: 'Next.js + Tailwind CSS + TypeScript',
subtitle: 'with i18n, jest, zod, react-hook-form',
} as const;
3 changes: 3 additions & 0 deletions src/i18n/sl/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ export default {
'test#two': '{count} testa',
'test#few': '{count} testi',
'test#other': '{count} testov',

title: 'Next.js + Tailwind CSS + TypeScript',
subtitle: 'with i18n, jest, zod, react-hook-form',
} as const;