lenix 1.3.3 → 1.3.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +7 -0
- package/modules/dist/entries/index.d.ts +6 -0
- package/modules/dist/entries/index.js +8 -0
- package/{ts → modules}/dist/index.d.ts +1 -0
- package/{ts → modules}/dist/index.js +1 -0
- package/oop/LICENSE +21 -0
- package/package.json +9 -9
- package/lint/src/lint-preset.json +0 -370
- package/lint/src/lint.mts +0 -322
- package/lint/src/tsconfig.json +0 -10
- /package/{ts → modules}/dist/fetch/index.d.ts +0 -0
- /package/{ts → modules}/dist/fetch/index.js +0 -0
- /package/{ts → modules}/dist/fxmanifest/fxmanifest.json +0 -0
- /package/{ts → modules}/dist/fxmanifest/index.d.ts +0 -0
- /package/{ts → modules}/dist/fxmanifest/index.js +0 -0
- /package/{ts → modules}/dist/wait/index.d.ts +0 -0
- /package/{ts → modules}/dist/wait/index.js +0 -0
- /package/{lua → oop}/mac-lua-modules.sh +0 -0
package/Readme.md
CHANGED
|
@@ -33,6 +33,13 @@ yarn add lenix
|
|
|
33
33
|
|
|
34
34
|
## 🗺️ Roadmap
|
|
35
35
|
- [ ] fix the lint tsconfig.json file creation when no file is found
|
|
36
|
+
- [-] trim the diff's unusefull text
|
|
37
|
+
- [ ] use walkthrough instead of custom page
|
|
38
|
+
- [ ] use webview to add quick settings
|
|
39
|
+
- [ ] use modal dialog to confirm the walkthrough
|
|
40
|
+
- [x] use progressive notify
|
|
41
|
+
- [ ] use add commit reminder
|
|
42
|
+
- [ ] add a revert last commit button
|
|
36
43
|
|
|
37
44
|
## 🧾License
|
|
38
45
|

