Skip to content

Commit b576351

Browse files
committed
chore: update to Next.js 15 and ESLint 9, add turbopack command for dev
1 parent 22fb446 commit b576351

File tree

5 files changed

+1690
-1484
lines changed

5 files changed

+1690
-1484
lines changed

.eslintrc.json

-100
This file was deleted.

eslint.config.mjs

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import { dirname } from "path";
2+
import { fileURLToPath } from "url";
3+
4+
import { FlatCompat } from "@eslint/eslintrc";
5+
import js from "@eslint/js";
6+
import tsParser from "@typescript-eslint/parser";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = dirname(__filename);
10+
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
});
15+
16+
const eslintConfig = [
17+
...compat.extends(
18+
"eslint:recommended",
19+
"plugin:@typescript-eslint/recommended-type-checked",
20+
"plugin:@typescript-eslint/stylistic-type-checked",
21+
"plugin:import/recommended",
22+
"next/core-web-vitals",
23+
"next/typescript",
24+
"prettier",
25+
),
26+
{
27+
languageOptions: {
28+
parser: tsParser,
29+
parserOptions: {
30+
project: "./tsconfig.json",
31+
tsconfigRoot: __dirname,
32+
},
33+
},
34+
rules: {
35+
// sort imports
36+
"import/order": [
37+
"error",
38+
{
39+
"newlines-between": "always",
40+
alphabetize: {
41+
order: "asc",
42+
orderImportKind: "asc",
43+
},
44+
groups: ["builtin", "external", "index", "internal", "sibling", "parent", "object", "type"],
45+
},
46+
],
47+
48+
// no let exports
49+
"import/no-mutable-exports": "error",
50+
51+
"import/no-cycle": "error",
52+
"import/no-default-export": "error",
53+
54+
// allow {} even though it's unsafe but comes handy
55+
// @typescript-eslint/ban-types is deprecated
56+
"@typescript-eslint/no-restricted-types": [
57+
"error",
58+
{
59+
types: {
60+
"{}": {
61+
message: "it's unsafe but comes handy",
62+
},
63+
},
64+
},
65+
],
66+
67+
"@typescript-eslint/consistent-type-imports": [
68+
"error",
69+
{
70+
prefer: "type-imports",
71+
fixStyle: "inline-type-imports",
72+
disallowTypeAnnotations: false,
73+
},
74+
],
75+
76+
"import/no-duplicates": ["error", { "prefer-inline": true }],
77+
78+
// false negatives
79+
"import/namespace": ["off"],
80+
81+
// we allow empty interfaces
82+
"no-empty-pattern": "off",
83+
"@typescript-eslint/no-empty-interface": "off",
84+
85+
// we allow empty functions
86+
"@typescript-eslint/no-empty-function": "off",
87+
88+
// we sometimes use async functions that don't await anything
89+
"@typescript-eslint/require-await": "off",
90+
91+
// make sure to `await` inside try…catch
92+
"@typescript-eslint/return-await": ["error", "in-try-catch"],
93+
94+
// allow unused vars prefixed with `_`
95+
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
96+
97+
// numbers and booleans are fine in template strings
98+
"@typescript-eslint/restrict-template-expressions": [
99+
"error",
100+
{ allowNumber: true, allowBoolean: true },
101+
],
102+
103+
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
104+
105+
"no-restricted-imports": [
106+
"error",
107+
{
108+
name: "next/router",
109+
message: "Please use next/navigation instead.",
110+
},
111+
],
112+
},
113+
},
114+
{
115+
files: ["src/app/**/{page,layout,loading,route}.ts?(x)", "tailwind.config.ts"],
116+
rules: {
117+
"import/no-default-export": "off",
118+
},
119+
},
120+
{
121+
ignores: ["*.js", "*.jsx", "*.config.mjs"],
122+
},
123+
];
124+
125+
export default eslintConfig;

package.json

+24-22
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,34 @@
1010
"prepare": "husky"
1111
},
1212
"dependencies": {
13-
"@radix-ui/react-icons": "^1.3.0",
14-
"class-variance-authority": "^0.7.0",
13+
"@radix-ui/react-icons": "^1.3.2",
14+
"class-variance-authority": "^0.7.1",
1515
"clsx": "^2.1.1",
16-
"next": "14.2.5",
17-
"react": "18.3.1",
18-
"react-dom": "18.3.1",
19-
"tailwind-merge": "^2.4.0",
16+
"next": "15.1.4",
17+
"react": "19.0.0",
18+
"react-dom": "19.0.0",
19+
"tailwind-merge": "^2.6.0",
2020
"tailwindcss-animate": "^1.0.7"
2121
},
2222
"devDependencies": {
23-
"@next/env": "14.2.5",
24-
"@types/node": "20.14.12",
25-
"@types/react": "18.3.3",
26-
"@types/react-dom": "18.3.0",
27-
"@typescript-eslint/eslint-plugin": "7.17.0",
28-
"@typescript-eslint/parser": "7.17.0",
29-
"autoprefixer": "10.4.19",
30-
"eslint": "8.57.0",
31-
"eslint-config-next": "14.2.5",
23+
"@eslint/eslintrc": "^3.2.0",
24+
"@eslint/js": "^9.18.0",
25+
"@next/env": "15.1.4",
26+
"@types/node": "20.17.12",
27+
"@types/react": "19.0.6",
28+
"@types/react-dom": "19.0.3",
29+
"@typescript-eslint/eslint-plugin": "8.19.1",
30+
"@typescript-eslint/parser": "8.19.1",
31+
"autoprefixer": "10.4.20",
32+
"eslint": "9.18.0",
33+
"eslint-config-next": "15.1.4",
3234
"eslint-config-prettier": "9.1.0",
33-
"husky": "9.1.2",
34-
"lint-staged": "15.2.7",
35-
"postcss": "8.4.40",
36-
"prettier": "3.3.3",
37-
"prettier-plugin-tailwindcss": "0.6.5",
38-
"tailwindcss": "3.4.7",
39-
"typescript": "5.4.5"
35+
"husky": "9.1.7",
36+
"lint-staged": "15.3.0",
37+
"postcss": "8.4.49",
38+
"prettier": "3.4.2",
39+
"prettier-plugin-tailwindcss": "0.6.9",
40+
"tailwindcss": "3.4.17",
41+
"typescript": "5.7.3"
4042
}
4143
}

0 commit comments

Comments
 (0)