Skip to content

Commit 53ed310

Browse files
upgrade eslint
1 parent fdf4b66 commit 53ed310

File tree

10 files changed

+223
-237
lines changed

10 files changed

+223
-237
lines changed

packages/web/.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/web/.eslintrc.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/web/eslint.config.mjs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import nextCoreWebVitals from 'eslint-config-next/core-web-vitals';
2+
import tseslint from 'typescript-eslint';
3+
import tanstackQuery from '@tanstack/eslint-plugin-query';
4+
5+
const config = [
6+
...nextCoreWebVitals,
7+
...tseslint.configs.recommended,
8+
...tanstackQuery.configs['flat/recommended'],
9+
{
10+
rules: {
11+
// New react-hooks v7 rules disabled as too strict for this codebase's existing patterns.
12+
// `set-state-in-effect` flags a very common legitimate pattern (reading external state
13+
// into local state on mount / dependency change). `incompatible-library` produces false
14+
// positives against @tanstack/react-table and similar libraries.
15+
'react-hooks/set-state-in-effect': 'off',
16+
'react-hooks/incompatible-library': 'off',
17+
// `preserve-manual-memoization` is only relevant when the React Compiler is enabled.
18+
'react-hooks/preserve-manual-memoization': 'off',
19+
// `immutability` produces false positives for recursive useCallback patterns and
20+
// intentional module-level regex lastIndex resets.
21+
'react-hooks/immutability': 'off',
22+
23+
'react-hooks/exhaustive-deps': 'warn',
24+
'no-unused-vars': 'off',
25+
'no-extra-semi': 'off',
26+
},
27+
},
28+
{
29+
files: ['**/*.ts', '**/*.tsx'],
30+
rules: {
31+
'@typescript-eslint/no-unused-vars': [
32+
'warn',
33+
{
34+
argsIgnorePattern: '^_',
35+
varsIgnorePattern: '^_',
36+
caughtErrorsIgnorePattern: '^_',
37+
},
38+
],
39+
},
40+
},
41+
{
42+
// Replaces .eslintignore
43+
ignores: [
44+
'src/components/**',
45+
'next-env.d.ts',
46+
'src/proto/**',
47+
],
48+
},
49+
];
50+
51+
export default config;

packages/web/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,18 @@
207207
"@typescript-eslint/eslint-plugin": "^8.40.0",
208208
"@typescript-eslint/parser": "^8.40.0",
209209
"cross-env": "^7.0.3",
210-
"eslint": "^8",
210+
"eslint": "^9",
211211
"eslint-config-next": "16.1.6",
212212
"eslint-plugin-react": "^7.37.5",
213-
"eslint-plugin-react-hooks": "^5.2.0",
213+
"eslint-plugin-react-hooks": "^7.0.1",
214214
"jsdom": "^25.0.1",
215215
"npm-run-all": "^4.1.5",
216216
"postcss": "^8",
217217
"react-email": "^5.1.0",
218218
"tailwindcss": "^3.4.1",
219219
"tsx": "^4.19.2",
220220
"typescript": "^5",
221+
"typescript-eslint": "^8.56.1",
221222
"vite-tsconfig-paths": "^5.1.3",
222223
"vitest": "^2.1.5",
223224
"vitest-mock-extended": "^3.1.0"

packages/web/src/app/[domain]/chat/[id]/opengraph-image.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ export default async function Image({ params }: ImageProps) {
118118
}}
119119
>
120120
{/* Avatar */}
121-
{/* eslint-disable-next-line @next/next/no-img-element */}
122121
<img
123122
src={creatorImage ?? `${env.AUTH_URL}/placeholder_avatar.png`}
124123
alt="Avatar"
@@ -165,7 +164,6 @@ export default async function Image({ params }: ImageProps) {
165164
>
166165
sourcebot.dev
167166
</span>
168-
{/* eslint-disable-next-line @next/next/no-img-element */}
169167
<img
170168
src={`${env.AUTH_URL}/sb_logo_dark_small.png`}
171169
alt="Sourcebot"

packages/web/src/app/[domain]/components/navigationMenu/trialIndicator.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const TrialIndicator = ({ subscription }: Props) => {
3333
<div className="flex items-center gap-2 px-3 py-1.5 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-full text-blue-700 dark:text-blue-400 text-xs font-medium hover:bg-blue-100 dark:hover:bg-blue-900/30 transition-colors cursor-pointer">
3434
<span className="inline-block w-2 h-2 bg-blue-400 dark:bg-blue-500 rounded-full"></span>
3535
<span>
36+
{/* eslint-disable-next-line react-hooks/purity -- Date.now() during render is intentional for displaying remaining trial days */}
3637
{Math.ceil((subscription.nextBillingDate * 1000 - Date.now()) / (1000 * 60 * 60 * 24))} days left in trial
3738
</span>
3839
</div>

packages/web/src/app/error.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function Error({ error, reset }: { error: Error & { digest?: stri
2929
statusCode: serviceError.statusCode,
3030
}
3131
}
32-
/* eslint-disable no-empty */
32+
3333
} catch {}
3434

3535
return {

packages/web/src/features/chat/components/chatThread/answerCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const AnswerCardComponent = forwardRef<HTMLDivElement, AnswerCardProps>(({
3838
traceId,
3939
}, forwardedRef) => {
4040
const markdownRendererRef = useRef<HTMLDivElement>(null);
41+
// eslint-disable-next-line react-hooks/refs -- ref.current is passed to a custom hook, not used directly in render output
4142
const { tocItems, activeId } = useExtractTOCItems({ target: markdownRendererRef.current });
4243
const [isTOCButtonToggled, setIsTOCButtonToggled] = useState(false);
4344
const { toast } = useToast();

packages/web/src/lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const createInviteLink = (baseUrl: string, inviteLinkId?: string | null):
4444
*/
4545
export const createPathWithQueryParams = (path: string, ...queryParams: [string, string | null][]) => {
4646
// Filter out undefined values
47-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
47+
4848
queryParams = queryParams.filter(([_key, value]) => value !== null);
4949

5050
if (queryParams.length === 0) {

0 commit comments

Comments
 (0)