-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
162 lines (161 loc) · 5.67 KB
/
eslint.config.js
File metadata and controls
162 lines (161 loc) · 5.67 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import eslint from "@eslint/js";
import { defineConfig, globalIgnores } from "@eslint/config-helpers";
import tseslint from "typescript-eslint";
import prettierEslintDisables from "eslint-config-prettier";
import progress from "eslint-plugin-file-progress-2";
import path from "path";
import { fileURLToPath } from "url";
export default defineConfig([
globalIgnores([
"**/CHANGELOG.md",
"**/CHANGELOG.md",
"**/dist/**",
"**/node_modules/**",
"**/coverage/**",
"**/.github/chatmodes/**",
"**/playground/**",
"**/scripts/**",
"vitest.config.ts",
".chunkylint.ts",
]),
eslint.configs.all,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
name: "progress",
plugins: {
"file-progress": progress,
},
rules: {
"file-progress/activate": "warn",
},
settings: {
progress: {
hide: false, // hide progress output (useful in CI)
hideFileName: false, // show generic "Linting..." instead of file names
hidePrefix: false, // hide plugin prefix text before progress/summary output
hideDirectoryNames: false, // show only the filename (no directory path segments)
fileNameOnNewLine: true, // place filename on a second line under the linting prefix
successMessage: "Lint done...",
detailedSuccess: false, // show multi-line final summary (duration, file count, exit code)
spinnerStyle: "dots", // line | dots | arc | bounce | clock
prefixMark: "•", // marker after plugin name prefix in progress lines
successMark: "✔", // custom mark used for success completion
failureMark: "✖", // custom mark used for failure completion
},
},
},
// Global TypeScript config for all .ts/.tsx files
{
files: ["**/*.ts", "**/*.tsx"],
ignores: [
"node_modules/**",
"dist/**",
"coverage/**",
".github/chatmodes/**",
],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["tsconfig.json", "tsconfig.test.json"],
tsconfigRootDir: path.resolve(
path.dirname(fileURLToPath(import.meta.url))
),
warnOnUnsupportedTypeScriptVersion: true,
},
},
},
{
files: ["src/**/*.ts"],
ignores: ["src/**/*.test.ts", "src/**/*.spec.ts"],
languageOptions: {
globals: {
document: "readonly",
globalThis: "readonly",
NodeJS: "readonly",
window: "readonly",
},
parser: tseslint.parser,
},
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"no-inline-comments": "off",
"no-magic-numbers": "off",
"no-plusplus": "off",
"no-ternary": "off",
"no-undef-init": "off",
"no-undefined": "off",
"no-console": "off",
"@typescript-eslint/no-magic-numbers": "off",
"no-void": "off",
"object-shorthand": "off",
"one-var": "off",
"sort-keys": "off",
"sort-vars": "off",
"max-statements": "off",
"max-lines-per-function": "off",
"max-lines": "off",
},
},
{
// Test files with basic rules only
files: ["src/**/*.test.ts", "src/**/*.spec.ts"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["tsconfig.json", "tsconfig.test.json"],
tsconfigRootDir: path.resolve(
path.dirname(fileURLToPath(import.meta.url))
),
warnOnUnsupportedTypeScriptVersion: true,
},
},
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"no-inline-comments": "off",
"no-magic-numbers": "off",
"no-plusplus": "off",
"no-ternary": "off",
"no-undef-init": "off",
"no-undefined": "off",
"no-console": "off",
"@typescript-eslint/no-magic-numbers": "off",
"no-void": "off",
"object-shorthand": "off",
"one-var": "off",
"sort-keys": "off",
"sort-vars": "off",
"max-statements": "off",
"max-lines-per-function": "off",
"max-lines": "off",
},
},
{
ignores: [
"dist/**",
"node_modules/**",
"*.js",
"*.mjs",
"examples/**",
],
},
prettierEslintDisables,
]);