generated from thedanchez/template-solidjs-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.ts
More file actions
123 lines (122 loc) · 3.76 KB
/
eslint.config.ts
File metadata and controls
123 lines (122 loc) · 3.76 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
122
123
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import solid from "eslint-plugin-solid/configs/typescript";
import globals from "globals";
import tseslint from "typescript-eslint";
export default defineConfig([
//
// ────────────────────────────────
// 1️⃣ Ignored paths (like .eslintignore)
// ────────────────────────────────
//
{
ignores: ["**/build/**", "**/coverage/**", "**/dist/**", "**/node_modules/**"],
},
//
// ────────────────────────────────
// 2️⃣ Base recommended rules
// ────────────────────────────────
//
js.configs.recommended,
tseslint.configs.strict,
//
// ────────────────────────────────
// 3️⃣ Import sorting
// ────────────────────────────────
//
{
plugins: {
"simple-import-sort": simpleImportSort,
},
rules: {
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
},
},
//
// ────────────────────────────────
// 3️⃣ TypeScript (General - Base rules)
// ────────────────────────────────
//
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
sourceType: "module",
},
globals: {
...globals.browser,
...globals.es2022,
...globals.node,
},
},
rules: {
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "after-used",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
},
],
"no-restricted-syntax": [
"error",
{
selector: "TSEnumDeclaration",
message:
"Enums are not allowed in this project. Use union types or plain objects instead.",
},
],
},
},
//
// ────────────────────────────────
// 4️⃣ SolidJS + TypeScript
// ────────────────────────────────
//
{
files: ["playground/**/*.ts", "playground/**/*.tsx"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
sourceType: "module",
project: "./tsconfig.json",
ecmaFeatures: { jsx: true },
},
globals: {
...globals.browser,
...globals.es2022,
},
},
plugins: {
solid: {
meta: solid.plugins.solid.meta,
// @ts-expect-error — Solid config typing is a bit off
rules: solid.plugins.solid.rules,
},
},
rules: {
...solid.rules,
"@typescript-eslint/no-non-null-assertion": "off",
},
},
//
// ────────────────────────────────
// 5️⃣ Test environment
// ────────────────────────────────
//
{
files: ["__tests__/**/*.ts", "__tests__/**/*.tsx"],
languageOptions: {
globals: {
...globals.node,
...globals.vitest,
},
},
},
]);