-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy patheslint.config.ts
More file actions
121 lines (118 loc) · 2.93 KB
/
eslint.config.ts
File metadata and controls
121 lines (118 loc) · 2.93 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import * as path from "node:path";
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 tailwindConfig from "@acdh-oeaw/eslint-config-tailwindcss";
import { defineConfig, globalIgnores } from "eslint/config";
import gitignore from "eslint-config-flat-gitignore";
import checkFilePlugin from "eslint-plugin-check-file";
const restrictedImports = {
paths: [
{
name: "next/image",
allowImportNames: ["StaticImageData"],
message: "Please use `@/components/image` instead.",
},
{
name: "next/router",
message: "Please use `next/navigation` instead.",
},
],
};
export default defineConfig(
gitignore({ strict: false }),
globalIgnores(["content/**", "public/**"]),
baseConfig,
reactConfig,
nextConfig,
{
name: "tailwindcss-config",
extends: [tailwindConfig],
rules: {
"better-tailwindcss/no-unknown-classes": ["error", { ignore: ["lead", "not-prose"] }],
},
settings: {
"better-tailwindcss": {
entryPoint: path.resolve("./styles/index.css"),
},
},
},
playwrightConfig,
{
plugins: {
"check-file": checkFilePlugin,
},
rules: {
"check-file/filename-naming-convention": [
"error",
{
"**/*": "?(_)+([a-z])*([a-z0-9])*(-+([a-z0-9]))",
},
{ ignoreMiddleExtensions: true },
],
"check-file/folder-naming-convention": [
"error",
{
"**/": "NEXT_JS_APP_ROUTER_CASE",
},
],
},
},
{
rules: {
"arrow-body-style": ["error", "always"],
"no-restricted-imports": ["error", restrictedImports],
"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",
/** Avoid hardcoded, non-translated strings. */
"react/jsx-no-literals": [
"error",
{
allowedStrings: [
"&",
"'",
"•",
"©",
">",
"<",
" ",
""",
"→",
"←",
"—",
"–",
".",
"!",
":",
";",
",",
"-",
"(",
")",
"|",
"/",
],
},
],
"@typescript-eslint/strict-boolean-expressions": "error",
"react/jsx-sort-props": ["error", { reservedFirst: true }],
"@eslint-react/no-array-index-key": "off",
"@eslint-react/no-unstable-default-props": "off",
"@eslint-react/prefer-destructuring-assignment": "off",
"@eslint-react/prefer-read-only-props": "error",
},
},
{
files: ["db/**/*.ts", "lib/server/**/*.ts", "**/_lib/actions/**/*.ts", "scripts/**/*.ts"],
extends: [nodeConfig],
},
);