generated from acdh-oeaw/template-app-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
86 lines (83 loc) · 2.35 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/** @typedef {import("typescript-eslint").Config} Config */
import baseConfig from "@acdh-oeaw/eslint-config";
import nextConfig from "@acdh-oeaw/eslint-config-next";
import nodeConfig from "@acdh-oeaw/eslint-config-node";
import playwrightConfig from "@acdh-oeaw/eslint-config-playwright";
import reactConfig from "@acdh-oeaw/eslint-config-react";
import tailwindcssConfig from "@acdh-oeaw/eslint-config-tailwindcss";
import gitignore from "eslint-config-flat-gitignore";
// @ts-expect-error Missing type declaration.
import checkFilePlugin from "eslint-plugin-check-file";
/** @type {Config} */
const config = [
gitignore({ strict: false }),
...baseConfig,
...reactConfig,
...nextConfig,
...tailwindcssConfig,
...playwrightConfig,
{
plugins: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
"check-file": checkFilePlugin,
},
rules: {
"check-file/filename-naming-convention": [
"error",
{
"**/*": "KEBAB_CASE",
},
{ ignoreMiddleExtensions: true },
],
"check-file/folder-naming-convention": [
"error",
{
"**/": "NEXT_JS_APP_ROUTER_CASE",
},
],
},
},
{
rules: {
"arrow-body-style": ["error", "always"],
"no-restricted-imports": [
"error",
{
name: "next/image",
message: "Please use `@/components/image` or `@/components/server-image` instead.",
},
{
name: "next/link",
message: "Please use `@/components/link` instead.",
},
{
name: "next/navigation",
importNames: ["redirect", "permanentRedirect", "useRouter", "usePathname"],
message: "Please use `@/lib/i18n/navigation` instead.",
},
{
name: "next/router",
message: "Please use `@/lib/i18n/navigation` instead.",
},
],
"no-restricted-syntax": [
"error",
{
selector: 'MemberExpression[computed!=true][object.name="process"][property.name="env"]',
message: "Please use `@/config/env.config` instead.",
},
],
// "@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/require-array-sort-compare": "error",
// "@typescript-eslint/strict-boolean-expressions": "error",
"react/jsx-sort-props": ["error", { reservedFirst: true }],
},
},
...nodeConfig.map((config) => {
return {
files: ["db/**/*.ts", "lib/server/**/*.ts", "**/_actions/**/*.ts"],
...config,
};
}),
];
export default config;