|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get typed entries from an object (Typed Object.entries)
|
|
3
|
+
* @param object - Object to get entries from
|
|
4
|
+
* @returns Array of the passed entries
|
|
5
|
+
*/
|
|
6
|
+
export declare const entries: <T extends Record<string, unknown>>(object: T) => Array<{ [K in keyof T]: [K, T[K]]; }[keyof T]>;
|
package/oop/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lenix
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lenix",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.40",
|
|
4
4
|
"description": "The Monorepo for the software engineering community",
|
|
5
5
|
"author": "Lenix",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"typescript",
|
|
12
12
|
"lua",
|
|
13
13
|
"luarocks",
|
|
14
|
+
"oop",
|
|
14
15
|
"fivem",
|
|
15
16
|
"fxmanifest",
|
|
16
17
|
"api",
|
|
17
|
-
"oop",
|
|
18
18
|
"class",
|
|
19
19
|
"eslint",
|
|
20
20
|
"linter"
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "git+https://github.com/lenixdev/lenix.git"
|
|
25
25
|
},
|
|
26
|
-
"main": "./
|
|
27
|
-
"types": "./
|
|
26
|
+
"main": "./modules/dist/index.js",
|
|
27
|
+
"types": "./modules/dist/index.d.ts",
|
|
28
28
|
"bin": {
|
|
29
|
-
"mac-lua-modules": "
|
|
29
|
+
"mac-lua-modules": "oop/mac-lua-modules.sh",
|
|
30
30
|
"lenix": "./lint/dist/lint.mjs"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"lint"
|
|
33
|
+
"modules/dist",
|
|
34
|
+
"oop",
|
|
35
|
+
"lint/dist"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@eslint/js": "^10.0.1",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"typescript": "^5.3.3"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
|
-
"build": "tsc -p
|
|
54
|
+
"build": "tsc -p modules/src/fxmanifest/tsconfig.json && tsc-alias && tsc -p lint/src/tsconfig.json",
|
|
55
55
|
"bump": "pnpm version patch"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"outFile": "eslint.config.mts",
|
|
3
|
-
"rules": {
|
|
4
|
-
"accessor-pairs": "error",
|
|
5
|
-
"array-callback-return": "warn",
|
|
6
|
-
"arrow-body-style": "error",
|
|
7
|
-
"block-scoped-var": "error",
|
|
8
|
-
"camelcase": "error",
|
|
9
|
-
"capitalized-comments": "warn",
|
|
10
|
-
"class-methods-use-this": "error",
|
|
11
|
-
"complexity": "warn",
|
|
12
|
-
"consistent-return": "warn",
|
|
13
|
-
"consistent-this": "warn",
|
|
14
|
-
"constructor-super": "warn",
|
|
15
|
-
"curly": [
|
|
16
|
-
"error",
|
|
17
|
-
"multi"
|
|
18
|
-
],
|
|
19
|
-
"default-case": "error",
|
|
20
|
-
"default-case-last": "error",
|
|
21
|
-
"default-param-last": "error",
|
|
22
|
-
"dot-notation": "error",
|
|
23
|
-
"eqeqeq": "error",
|
|
24
|
-
"for-direction": "error",
|
|
25
|
-
"func-name-matching": "error",
|
|
26
|
-
"func-names": "warn",
|
|
27
|
-
"func-style": "error",
|
|
28
|
-
"getter-return": "error",
|
|
29
|
-
"grouped-accessor-pairs": "error",
|
|
30
|
-
"guard-for-in": "warn",
|
|
31
|
-
"id-denylist": "warn",
|
|
32
|
-
"id-length": [
|
|
33
|
-
"error",
|
|
34
|
-
{
|
|
35
|
-
"exceptions": [
|
|
36
|
-
"_"
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"id-match": "error",
|
|
41
|
-
"init-declarations": "error",
|
|
42
|
-
"logical-assignment-operators": "error",
|
|
43
|
-
"max-classes-per-file": "error",
|
|
44
|
-
"max-depth": "error",
|
|
45
|
-
"max-lines": "error",
|
|
46
|
-
"max-lines-per-function": "warn",
|
|
47
|
-
"max-nested-callbacks": "error",
|
|
48
|
-
"max-params": "error",
|
|
49
|
-
"max-statements": "error",
|
|
50
|
-
"new-cap": "warn",
|
|
51
|
-
"no-alert": "error",
|
|
52
|
-
"no-array-constructor": "warn",
|
|
53
|
-
"no-async-promise-executor": "warn",
|
|
54
|
-
"no-await-in-loop": "warn",
|
|
55
|
-
"no-bitwise": "warn",
|
|
56
|
-
"no-caller": "warn",
|
|
57
|
-
"no-case-declarations": "warn",
|
|
58
|
-
"no-class-assign": "error",
|
|
59
|
-
"no-compare-neg-zero": "error",
|
|
60
|
-
"no-cond-assign": "warn",
|
|
61
|
-
"no-console": "warn",
|
|
62
|
-
"no-const-assign": "error",
|
|
63
|
-
"no-constant-binary-expression": "warn",
|
|
64
|
-
"no-constant-condition": "warn",
|
|
65
|
-
"no-constructor-return": "error",
|
|
66
|
-
"no-continue": "error",
|
|
67
|
-
"no-control-regex": "warn",
|
|
68
|
-
"no-debugger": "error",
|
|
69
|
-
"no-delete-var": "error",
|
|
70
|
-
"no-div-regex": "warn",
|
|
71
|
-
"no-dupe-args": "error",
|
|
72
|
-
"no-dupe-class-members": "error",
|
|
73
|
-
"no-dupe-else-if": "error",
|
|
74
|
-
"no-dupe-keys": "error",
|
|
75
|
-
"no-duplicate-case": "error",
|
|
76
|
-
"no-duplicate-imports": "error",
|
|
77
|
-
"no-else-return": "error",
|
|
78
|
-
"no-empty": "error",
|
|
79
|
-
"no-empty-character-class": "warn",
|
|
80
|
-
"no-empty-function": "error",
|
|
81
|
-
"no-empty-pattern": "error",
|
|
82
|
-
"no-empty-static-block": "error",
|
|
83
|
-
"no-eq-null": "error",
|
|
84
|
-
"no-eval": "error",
|
|
85
|
-
"no-ex-assign": "error",
|
|
86
|
-
"no-extend-native": "warn",
|
|
87
|
-
"no-extra-bind": "warn",
|
|
88
|
-
"no-extra-boolean-cast": "warn",
|
|
89
|
-
"no-extra-label": "warn",
|
|
90
|
-
"no-fallthrough": "warn",
|
|
91
|
-
"no-func-assign": "error",
|
|
92
|
-
"no-global-assign": "error",
|
|
93
|
-
"no-implicit-coercion": "warn",
|
|
94
|
-
"no-implicit-globals": "error",
|
|
95
|
-
"no-implied-eval": "error",
|
|
96
|
-
"no-import-assign": "error",
|
|
97
|
-
"no-inline-comments": "warn",
|
|
98
|
-
"no-inner-declarations": "error",
|
|
99
|
-
"no-invalid-regexp": "warn",
|
|
100
|
-
"no-invalid-this": "error",
|
|
101
|
-
"no-irregular-whitespace": "warn",
|
|
102
|
-
"no-iterator": "warn",
|
|
103
|
-
"no-label-var": "error",
|
|
104
|
-
"no-labels": "error",
|
|
105
|
-
"no-lone-blocks": "error",
|
|
106
|
-
"no-lonely-if": "error",
|
|
107
|
-
"no-loop-func": "warn",
|
|
108
|
-
"no-loss-of-precision": "error",
|
|
109
|
-
"no-magic-numbers": [
|
|
110
|
-
"error",
|
|
111
|
-
{
|
|
112
|
-
"detectObjects": true,
|
|
113
|
-
"enforceConst": true,
|
|
114
|
-
"ignore": [
|
|
115
|
-
0,
|
|
116
|
-
1
|
|
117
|
-
],
|
|
118
|
-
"ignoreReadonlyClassProperties": true
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"no-misleading-character-class": "warn",
|
|
122
|
-
"no-multi-assign": "error",
|
|
123
|
-
"no-multi-str": "error",
|
|
124
|
-
"no-negated-condition": "warn",
|
|
125
|
-
"no-nested-ternary": "error",
|
|
126
|
-
"no-new": "error",
|
|
127
|
-
"no-new-func": "error",
|
|
128
|
-
"no-new-native-nonconstructor": "warn",
|
|
129
|
-
"no-new-wrappers": "warn",
|
|
130
|
-
"no-nonoctal-decimal-escape": "warn",
|
|
131
|
-
"no-obj-calls": "warn",
|
|
132
|
-
"no-object-constructor": "warn",
|
|
133
|
-
"no-octal": "error",
|
|
134
|
-
"no-octal-escape": "warn",
|
|
135
|
-
"no-param-reassign": "warn",
|
|
136
|
-
"no-plusplus": "warn",
|
|
137
|
-
"no-promise-executor-return": "error",
|
|
138
|
-
"no-proto": "warn",
|
|
139
|
-
"no-prototype-builtins": "warn",
|
|
140
|
-
"no-redeclare": "error",
|
|
141
|
-
"no-regex-spaces": "warn",
|
|
142
|
-
"no-restricted-exports": "error",
|
|
143
|
-
"no-restricted-globals": "warn",
|
|
144
|
-
"no-restricted-imports": "warn",
|
|
145
|
-
"no-restricted-properties": "warn",
|
|
146
|
-
"no-restricted-syntax": "warn",
|
|
147
|
-
"no-return-assign": "error",
|
|
148
|
-
"no-script-url": "warn",
|
|
149
|
-
"no-self-assign": "error",
|
|
150
|
-
"no-self-compare": "error",
|
|
151
|
-
"no-sequences": "warn",
|
|
152
|
-
"no-setter-return": "error",
|
|
153
|
-
"no-shadow": "warn",
|
|
154
|
-
"no-shadow-restricted-names": "error",
|
|
155
|
-
"no-sparse-arrays": "error",
|
|
156
|
-
"no-template-curly-in-string": "error",
|
|
157
|
-
"no-this-before-super": "error",
|
|
158
|
-
"no-throw-literal": "error",
|
|
159
|
-
"no-unassigned-vars": "error",
|
|
160
|
-
"no-undef": "error",
|
|
161
|
-
"no-undef-init": "error",
|
|
162
|
-
"no-undefined": "off",
|
|
163
|
-
"no-underscore-dangle": "warn",
|
|
164
|
-
"no-unexpected-multiline": "error",
|
|
165
|
-
"no-unmodified-loop-condition": "warn",
|
|
166
|
-
"no-unneeded-ternary": "error",
|
|
167
|
-
"no-unreachable": "error",
|
|
168
|
-
"no-unreachable-loop": "warn",
|
|
169
|
-
"no-unsafe-finally": "warn",
|
|
170
|
-
"no-unsafe-negation": "warn",
|
|
171
|
-
"no-unsafe-optional-chaining": "error",
|
|
172
|
-
"no-unused-expressions": "error",
|
|
173
|
-
"no-unused-labels": "error",
|
|
174
|
-
"no-unused-private-class-members": "error",
|
|
175
|
-
"no-unused-vars": "error",
|
|
176
|
-
"no-use-before-define": "error",
|
|
177
|
-
"no-useless-assignment": "error",
|
|
178
|
-
"no-useless-backreference": "warn",
|
|
179
|
-
"no-useless-call": "warn",
|
|
180
|
-
"no-useless-catch": "error",
|
|
181
|
-
"no-useless-computed-key": "warn",
|
|
182
|
-
"no-useless-concat": "error",
|
|
183
|
-
"no-useless-constructor": "warn",
|
|
184
|
-
"no-useless-escape": "warn",
|
|
185
|
-
"no-useless-rename": "error",
|
|
186
|
-
"no-useless-return": "error",
|
|
187
|
-
"no-var": "error",
|
|
188
|
-
"no-void": "error",
|
|
189
|
-
"no-warning-comments": "warn",
|
|
190
|
-
"no-with": "error",
|
|
191
|
-
"object-shorthand": "error",
|
|
192
|
-
"one-var": "off",
|
|
193
|
-
"operator-assignment": "warn",
|
|
194
|
-
"prefer-arrow-callback": "error",
|
|
195
|
-
"prefer-const": "error",
|
|
196
|
-
"prefer-destructuring": "error",
|
|
197
|
-
"prefer-exponentiation-operator": "error",
|
|
198
|
-
"prefer-named-capture-group": "warn",
|
|
199
|
-
"prefer-numeric-literals": "warn",
|
|
200
|
-
"prefer-object-has-own": "warn",
|
|
201
|
-
"prefer-object-spread": "error",
|
|
202
|
-
"prefer-promise-reject-errors": "warn",
|
|
203
|
-
"prefer-regex-literals": "warn",
|
|
204
|
-
"prefer-rest-params": "error",
|
|
205
|
-
"prefer-spread": "error",
|
|
206
|
-
"prefer-template": "error",
|
|
207
|
-
"preserve-caught-error": "error",
|
|
208
|
-
"radix": "warn",
|
|
209
|
-
"require-atomic-updates": "warn",
|
|
210
|
-
"require-await": "error",
|
|
211
|
-
"require-unicode-regexp": "warn",
|
|
212
|
-
"require-yield": "error",
|
|
213
|
-
"sort-imports": "off",
|
|
214
|
-
"sort-keys": "off",
|
|
215
|
-
"sort-vars": "error",
|
|
216
|
-
"strict": "error",
|
|
217
|
-
"symbol-description": "error",
|
|
218
|
-
"unicode-bom": "warn",
|
|
219
|
-
"use-isnan": "error",
|
|
220
|
-
"valid-typeof": "error",
|
|
221
|
-
"vars-on-top": "error",
|
|
222
|
-
"yoda": "error",
|
|
223
|
-
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
224
|
-
"@typescript-eslint/array-type": "error",
|
|
225
|
-
"@typescript-eslint/ban-ts-comment": "error",
|
|
226
|
-
"@typescript-eslint/ban-tslint-comment": "error",
|
|
227
|
-
"@typescript-eslint/class-literal-property-style": "warn",
|
|
228
|
-
"@typescript-eslint/class-methods-use-this": "warn",
|
|
229
|
-
"@typescript-eslint/consistent-generic-constructors": "error",
|
|
230
|
-
"@typescript-eslint/consistent-indexed-object-style": "error",
|
|
231
|
-
"@typescript-eslint/consistent-type-assertions": "error",
|
|
232
|
-
"@typescript-eslint/consistent-type-definitions": "error",
|
|
233
|
-
"@typescript-eslint/consistent-type-imports": "error",
|
|
234
|
-
"@typescript-eslint/default-param-last": "warn",
|
|
235
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
236
|
-
"@typescript-eslint/explicit-member-accessibility": "warn",
|
|
237
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
238
|
-
"@typescript-eslint/init-declarations": "error",
|
|
239
|
-
"@typescript-eslint/max-params": "error",
|
|
240
|
-
"@typescript-eslint/member-ordering": "error",
|
|
241
|
-
"@typescript-eslint/method-signature-style": "error",
|
|
242
|
-
"@typescript-eslint/no-array-constructor": "error",
|
|
243
|
-
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
244
|
-
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
245
|
-
"@typescript-eslint/no-dynamic-delete": "error",
|
|
246
|
-
"@typescript-eslint/no-empty-function": "error",
|
|
247
|
-
"@typescript-eslint/no-empty-object-type": "error",
|
|
248
|
-
"@typescript-eslint/no-explicit-any": "error",
|
|
249
|
-
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
250
|
-
"@typescript-eslint/no-extraneous-class": "error",
|
|
251
|
-
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
252
|
-
"@typescript-eslint/no-inferrable-types": "error",
|
|
253
|
-
"@typescript-eslint/no-invalid-void-type": "error",
|
|
254
|
-
"@typescript-eslint/no-loop-func": "error",
|
|
255
|
-
"@typescript-eslint/no-magic-numbers": "off",
|
|
256
|
-
"@typescript-eslint/no-misused-new": "error",
|
|
257
|
-
"@typescript-eslint/no-namespace": "error",
|
|
258
|
-
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "warn",
|
|
259
|
-
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
260
|
-
"@typescript-eslint/no-non-null-assertion": "error",
|
|
261
|
-
"@typescript-eslint/no-redeclare": "warn",
|
|
262
|
-
"@typescript-eslint/no-require-imports": "error",
|
|
263
|
-
"@typescript-eslint/no-restricted-imports": "warn",
|
|
264
|
-
"@typescript-eslint/no-restricted-types": "warn",
|
|
265
|
-
"@typescript-eslint/no-shadow": "warn",
|
|
266
|
-
"@typescript-eslint/no-this-alias": "error",
|
|
267
|
-
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
|
|
268
|
-
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
269
|
-
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
270
|
-
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
271
|
-
"@typescript-eslint/no-unused-expressions": "warn",
|
|
272
|
-
"@typescript-eslint/no-unused-private-class-members": "error",
|
|
273
|
-
"@typescript-eslint/no-unused-vars": "error",
|
|
274
|
-
"@typescript-eslint/no-use-before-define": "error",
|
|
275
|
-
"@typescript-eslint/no-useless-constructor": "error",
|
|
276
|
-
"@typescript-eslint/no-useless-empty-export": "error",
|
|
277
|
-
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
278
|
-
"@typescript-eslint/prefer-as-const": "error",
|
|
279
|
-
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
280
|
-
"@typescript-eslint/prefer-for-of": "error",
|
|
281
|
-
"@typescript-eslint/prefer-function-type": "error",
|
|
282
|
-
"@typescript-eslint/prefer-literal-enum-member": "error",
|
|
283
|
-
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
284
|
-
"@typescript-eslint/triple-slash-reference": "error",
|
|
285
|
-
"@typescript-eslint/unified-signatures": "error",
|
|
286
|
-
"@typescript-eslint/await-thenable": "warn",
|
|
287
|
-
"@typescript-eslint/consistent-return": "error",
|
|
288
|
-
"@typescript-eslint/consistent-type-exports": "error",
|
|
289
|
-
"@typescript-eslint/dot-notation": "error",
|
|
290
|
-
"@typescript-eslint/naming-convention": [
|
|
291
|
-
"warn",
|
|
292
|
-
{
|
|
293
|
-
"selector": "variable",
|
|
294
|
-
"format": [
|
|
295
|
-
"camelCase",
|
|
296
|
-
"UPPER_CASE",
|
|
297
|
-
"PascalCase"
|
|
298
|
-
]
|
|
299
|
-
}
|
|
300
|
-
],
|
|
301
|
-
"@typescript-eslint/no-array-delete": "error",
|
|
302
|
-
"@typescript-eslint/no-base-to-string": "warn",
|
|
303
|
-
"@typescript-eslint/no-confusing-void-expression": "error",
|
|
304
|
-
"@typescript-eslint/no-deprecated": "error",
|
|
305
|
-
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
|
306
|
-
"@typescript-eslint/no-floating-promises": "warn",
|
|
307
|
-
"@typescript-eslint/no-for-in-array": "error",
|
|
308
|
-
"@typescript-eslint/no-implied-eval": "error",
|
|
309
|
-
"@typescript-eslint/no-meaningless-void-operator": "error",
|
|
310
|
-
"@typescript-eslint/no-misused-promises": "error",
|
|
311
|
-
"@typescript-eslint/no-misused-spread": "error",
|
|
312
|
-
"@typescript-eslint/no-mixed-enums": "error",
|
|
313
|
-
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
314
|
-
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
|
315
|
-
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
316
|
-
"@typescript-eslint/no-unnecessary-qualifier": "warn",
|
|
317
|
-
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
318
|
-
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
319
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
320
|
-
"@typescript-eslint/no-unnecessary-type-conversion": "error",
|
|
321
|
-
"@typescript-eslint/no-unnecessary-type-parameters": "error",
|
|
322
|
-
"@typescript-eslint/no-unsafe-argument": "error",
|
|
323
|
-
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
324
|
-
"@typescript-eslint/no-unsafe-call": "error",
|
|
325
|
-
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
326
|
-
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
327
|
-
"@typescript-eslint/no-unsafe-return": "error",
|
|
328
|
-
"@typescript-eslint/no-unsafe-type-assertion": "error",
|
|
329
|
-
"@typescript-eslint/no-unsafe-unary-minus": "warn",
|
|
330
|
-
"@typescript-eslint/no-useless-default-assignment": "error",
|
|
331
|
-
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
|
|
332
|
-
"@typescript-eslint/only-throw-error": "error",
|
|
333
|
-
"@typescript-eslint/prefer-destructuring": "error",
|
|
334
|
-
"@typescript-eslint/prefer-find": "error",
|
|
335
|
-
"@typescript-eslint/prefer-includes": "error",
|
|
336
|
-
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
337
|
-
"@typescript-eslint/prefer-optional-chain": "error",
|
|
338
|
-
"@typescript-eslint/prefer-promise-reject-errors": "error",
|
|
339
|
-
"@typescript-eslint/prefer-readonly": "error",
|
|
340
|
-
"@typescript-eslint/prefer-readonly-parameter-types": [
|
|
341
|
-
"error",
|
|
342
|
-
{
|
|
343
|
-
"ignoreInferredTypes": true
|
|
344
|
-
}
|
|
345
|
-
],
|
|
346
|
-
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
347
|
-
"@typescript-eslint/prefer-regexp-exec": "warn",
|
|
348
|
-
"@typescript-eslint/prefer-return-this-type": "error",
|
|
349
|
-
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
350
|
-
"@typescript-eslint/promise-function-async": "error",
|
|
351
|
-
"@typescript-eslint/related-getter-setter-pairs": "error",
|
|
352
|
-
"@typescript-eslint/require-array-sort-compare": "error",
|
|
353
|
-
"@typescript-eslint/require-await": "error",
|
|
354
|
-
"@typescript-eslint/restrict-plus-operands": "error",
|
|
355
|
-
"@typescript-eslint/restrict-template-expressions": "error",
|
|
356
|
-
"@typescript-eslint/return-await": "error",
|
|
357
|
-
"@typescript-eslint/strict-boolean-expressions": "error",
|
|
358
|
-
"@typescript-eslint/strict-void-return": "off",
|
|
359
|
-
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
360
|
-
"@typescript-eslint/unbound-method": "warn",
|
|
361
|
-
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error"
|
|
362
|
-
},
|
|
363
|
-
"completedSections": [
|
|
364
|
-
"Core — Other",
|
|
365
|
-
"TypeScript",
|
|
366
|
-
"TypeScript — type-aware"
|
|
367
|
-
],
|
|
368
|
-
"pausedSection": null,
|
|
369
|
-
"pausedAt": 0
|
|
370
|
-
}
|
package/lint/src/lint.mts
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import { fileURLToPath } from 'url'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import eslintJs from '@eslint/js'
|
|
6
|
-
import tseslint from 'typescript-eslint'
|
|
7
|
-
// import react from 'eslint-plugin-react'
|
|
8
|
-
// import reactHooks from 'eslint-plugin-react-hooks'
|
|
9
|
-
// import importPlugin from 'eslint-plugin-import'
|
|
10
|
-
import type { ESLint } from 'eslint'
|
|
11
|
-
|
|
12
|
-
const [,, cmd, ...args] = process.argv
|
|
13
|
-
if (cmd !== '--lint') {
|
|
14
|
-
process.stdout.write('Usage: lenix --lint [--preset]\n')
|
|
15
|
-
process.exit(0)
|
|
16
|
-
}
|
|
17
|
-
process.argv = [process.argv[0], process.argv[1], ...args]
|
|
18
|
-
|
|
19
|
-
type PluginWithRules = ESLint.Plugin & { rules: Record<string, any> }
|
|
20
|
-
|
|
21
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
22
|
-
|
|
23
|
-
const c = { reset:'\x1b[0m',bold:'\x1b[1m',dim:'\x1b[2m',cyan:'\x1b[36m',yellow:'\x1b[33m',green:'\x1b[32m',red:'\x1b[31m',blue:'\x1b[34m',magenta:'\x1b[35m',gray:'\x1b[90m' }
|
|
24
|
-
const title = (s: string) => `${c.bold}${c.cyan}${s}${c.reset}`
|
|
25
|
-
const section = (s: string) => `\n${c.bold}${c.blue}━━ ${s} ━━${c.reset}`
|
|
26
|
-
const bold = (s: string) => `${c.bold}${s}${c.reset}`
|
|
27
|
-
const dim = (s: string) => `${c.dim}${s}${c.reset}`
|
|
28
|
-
const gray = (s: string) => `${c.gray}${s}${c.reset}`
|
|
29
|
-
const tag = (s: string, col: string) => `${col}[${s}]${c.reset}`
|
|
30
|
-
const pr = (s: string) => `${c.magenta}${s}${c.reset}`
|
|
31
|
-
|
|
32
|
-
const ttyFd = fs.openSync('/dev/tty', 'r')
|
|
33
|
-
function readLine(question: string): string {
|
|
34
|
-
process.stdout.write(question)
|
|
35
|
-
const buf = Buffer.alloc(1024)
|
|
36
|
-
let result = ''
|
|
37
|
-
while (true) {
|
|
38
|
-
const n = fs.readSync(ttyFd, buf, 0, 1, null)
|
|
39
|
-
if (n === 0) break
|
|
40
|
-
const ch = buf.toString('utf8', 0, n)
|
|
41
|
-
if (ch === '\n') break
|
|
42
|
-
if (ch === '\r') continue
|
|
43
|
-
result += ch
|
|
44
|
-
}
|
|
45
|
-
return result
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const CHECKPOINT = '.lint-preset.json'
|
|
49
|
-
|
|
50
|
-
type State = {
|
|
51
|
-
outFile: string
|
|
52
|
-
allRules: Record<string, string>
|
|
53
|
-
completedSections: Set<string>
|
|
54
|
-
pausedSection: string | null
|
|
55
|
-
pausedAt: number
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
type CheckpointData = {
|
|
59
|
-
outFile: string
|
|
60
|
-
rules: Record<string, string>
|
|
61
|
-
completedSections: string[]
|
|
62
|
-
pausedSection: string | null
|
|
63
|
-
pausedAt: number
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function saveCheckpoint(state: State) {
|
|
67
|
-
const data: CheckpointData = {
|
|
68
|
-
outFile: state.outFile,
|
|
69
|
-
rules: state.allRules,
|
|
70
|
-
completedSections: [...state.completedSections],
|
|
71
|
-
pausedSection: state.pausedSection,
|
|
72
|
-
pausedAt: state.pausedAt,
|
|
73
|
-
}
|
|
74
|
-
fs.writeFileSync(CHECKPOINT, JSON.stringify(data, null, 2), 'utf8')
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function loadCheckpoint(): CheckpointData | null {
|
|
78
|
-
try {
|
|
79
|
-
if (!fs.existsSync(CHECKPOINT)) return null
|
|
80
|
-
return JSON.parse(fs.readFileSync(CHECKPOINT, 'utf8')) as CheckpointData
|
|
81
|
-
} catch { return null }
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
type RuleInfo = {
|
|
85
|
-
fullName: string
|
|
86
|
-
description: string
|
|
87
|
-
fixable: boolean
|
|
88
|
-
recommended: boolean
|
|
89
|
-
requiresTypeChecking: boolean
|
|
90
|
-
url: string
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function buildPluginRules(rules: Record<string, any>, prefix: string): RuleInfo[] {
|
|
94
|
-
return Object.entries(rules)
|
|
95
|
-
.filter(([, r]) => !r.meta?.deprecated)
|
|
96
|
-
.map(([name, r]) => ({
|
|
97
|
-
fullName: `${prefix}/${name}`,
|
|
98
|
-
description: r.meta?.docs?.description ?? '',
|
|
99
|
-
fixable: !!r.meta?.fixable,
|
|
100
|
-
recommended: !!(r.meta?.docs?.recommended),
|
|
101
|
-
requiresTypeChecking: !!(r.meta?.docs?.requiresTypeChecking),
|
|
102
|
-
url: r.meta?.docs?.url ?? '',
|
|
103
|
-
}))
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async function getCoreRules(): Promise<Record<string, RuleInfo[]>> {
|
|
107
|
-
try {
|
|
108
|
-
const { builtinRules } = await import('eslint/use-at-your-own-risk')
|
|
109
|
-
const byCat: Record<string, RuleInfo[]> = {}
|
|
110
|
-
for (const [name, r] of (builtinRules as Map<string, any>).entries()) {
|
|
111
|
-
if (r.meta?.deprecated) continue
|
|
112
|
-
const cat: string = r.meta?.docs?.category ?? 'Other'
|
|
113
|
-
if (!byCat[cat]) byCat[cat] = []
|
|
114
|
-
byCat[cat].push({ fullName: name, description: r.meta?.docs?.description ?? '', fixable: !!r.meta?.fixable, recommended: !!(r.meta?.docs?.recommended), requiresTypeChecking: false, url: r.meta?.docs?.url ?? '' })
|
|
115
|
-
}
|
|
116
|
-
return byCat
|
|
117
|
-
} catch {
|
|
118
|
-
return { 'Core': Object.keys(eslintJs.configs.all.rules ?? {}).map(n => ({ fullName: n, description: '', fixable: false, recommended: false, requiresTypeChecking: false, url: '' })) }
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function askRule(rule: RuleInfo, idx: number, total: number): [string, string] | 'save' | null {
|
|
123
|
-
const tags = [rule.recommended ? tag('recommended',c.green) : null, rule.fixable ? tag('fixable',c.yellow) : null, rule.requiresTypeChecking ? tag('type-aware',c.red) : null].filter(Boolean).join(' ')
|
|
124
|
-
process.stdout.write(`\n${gray(`[${idx}/${total}]`)} ${bold(rule.fullName)} ${tags}\n`)
|
|
125
|
-
if (rule.description) process.stdout.write(` ${dim(rule.description)}\n`)
|
|
126
|
-
if (rule.url) process.stdout.write(` ${gray(rule.url)}\n`)
|
|
127
|
-
const a = readLine(pr(' → off/warn/error/skip/save [o/w/e/s/q]: ')).trim().toLowerCase()
|
|
128
|
-
if (!a || a === 's' || a === 'skip') return null
|
|
129
|
-
if (a === 'q' || a === 'save') return 'save'
|
|
130
|
-
if (a === 'o' || a === 'off') return [rule.fullName, 'off']
|
|
131
|
-
if (a === 'w' || a === 'warn') return [rule.fullName, 'warn']
|
|
132
|
-
if (a === 'e' || a === 'error') return [rule.fullName, 'error']
|
|
133
|
-
process.stdout.write(gray(' Invalid, skipping.\n'))
|
|
134
|
-
return null
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function askSection(label: string, rules: RuleInfo[], state: State) {
|
|
138
|
-
if (state.completedSections.has(label)) {
|
|
139
|
-
process.stdout.write(gray(` ✓ Already completed: ${label}\n`))
|
|
140
|
-
return
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
process.stdout.write(section(label) + '\n')
|
|
144
|
-
process.stdout.write(gray(` ${rules.length} rules — Enter=skip q=save & exit\n`))
|
|
145
|
-
|
|
146
|
-
const skip = readLine(pr(' Skip entire section? [y/N]: ')).trim().toLowerCase()
|
|
147
|
-
if (skip === 'y') {
|
|
148
|
-
state.completedSections.add(label)
|
|
149
|
-
saveCheckpoint({ ...state, pausedSection: null, pausedAt: 0 })
|
|
150
|
-
process.stdout.write(gray(' Skipped.\n'))
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const startAt = state.pausedSection === label ? (state.pausedAt ?? 0) : 0
|
|
155
|
-
if (startAt > 0) process.stdout.write(gray(` Resuming from rule ${startAt + 1}/${rules.length}\n`))
|
|
156
|
-
|
|
157
|
-
for (let i = startAt; i < rules.length; i++) {
|
|
158
|
-
const entry = askRule(rules[i], i + 1, rules.length)
|
|
159
|
-
|
|
160
|
-
if (entry === 'save') {
|
|
161
|
-
saveCheckpoint({ ...state, pausedSection: label, pausedAt: i })
|
|
162
|
-
process.stdout.write(`\n${tag('saved', c.green)} Progress saved to ${bold(CHECKPOINT)}\n`)
|
|
163
|
-
process.stdout.write(dim('Run the lint again to resume.\n\n'))
|
|
164
|
-
fs.closeSync(ttyFd)
|
|
165
|
-
process.exit(0)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (entry) state.allRules[entry[0]] = entry[1]
|
|
169
|
-
saveCheckpoint({ ...state, pausedSection: label, pausedAt: i + 1 })
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
state.completedSections.add(label)
|
|
173
|
-
saveCheckpoint({ ...state, pausedSection: null, pausedAt: 0 })
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function generateConfig(allRules: Record<string, string>): string {
|
|
177
|
-
const core: Record<string, string> = {}
|
|
178
|
-
const ts: Record<string, string> = {}
|
|
179
|
-
const reactR: Record<string, string> = {}
|
|
180
|
-
const imp: Record<string, string> = {}
|
|
181
|
-
for (const [k, v] of Object.entries(allRules)) {
|
|
182
|
-
if (k.startsWith('@typescript-eslint/')) ts[k] = v
|
|
183
|
-
else if (k.startsWith('react/') || k.startsWith('react-hooks/')) reactR[k] = v
|
|
184
|
-
else if (k.startsWith('import/')) imp[k] = v
|
|
185
|
-
else core[k] = v
|
|
186
|
-
}
|
|
187
|
-
const hasTs = Object.keys(ts).length > 0
|
|
188
|
-
const hasReact = Object.keys(reactR).length > 0
|
|
189
|
-
const hasImp = Object.keys(imp).length > 0
|
|
190
|
-
const hasCore = Object.keys(core).length > 0
|
|
191
|
-
const ind = (o: object, n: number) => JSON.stringify(o, null, 2).split('\n').map((l, i) => i === 0 ? l : ' '.repeat(n) + l).join('\n')
|
|
192
|
-
return [
|
|
193
|
-
`import js from '@eslint/js'`,
|
|
194
|
-
`import globals from 'globals'`,
|
|
195
|
-
hasTs ? `import tseslint from 'typescript-eslint'` : '',
|
|
196
|
-
hasReact ? `import pluginReact from 'eslint-plugin-react'` : '',
|
|
197
|
-
hasReact ? `import reactHooks from 'eslint-plugin-react-hooks'` : '',
|
|
198
|
-
hasImp ? `import importPlugin from 'eslint-plugin-import'` : '',
|
|
199
|
-
``,
|
|
200
|
-
`export default [`,
|
|
201
|
-
` { ignores: ['node_modules'] },`,
|
|
202
|
-
hasTs ? ` ...tseslint.configs.strictTypeChecked.map(config => ({ ...config, files: ['**/*.{ts,tsx,mts}'] })),` : '',
|
|
203
|
-
` js.configs.recommended,`,
|
|
204
|
-
` {`,
|
|
205
|
-
` files: ['**/*.{ts,tsx,mts}'],`,
|
|
206
|
-
` languageOptions: {`,
|
|
207
|
-
` globals: { ...globals.browser, ...globals.node },`,
|
|
208
|
-
hasTs ? ` parserOptions: {\n projectService: true,\n tsconfigRootDir: import.meta.dirname,\n },` : '',
|
|
209
|
-
` },`,
|
|
210
|
-
hasCore ? ` rules: ${ind(core, 4)},` : '',
|
|
211
|
-
` },`,
|
|
212
|
-
hasTs ? ` {\n files: ['**/*.{ts,tsx,mts}'],\n rules: ${ind(ts, 4)},\n },` : '',
|
|
213
|
-
hasReact ? ` pluginReact.configs.flat['jsx-runtime'],` : '',
|
|
214
|
-
hasReact ? ` { settings: { react: { version: 'detect' } } },` : '',
|
|
215
|
-
hasReact ? ` {\n plugins: { 'react-hooks': reactHooks },\n rules: ${ind(reactR, 4)},\n },` : '',
|
|
216
|
-
hasImp ? ` {\n plugins: { import: importPlugin },\n rules: ${ind(imp, 4)},\n },` : '',
|
|
217
|
-
`]`,
|
|
218
|
-
].filter(Boolean).join('\n')
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const clone = process.argv.includes('--clone')
|
|
222
|
-
if (clone) {
|
|
223
|
-
const src = path.join(process.env.HOME!, '.lint-preset.json')
|
|
224
|
-
const data = JSON.parse(fs.readFileSync(src, 'utf8')) as CheckpointData
|
|
225
|
-
const config = generateConfig(data.rules)
|
|
226
|
-
fs.writeFileSync(data.outFile, config, 'utf8')
|
|
227
|
-
process.stdout.write(`${tag('done', c.green)} Written to ${bold(data.outFile)}\n`)
|
|
228
|
-
fs.closeSync(ttyFd)
|
|
229
|
-
process.exit(0)
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const preset = process.argv.includes('--preset')
|
|
233
|
-
if (preset) {
|
|
234
|
-
const res = await fetch('https://raw.githubusercontent.com/LenixDev/lenix/refs/heads/main/bin/lint-preset.json')
|
|
235
|
-
const data = await res.json() as CheckpointData
|
|
236
|
-
const config = generateConfig(data.rules)
|
|
237
|
-
fs.writeFileSync('eslint.config.mts', config, 'utf8')
|
|
238
|
-
process.stdout.write(`${tag('done', c.green)} Written to ${bold('eslint.config.mts')}\n`)
|
|
239
|
-
process.stdout.write(`${tag('notice', c.cyan)} Run: ${bold('npm add -D @eslint/js globals typescript-eslint')}\n`)
|
|
240
|
-
fs.closeSync(ttyFd)
|
|
241
|
-
process.exit(0)
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
async function main() {
|
|
245
|
-
process.stdout.write('\x1Bc')
|
|
246
|
-
process.stdout.write(title('╔═══════════════════════╗\n'))
|
|
247
|
-
process.stdout.write(title('║ ESLint Config ║\n'))
|
|
248
|
-
process.stdout.write(title('╚═══════════════════════╝\n'))
|
|
249
|
-
process.stdout.write(dim('\nWalks through every rule across all plugins.\n'))
|
|
250
|
-
process.stdout.write(dim('o=off w=warn e=error s/Enter=skip q=save & exit\n\n'))
|
|
251
|
-
|
|
252
|
-
const checkpoint = loadCheckpoint()
|
|
253
|
-
const state: State = { allRules: {}, completedSections: new Set(), outFile: 'eslint.config.mts', pausedSection: null, pausedAt: 0 }
|
|
254
|
-
|
|
255
|
-
if (checkpoint) {
|
|
256
|
-
process.stdout.write(`${tag('found', c.yellow)} Saved progress detected (${Object.keys(checkpoint.rules).length} rules configured).\n`)
|
|
257
|
-
const resume = readLine(pr('Resume? [Y/n]: ')).trim().toLowerCase()
|
|
258
|
-
if (resume !== 'n') {
|
|
259
|
-
state.outFile = checkpoint.outFile
|
|
260
|
-
state.allRules = checkpoint.rules
|
|
261
|
-
state.completedSections = new Set(checkpoint.completedSections)
|
|
262
|
-
state.pausedSection = checkpoint.pausedSection ?? null
|
|
263
|
-
state.pausedAt = checkpoint.pausedAt ?? 0
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
const coreByCategory = await getCoreRules()
|
|
268
|
-
for (const [cat, rules] of Object.entries(coreByCategory))
|
|
269
|
-
askSection(`Core — ${cat}`, rules, state)
|
|
270
|
-
|
|
271
|
-
const tsAll = buildPluginRules(((tseslint.plugin as unknown) as PluginWithRules).rules ?? {}, '@typescript-eslint')
|
|
272
|
-
askSection('TypeScript', tsAll.filter(r => !r.requiresTypeChecking), state)
|
|
273
|
-
askSection('TypeScript — type-aware', tsAll.filter(r => r.requiresTypeChecking), state)
|
|
274
|
-
// askSection('React', buildPluginRules((react.rules ?? {}) as Record<string, any>, 'react'), state)
|
|
275
|
-
// askSection('React Hooks', buildPluginRules((reactHooks.rules ?? {}) as Record<string, any>, 'react-hooks'), state)
|
|
276
|
-
// askSection('Imports', buildPluginRules((importPlugin.rules ?? {}) as Record<string, any>, 'import'), state)
|
|
277
|
-
|
|
278
|
-
const config = generateConfig(state.allRules)
|
|
279
|
-
let outFile = state.outFile
|
|
280
|
-
if (fs.existsSync(outFile)) {
|
|
281
|
-
const overwrite = readLine(pr(`\n${outFile} already exists. Overwrite? [y/N]: `)).trim().toLowerCase()
|
|
282
|
-
if (overwrite !== 'y')
|
|
283
|
-
outFile = readLine(pr('Enter new filename: ')).trim() || outFile
|
|
284
|
-
}
|
|
285
|
-
fs.writeFileSync(outFile, config, 'utf8')
|
|
286
|
-
// if (fs.existsSync(CHECKPOINT)) fs.unlinkSync(CHECKPOINT)
|
|
287
|
-
process.stdout.write(`\n${tag('done', c.green)} Written to ${bold(outFile)}\n`)
|
|
288
|
-
process.stdout.write(dim(`Rules configured: ${Object.keys(state.allRules).length}\n`))
|
|
289
|
-
const hasTs = Object.keys(state.allRules).some(k => k.startsWith('@typescript-eslint/'))
|
|
290
|
-
const hasReact = Object.keys(state.allRules).some(k => k.startsWith('react/') || k.startsWith('react-hooks/'))
|
|
291
|
-
const hasImp = Object.keys(state.allRules).some(k => k.startsWith('import/'))
|
|
292
|
-
const deps = [
|
|
293
|
-
'@eslint/js',
|
|
294
|
-
'globals',
|
|
295
|
-
hasTs ? 'typescript-eslint' : '',
|
|
296
|
-
hasReact ? 'eslint-plugin-react eslint-plugin-react-hooks' : '',
|
|
297
|
-
hasImp ? 'eslint-plugin-import' : '',
|
|
298
|
-
].filter(Boolean).join(' ')
|
|
299
|
-
if (hasTs) {
|
|
300
|
-
const tsconfig = {
|
|
301
|
-
compilerOptions: {
|
|
302
|
-
target: 'ESNext',
|
|
303
|
-
module: 'NodeNext',
|
|
304
|
-
moduleResolution: 'NodeNext',
|
|
305
|
-
strict: true,
|
|
306
|
-
},
|
|
307
|
-
include: ['**/*.ts', '**/*.mts', '**/*.tsx'],
|
|
308
|
-
exclude: ['node_modules'],
|
|
309
|
-
}
|
|
310
|
-
if (!fs.existsSync('tsconfig.json'))
|
|
311
|
-
fs.writeFileSync('tsconfig.json', JSON.stringify(tsconfig, null, 2), 'utf8')
|
|
312
|
-
else
|
|
313
|
-
process.stdout.write(dim('tsconfig.json already exists, skipping.\n'))
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const pm = fs.existsSync('pnpm-lock.yaml') ? 'pnpm' : fs.existsSync('yarn.lock') ? 'yarn' : 'npm'
|
|
317
|
-
process.stdout.write(dim(`Run: ${pm} add -D ${deps}\n\n`))
|
|
318
|
-
fs.closeSync(ttyFd)
|
|
319
|
-
process.exit(0)
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
main().catch(e => { console.error(e); process.exit(1) })
|
package/lint/src/tsconfig.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|