Skip to content

Commit 780c3dc

Browse files
authored
Merge pull request #528 from ixartz/update-from-max
fix: add jsdoc support in ESLint
2 parents 98286c1 + ef14099 commit 780c3dc

File tree

14 files changed

+49
-39
lines changed

14 files changed

+49
-39
lines changed

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"typescript.tsdk": "node_modules/typescript/lib", // Use the workspace version of TypeScript
1010
"typescript.enablePromptUseWorkspaceTsdk": true, // For security reasons it's require that users opt into using the workspace version of typescript
1111
"typescript.preferences.autoImportSpecifierExcludeRegexes": [
12-
// useRouter should be imported from `next/navigation` instead of `next/router`
12+
// useRouter should be imported from `libs/I18nNavigation` instead of `next/router`
1313
"next/router",
1414
// give priority for Link to next/link instead of lucide-react
1515
"lucide-react",
@@ -18,7 +18,9 @@
1818
// Use Zod v4 instead of v3
1919
"zod/v3",
2020
// Sentry is imported with `import *`
21-
"@sentry/nextjs"
21+
"@sentry/nextjs",
22+
// Use Input from Shadcn UI instead of Input from Postcss
23+
"postcss"
2224
],
2325

2426
// Vitest

eslint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { dirname } from 'node:path';
22
import { fileURLToPath } from 'node:url';
33
import antfu from '@antfu/eslint-config';
4+
import jsdoc from 'eslint-plugin-jsdoc';
45
import jsxA11y from 'eslint-plugin-jsx-a11y';
56
import playwright from 'eslint-plugin-playwright';
67
import storybook from 'eslint-plugin-storybook';
@@ -55,14 +56,22 @@ export default antfu(
5556
// --- Custom Rule Overrides ---
5657
{
5758
rules: {
59+
// --- JSDoc Rules ---
60+
// To avoid redefine errors with Antfu, JSDoc rules are added here
61+
...jsdoc.configs['flat/recommended-typescript'].rules,
62+
5863
'antfu/no-top-level-await': 'off', // Allow top-level await
5964
'style/brace-style': ['error', '1tbs'], // Use the default brace style
6065
'ts/consistent-type-definitions': ['error', 'type'], // Use `type` instead of `interface`
6166
'react/prefer-destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
6267
'react-hooks/incompatible-library': 'off', // Disable warning for compilation skipped
68+
'react-hooks/exhaustive-deps': 'off', // Disable exhaustive-deps in useEffect
6369
'node/prefer-global/process': 'off', // Allow using `process.env`
6470
'test/padding-around-all': 'error', // Add padding in test files
6571
'test/prefer-lowercase-title': 'off', // Allow using uppercase titles in test titles
72+
'jsdoc/require-jsdoc': 'off', // JSDoc comments are optional
73+
'jsdoc/require-returns': 'off', // Return types are optional
74+
'jsdoc/require-hyphen-before-param-description': 'error', // Enforce hyphen before param description
6675
},
6776
},
6877
);

package-lock.json

Lines changed: 13 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"drizzle-kit": "^0.31.8",
8484
"eslint": "^9.39.2",
8585
"eslint-plugin-format": "^1.3.1",
86+
"eslint-plugin-jsdoc": "^62.5.4",
8687
"eslint-plugin-jsx-a11y": "^6.10.2",
8788
"eslint-plugin-playwright": "^2.5.1",
8889
"eslint-plugin-react-hooks": "^7.0.1",

playwright.config.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,25 @@ export default defineConfig<ChromaticConfig>({
1515
// Look for files with the .spec.js or .e2e.js extension
1616
testMatch: '*.@(spec|e2e).?(c|m)[jt]s?(x)',
1717
// Timeout per test, test running locally are slower due to database connections with PGLite
18-
timeout: 60 * 1000,
18+
timeout: 30 * 1000,
1919
// Fail the build on CI if you accidentally left test.only in the source code.
2020
forbidOnly: !!process.env.CI,
2121
// Reporter to use. See https://playwright.dev/docs/test-reporters
2222
reporter: process.env.CI ? 'github' : 'list',
2323

2424
expect: {
2525
// Set timeout for async expect matchers
26-
timeout: 20 * 1000,
26+
timeout: 15 * 1000,
2727
},
2828

2929
// Run your local dev server before starting the tests:
3030
// https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests
3131
webServer: {
32-
command: process.env.CI ? 'npx run-p db-server:memory start' : 'npx run-p db-server:memory dev:next',
32+
command: process.env.CI ? 'npx run-p db-server:memory start --race' : 'npx run-p db-server:memory dev:next --race',
3333
url: baseURL,
34-
timeout: 2 * 60 * 1000,
34+
timeout: 60 * 1000,
3535
reuseExistingServer: !process.env.CI,
36+
gracefulShutdown: { signal: 'SIGTERM', timeout: 2 * 1000 },
3637
env: {
3738
NEXT_PUBLIC_SENTRY_DISABLED: 'true',
3839
},
Lines changed: 1 addition & 0 deletions
Loading

src/app/[locale]/(auth)/dashboard/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { SignOutButton } from '@clerk/nextjs';
22
import { getTranslations, setRequestLocale } from 'next-intl/server';
3-
import Link from 'next/link';
43
import { LocaleSwitcher } from '@/components/LocaleSwitcher';
4+
import { Link } from '@/libs/I18nNavigation';
55
import { BaseTemplate } from '@/templates/BaseTemplate';
66

77
export default async function DashboardLayout(props: {

src/app/[locale]/(marketing)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getTranslations, setRequestLocale } from 'next-intl/server';
2-
import Link from 'next/link';
32
import { DemoBanner } from '@/components/DemoBanner';
43
import { LocaleSwitcher } from '@/components/LocaleSwitcher';
4+
import { Link } from '@/libs/I18nNavigation';
55
import { BaseTemplate } from '@/templates/BaseTemplate';
66

77
export default async function Layout(props: {

src/app/[locale]/(marketing)/portfolio/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Metadata } from 'next';
22
import { getTranslations, setRequestLocale } from 'next-intl/server';
33
import Image from 'next/image';
4-
import Link from 'next/link';
4+
import { Link } from '@/libs/I18nNavigation';
55

66
type IPortfolioProps = {
77
params: Promise<{ locale: string }>;

src/components/CounterForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import { zodResolver } from '@hookform/resolvers/zod';
44
import { useTranslations } from 'next-intl';
5-
import { useRouter } from 'next/navigation';
65
import { useForm } from 'react-hook-form';
6+
import { useRouter } from '@/libs/I18nNavigation';
77
import { CounterValidation } from '@/validations/CounterValidation';
88

99
export const CounterForm = () => {

0 commit comments

Comments
 (0)