Skip to content

Commit 1f64a28

Browse files
authored
Migrate to ESLint v9 with strict rules (#39)
* Update keywords * Seems like we are getting somewhere * This is hard * Update configs * Replace app lint with default next strict * Getting there * Web is linting * Make it work finally * Clean up * Use types over interfaces
1 parent 5b1bb79 commit 1f64a28

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1016
-3085
lines changed

apps/web/.eslintrc.cjs

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

apps/web/eslint.config.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// @ts-check
2+
/* eslint-disable */
3+
import { FlatCompat } from "@eslint/eslintrc";
4+
import baseConfig from "@repo/eslint-config/base";
5+
import tseslint from "typescript-eslint";
6+
7+
const compat = new FlatCompat({
8+
baseDirectory: import.meta.dirname,
9+
});
10+
11+
export default tseslint.config(
12+
...baseConfig,
13+
...compat.config({
14+
extends: ["next"],
15+
settings: {
16+
next: {
17+
rootDir: "apps/web/", // required for monorepos
18+
},
19+
},
20+
}),
21+
tseslint.configs.strictTypeChecked,
22+
tseslint.configs.stylisticTypeChecked,
23+
{
24+
languageOptions: {
25+
parserOptions: {
26+
projectService: true,
27+
tsconfigRootDir: import.meta.dirname,
28+
},
29+
},
30+
rules: {
31+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
32+
},
33+
}
34+
);

apps/web/next.config.mjs

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

apps/web/package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,25 @@
1818
"@typed-firestore/react": "1.0.0-0",
1919
"class-variance-authority": "^0.7.1",
2020
"clsx": "^2.1.1",
21-
"firebase": "^11.1.0",
22-
"lucide-react": "^0.471.0",
23-
"next": "15.1.4",
24-
"react": "19.0.0",
25-
"react-dom": "19.0.0",
21+
"firebase": "^11.2.0",
22+
"lucide-react": "^0.473.0",
23+
"next": "^15.1.5",
24+
"react": "^19.0.0",
25+
"react-dom": "^19.0.0",
2626
"tailwind-merge": "^2.6.0",
2727
"tailwindcss-animate": "^1.0.7",
2828
"typescript": "^5.7.3"
2929
},
3030
"devDependencies": {
3131
"@codecompose/typescript-config": "^1.2.0",
3232
"@repo/eslint-config": "workspace:*",
33-
"@types/node": "^22.10.5",
34-
"@types/react": "^19.0.6",
33+
"@types/node": "^22.10.7",
34+
"@types/react": "^19.0.7",
3535
"@types/react-dom": "^19.0.3",
3636
"autoprefixer": "^10.4.20",
3737
"del-cli": "^6.0.0",
38-
"eslint": "8.57.0",
39-
"eslint-config-next": "15.1.4",
40-
"postcss": "^8.4.49",
38+
"eslint-config-next": "^15.1.5",
39+
"postcss": "^8.5.1",
4140
"tailwindcss": "^3.4.17"
4241
}
4342
}

apps/web/src/app/components/counter-view.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export function CounterView(props: { counterId: string }) {
2222
/>
2323
);
2424
} else {
25-
return <div>No counter document available. Please press "reset".</div>;
25+
return (
26+
<div>No counter document available. Please press &quot;reset&quot;.</div>
27+
);
2628
}
2729
}

apps/web/src/app/components/key-value-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type FsValue = string | number | boolean | null | FsTimestamp;
77

88
export default function KeyValueList(props: {
99
data: Record<string, FsValue>;
10-
labels: Array<[string, string]>;
10+
labels: [string, string][];
1111
}) {
1212
const rows = props.labels.map(([key, label]) => (
1313
<TableRow className="bg-white" key={key}>

apps/web/src/lib/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const endpoint = process.env.NEXT_PUBLIC_DEMO_API_ENDPOINT;
1+
const endpoint =
2+
process.env.NEXT_PUBLIC_DEMO_API_ENDPOINT ?? "__missing_demo_api_endpoint";
23

34
/**
45
* In a real application you would typically not embed an API key like this, as

apps/web/src/lib/firestore.ts

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

apps/web/src/lib/utils/fetch.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export async function fetchJson<T>(
22
endpoint: string,
3-
queryParams: { [key: string]: string | number | boolean | undefined } = {},
3+
queryParams: Record<string, string | number | boolean | undefined> = {},
44
options: RequestInit = {}
55
) {
66
const queryString = makeQueryString(queryParams);
@@ -17,27 +17,29 @@ export async function fetchJson<T>(
1717

1818
if (!response.ok) {
1919
throw new Error(
20-
`Fetch to ${url} failed with status ${
20+
`Fetch to ${url} failed with status ${String(
2121
response.status
22-
}. Response text: ${await response.text()}`
22+
)}. Response text: ${await response.text()}`
2323
);
2424
}
2525

2626
try {
27-
return response.json() as Promise<T>;
28-
} catch (err) {
27+
return (await response.json()) as T;
28+
} catch {
2929
throw new Error(`Failed to parse JSON from response of ${url}`);
3030
}
3131
}
3232

3333
function makeQueryString(
34-
params: { [key: string]: string | number | boolean | undefined } = {}
34+
params: Record<string, string | number | boolean | undefined> = {}
3535
) {
3636
const queryString = new URLSearchParams();
3737

3838
Object.entries(params)
3939
.filter(([, value]) => value !== undefined)
40-
.forEach(([name, value]) => queryString.append(name, String(value)));
40+
.forEach(([name, value]) => {
41+
queryString.append(name, String(value));
42+
});
4143

4244
return queryString.toString();
4345
}

apps/web/tsconfig.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
{
22
"extends": "@codecompose/typescript-config/nextjs.json",
3-
"include": ["src", ".next/types/**/*.ts"],
3+
"compilerOptions": {
4+
"plugins": [
5+
{
6+
"name": "next" // plugin comes installed with nextjs
7+
}
8+
]
9+
},
10+
"include": [
11+
"${configDir}",
12+
"${configDir}/**/*.json",
13+
"${configDir}/next-env.d.ts",
14+
"${configDir}/.next/types/**/*.ts",
15+
".next/types/**/*.ts"
16+
],
417
"references": [
518
{
619
"path": "../../packages/common"

0 commit comments

Comments
 (0)