-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.mjs
More file actions
83 lines (79 loc) · 2.43 KB
/
eslint.config.mjs
File metadata and controls
83 lines (79 loc) · 2.43 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
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
import tseslint from "typescript-eslint";
import stylisticPlugin from "@stylistic/eslint-plugin";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
const tsEslintConfig = tseslint.config(
...compat.extends("next/core-web-vitals", "next/typescript"),
{
ignores: [
".next",
".vercel",
"node_modules",
"src/@generated",
"src/app/(payload)",
"eslint.config.js",
],
},
{
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
extends: [
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
plugins: {
"@stylistic": stylisticPlugin,
},
rules: {
"@typescript-eslint/array-type": ["warn", { default: "array" }],
"@typescript-eslint/consistent-type-definitions": ["off"],
"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "separate-type-imports",
},
],
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-misused-promises": [
2,
{
checksVoidReturn: { attributes: false },
},
],
"@stylistic/array-bracket-newline": ["warn", "consistent"],
"@stylistic/array-element-newline": ["warn", "consistent"],
"@stylistic/object-curly-newline": ["warn", { "consistent": true }],
"@stylistic/quotes": [
"warn",
"double",
{ "avoidEscape": true, "allowTemplateLiterals": "never" },
],
"@stylistic/comma-dangle": ["warn", "always-multiline"],
"@stylistic/object-curly-spacing": ["warn", "always"],
"@stylistic/array-bracket-spacing": ["warn", "never"],
"@stylistic/arrow-parens": ["warn", "always"],
"@stylistic/semi": ["warn", "always"],
"@stylistic/indent": ["warn", 2],
"@stylistic/function-paren-newline": ["warn", "multiline-arguments"],
"@stylistic/no-trailing-spaces": ["warn"],
"@stylistic/eol-last": ["warn", "always"],
},
},
{
linterOptions: {
reportUnusedDisableDirectives: true,
},
languageOptions: {
parserOptions: {
projectService: true,
},
},
},
);
export default tsEslintConfig;