-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
134 lines (123 loc) · 3.14 KB
/
eslint.config.mjs
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
122
123
124
125
126
127
128
129
130
131
132
133
134
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import solid from "eslint-plugin-solid";
import sortKeysFix from "eslint-plugin-sort-keys-fix";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
allConfig: js.configs.all,
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
export default [
{
ignores: [
"**/logs",
"**/*.log",
"**/pids",
"**/*.pid",
"**/*.seed",
"**/coverage",
"**/.eslintcache",
"**/node_modules",
"**/.DS_Store",
"release/app/dist",
"release/build",
".erb/dll",
"**/.idea",
"**/npm-debug.log.*",
"**/*.css.d.ts",
"**/*.sass.d.ts",
"**/*.scss.d.ts",
"**/.eslintrc.js",
"**/dist",
"**/vite.config.ts",
"**/plopfile.js",
],
},
...fixupConfigRules(
compat.extends(
"eslint:recommended",
"plugin:import-x/typescript",
"plugin:jsx-a11y/recommended",
"plugin:promise/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:solid/typescript",
"plugin:prettier/recommended",
),
),
{
languageOptions: {
ecmaVersion: 12,
globals: {
...globals.browser,
...globals.node,
},
parser: tsParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: ["tsconfig.json"],
},
sourceType: "module",
},
plugins: {
solid: fixupPluginRules(solid),
"sort-keys-fix": sortKeysFix,
},
rules: {
"@typescript-eslint/array-type": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/naming-convention": [
"error",
{
format: ["PascalCase"],
prefix: ["is", "should", "has", "can", "did", "will"],
selector: "variable",
types: ["boolean"],
},
{
custom: {
match: false,
regex: "^(I|T|E)[A-Z]",
},
format: ["PascalCase"],
selector: "typeLike",
},
],
"@typescript-eslint/no-unused-expressions": [
"error",
{
enforceForJSX: true,
},
],
curly: "error",
eqeqeq: ["error", "smart"],
"max-params": ["error", 3],
"no-await-in-loop": "error",
"no-console": "warn",
"no-constant-binary-expression": "error",
"no-duplicate-imports": "error",
"no-lonely-if": "error",
"no-self-compare": "error",
"no-unneeded-ternary": "error",
"no-use-before-define": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prettier/prettier": [
"error",
{
endOfLine: "auto",
},
],
"require-await": "error",
"sort-keys-fix/sort-keys-fix": "warn",
},
},
];