@lqbach/eslint-config 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Quan Bach
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/dist/index.cjs ADDED
@@ -0,0 +1,450 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/configs/eslint-all.js
34
+ var require_eslint_all = __commonJS({
35
+ "../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/configs/eslint-all.js"(exports, module2) {
36
+ "use strict";
37
+ module2.exports = Object.freeze({
38
+ "rules": {
39
+ "accessor-pairs": "error",
40
+ "array-callback-return": "error",
41
+ "arrow-body-style": "error",
42
+ "block-scoped-var": "error",
43
+ "camelcase": "error",
44
+ "capitalized-comments": "error",
45
+ "class-methods-use-this": "error",
46
+ "complexity": "error",
47
+ "consistent-return": "error",
48
+ "consistent-this": "error",
49
+ "constructor-super": "error",
50
+ "curly": "error",
51
+ "default-case": "error",
52
+ "default-case-last": "error",
53
+ "default-param-last": "error",
54
+ "dot-notation": "error",
55
+ "eqeqeq": "error",
56
+ "for-direction": "error",
57
+ "func-name-matching": "error",
58
+ "func-names": "error",
59
+ "func-style": "error",
60
+ "getter-return": "error",
61
+ "grouped-accessor-pairs": "error",
62
+ "guard-for-in": "error",
63
+ "id-denylist": "error",
64
+ "id-length": "error",
65
+ "id-match": "error",
66
+ "init-declarations": "error",
67
+ "line-comment-position": "error",
68
+ "logical-assignment-operators": "error",
69
+ "max-classes-per-file": "error",
70
+ "max-depth": "error",
71
+ "max-lines": "error",
72
+ "max-lines-per-function": "error",
73
+ "max-nested-callbacks": "error",
74
+ "max-params": "error",
75
+ "max-statements": "error",
76
+ "multiline-comment-style": "error",
77
+ "new-cap": "error",
78
+ "no-alert": "error",
79
+ "no-array-constructor": "error",
80
+ "no-async-promise-executor": "error",
81
+ "no-await-in-loop": "error",
82
+ "no-bitwise": "error",
83
+ "no-caller": "error",
84
+ "no-case-declarations": "error",
85
+ "no-class-assign": "error",
86
+ "no-compare-neg-zero": "error",
87
+ "no-cond-assign": "error",
88
+ "no-console": "error",
89
+ "no-const-assign": "error",
90
+ "no-constant-binary-expression": "error",
91
+ "no-constant-condition": "error",
92
+ "no-constructor-return": "error",
93
+ "no-continue": "error",
94
+ "no-control-regex": "error",
95
+ "no-debugger": "error",
96
+ "no-delete-var": "error",
97
+ "no-div-regex": "error",
98
+ "no-dupe-args": "error",
99
+ "no-dupe-class-members": "error",
100
+ "no-dupe-else-if": "error",
101
+ "no-dupe-keys": "error",
102
+ "no-duplicate-case": "error",
103
+ "no-duplicate-imports": "error",
104
+ "no-else-return": "error",
105
+ "no-empty": "error",
106
+ "no-empty-character-class": "error",
107
+ "no-empty-function": "error",
108
+ "no-empty-pattern": "error",
109
+ "no-empty-static-block": "error",
110
+ "no-eq-null": "error",
111
+ "no-eval": "error",
112
+ "no-ex-assign": "error",
113
+ "no-extend-native": "error",
114
+ "no-extra-bind": "error",
115
+ "no-extra-boolean-cast": "error",
116
+ "no-extra-label": "error",
117
+ "no-fallthrough": "error",
118
+ "no-func-assign": "error",
119
+ "no-global-assign": "error",
120
+ "no-implicit-coercion": "error",
121
+ "no-implicit-globals": "error",
122
+ "no-implied-eval": "error",
123
+ "no-import-assign": "error",
124
+ "no-inline-comments": "error",
125
+ "no-inner-declarations": "error",
126
+ "no-invalid-regexp": "error",
127
+ "no-invalid-this": "error",
128
+ "no-irregular-whitespace": "error",
129
+ "no-iterator": "error",
130
+ "no-label-var": "error",
131
+ "no-labels": "error",
132
+ "no-lone-blocks": "error",
133
+ "no-lonely-if": "error",
134
+ "no-loop-func": "error",
135
+ "no-loss-of-precision": "error",
136
+ "no-magic-numbers": "error",
137
+ "no-misleading-character-class": "error",
138
+ "no-multi-assign": "error",
139
+ "no-multi-str": "error",
140
+ "no-negated-condition": "error",
141
+ "no-nested-ternary": "error",
142
+ "no-new": "error",
143
+ "no-new-func": "error",
144
+ "no-new-native-nonconstructor": "error",
145
+ "no-new-symbol": "error",
146
+ "no-new-wrappers": "error",
147
+ "no-nonoctal-decimal-escape": "error",
148
+ "no-obj-calls": "error",
149
+ "no-object-constructor": "error",
150
+ "no-octal": "error",
151
+ "no-octal-escape": "error",
152
+ "no-param-reassign": "error",
153
+ "no-plusplus": "error",
154
+ "no-promise-executor-return": "error",
155
+ "no-proto": "error",
156
+ "no-prototype-builtins": "error",
157
+ "no-redeclare": "error",
158
+ "no-regex-spaces": "error",
159
+ "no-restricted-exports": "error",
160
+ "no-restricted-globals": "error",
161
+ "no-restricted-imports": "error",
162
+ "no-restricted-properties": "error",
163
+ "no-restricted-syntax": "error",
164
+ "no-return-assign": "error",
165
+ "no-script-url": "error",
166
+ "no-self-assign": "error",
167
+ "no-self-compare": "error",
168
+ "no-sequences": "error",
169
+ "no-setter-return": "error",
170
+ "no-shadow": "error",
171
+ "no-shadow-restricted-names": "error",
172
+ "no-sparse-arrays": "error",
173
+ "no-template-curly-in-string": "error",
174
+ "no-ternary": "error",
175
+ "no-this-before-super": "error",
176
+ "no-throw-literal": "error",
177
+ "no-undef": "error",
178
+ "no-undef-init": "error",
179
+ "no-undefined": "error",
180
+ "no-underscore-dangle": "error",
181
+ "no-unexpected-multiline": "error",
182
+ "no-unmodified-loop-condition": "error",
183
+ "no-unneeded-ternary": "error",
184
+ "no-unreachable": "error",
185
+ "no-unreachable-loop": "error",
186
+ "no-unsafe-finally": "error",
187
+ "no-unsafe-negation": "error",
188
+ "no-unsafe-optional-chaining": "error",
189
+ "no-unused-expressions": "error",
190
+ "no-unused-labels": "error",
191
+ "no-unused-private-class-members": "error",
192
+ "no-unused-vars": "error",
193
+ "no-use-before-define": "error",
194
+ "no-useless-backreference": "error",
195
+ "no-useless-call": "error",
196
+ "no-useless-catch": "error",
197
+ "no-useless-computed-key": "error",
198
+ "no-useless-concat": "error",
199
+ "no-useless-constructor": "error",
200
+ "no-useless-escape": "error",
201
+ "no-useless-rename": "error",
202
+ "no-useless-return": "error",
203
+ "no-var": "error",
204
+ "no-void": "error",
205
+ "no-warning-comments": "error",
206
+ "no-with": "error",
207
+ "object-shorthand": "error",
208
+ "one-var": "error",
209
+ "operator-assignment": "error",
210
+ "prefer-arrow-callback": "error",
211
+ "prefer-const": "error",
212
+ "prefer-destructuring": "error",
213
+ "prefer-exponentiation-operator": "error",
214
+ "prefer-named-capture-group": "error",
215
+ "prefer-numeric-literals": "error",
216
+ "prefer-object-has-own": "error",
217
+ "prefer-object-spread": "error",
218
+ "prefer-promise-reject-errors": "error",
219
+ "prefer-regex-literals": "error",
220
+ "prefer-rest-params": "error",
221
+ "prefer-spread": "error",
222
+ "prefer-template": "error",
223
+ "radix": "error",
224
+ "require-atomic-updates": "error",
225
+ "require-await": "error",
226
+ "require-unicode-regexp": "error",
227
+ "require-yield": "error",
228
+ "sort-imports": "error",
229
+ "sort-keys": "error",
230
+ "sort-vars": "error",
231
+ "strict": "error",
232
+ "symbol-description": "error",
233
+ "unicode-bom": "error",
234
+ "use-isnan": "error",
235
+ "valid-typeof": "error",
236
+ "vars-on-top": "error",
237
+ "yoda": "error"
238
+ }
239
+ });
240
+ }
241
+ });
242
+
243
+ // ../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/configs/eslint-recommended.js
244
+ var require_eslint_recommended = __commonJS({
245
+ "../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports, module2) {
246
+ "use strict";
247
+ module2.exports = Object.freeze({
248
+ rules: Object.freeze({
249
+ "constructor-super": "error",
250
+ "for-direction": "error",
251
+ "getter-return": "error",
252
+ "no-async-promise-executor": "error",
253
+ "no-case-declarations": "error",
254
+ "no-class-assign": "error",
255
+ "no-compare-neg-zero": "error",
256
+ "no-cond-assign": "error",
257
+ "no-const-assign": "error",
258
+ "no-constant-condition": "error",
259
+ "no-control-regex": "error",
260
+ "no-debugger": "error",
261
+ "no-delete-var": "error",
262
+ "no-dupe-args": "error",
263
+ "no-dupe-class-members": "error",
264
+ "no-dupe-else-if": "error",
265
+ "no-dupe-keys": "error",
266
+ "no-duplicate-case": "error",
267
+ "no-empty": "error",
268
+ "no-empty-character-class": "error",
269
+ "no-empty-pattern": "error",
270
+ "no-ex-assign": "error",
271
+ "no-extra-boolean-cast": "error",
272
+ "no-extra-semi": "error",
273
+ "no-fallthrough": "error",
274
+ "no-func-assign": "error",
275
+ "no-global-assign": "error",
276
+ "no-import-assign": "error",
277
+ "no-inner-declarations": "error",
278
+ "no-invalid-regexp": "error",
279
+ "no-irregular-whitespace": "error",
280
+ "no-loss-of-precision": "error",
281
+ "no-misleading-character-class": "error",
282
+ "no-mixed-spaces-and-tabs": "error",
283
+ "no-new-symbol": "error",
284
+ "no-nonoctal-decimal-escape": "error",
285
+ "no-obj-calls": "error",
286
+ "no-octal": "error",
287
+ "no-prototype-builtins": "error",
288
+ "no-redeclare": "error",
289
+ "no-regex-spaces": "error",
290
+ "no-self-assign": "error",
291
+ "no-setter-return": "error",
292
+ "no-shadow-restricted-names": "error",
293
+ "no-sparse-arrays": "error",
294
+ "no-this-before-super": "error",
295
+ "no-undef": "error",
296
+ "no-unexpected-multiline": "error",
297
+ "no-unreachable": "error",
298
+ "no-unsafe-finally": "error",
299
+ "no-unsafe-negation": "error",
300
+ "no-unsafe-optional-chaining": "error",
301
+ "no-unused-labels": "error",
302
+ "no-unused-vars": "error",
303
+ "no-useless-backreference": "error",
304
+ "no-useless-catch": "error",
305
+ "no-useless-escape": "error",
306
+ "no-with": "error",
307
+ "require-yield": "error",
308
+ "use-isnan": "error",
309
+ "valid-typeof": "error"
310
+ })
311
+ });
312
+ }
313
+ });
314
+
315
+ // ../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/index.js
316
+ var require_src = __commonJS({
317
+ "../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/index.js"(exports, module2) {
318
+ "use strict";
319
+ module2.exports = {
320
+ configs: {
321
+ all: require_eslint_all(),
322
+ recommended: require_eslint_recommended()
323
+ }
324
+ };
325
+ }
326
+ });
327
+
328
+ // src/index.ts
329
+ var src_exports = {};
330
+ __export(src_exports, {
331
+ default: () => config
332
+ });
333
+ module.exports = __toCommonJS(src_exports);
334
+
335
+ // src/libs.ts
336
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
337
+ var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
338
+ var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
339
+ var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
340
+ var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
341
+ var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
342
+ var import_js = __toESM(require_src(), 1);
343
+ var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
344
+
345
+ // src/index.ts
346
+ var import_globals = __toESM(require("globals"), 1);
347
+ function config(params) {
348
+ const typescriptConfig = params.typescript ?? true ? {
349
+ files: ["**/*.{ts,tsx}"],
350
+ languageOptions: {
351
+ parser: import_parser.default,
352
+ parserOptions: {
353
+ sourceType: "module"
354
+ }
355
+ },
356
+ plugins: {
357
+ "@typescript-eslint": import_eslint_plugin.default
358
+ },
359
+ rules: {
360
+ ...import_eslint_plugin.default.configs.recommended.rules
361
+ }
362
+ } : {};
363
+ const reactConfig = params.react ?? false ? {
364
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
365
+ plugins: {
366
+ react: import_eslint_plugin_react.default
367
+ },
368
+ rules: {
369
+ ...import_eslint_plugin_react.default.configs.recommended.rules
370
+ }
371
+ } : {};
372
+ const vueConfig = params.vue ?? false ? {
373
+ files: ["**/*.vue"],
374
+ languageOptions: {
375
+ parser: import_vue_eslint_parser.default,
376
+ parserOptions: {
377
+ parser: params.typescript ? import_parser.default : null,
378
+ sourceType: "module"
379
+ }
380
+ },
381
+ rules: {
382
+ ...import_eslint_plugin_vue.default.configs["base"].rules,
383
+ ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
384
+ ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules
385
+ }
386
+ } : {};
387
+ return [
388
+ // Files to ignore
389
+ {
390
+ ignores: [
391
+ "**/node_modules",
392
+ "**/dist",
393
+ "**/package-lock.json",
394
+ "**/yarn.lock",
395
+ "**/pnpm-lock.yaml",
396
+ "**/bun.lockb",
397
+ "**/output",
398
+ "**/coverage",
399
+ "**/temp",
400
+ "**/.nuxt",
401
+ "**/.next",
402
+ "**/.vercel",
403
+ "**/.changeset",
404
+ "**/.idea",
405
+ "**/.cache",
406
+ "**/.output",
407
+ "**/*.min.*",
408
+ "**/LICENSE*"
409
+ ]
410
+ },
411
+ // Default
412
+ import_js.default.configs.recommended,
413
+ {
414
+ files: ["**/*.js", "**/*.mjs"],
415
+ languageOptions: {
416
+ ecmaVersion: 2022,
417
+ parserOptions: {
418
+ sourceType: "module"
419
+ },
420
+ globals: {
421
+ ...import_globals.default.browser,
422
+ ...import_globals.default.node,
423
+ ...import_globals.default.es6,
424
+ ...import_globals.default.commonjs
425
+ }
426
+ },
427
+ plugins: {
428
+ "unused-imports": import_eslint_plugin_unused_imports.default
429
+ },
430
+ rules: {
431
+ "unused-imports/no-unused-imports": "error",
432
+ "unused-imports/no-unused-vars": [
433
+ "warn",
434
+ {
435
+ vars: "all",
436
+ varsIgnorePattern: "^_",
437
+ args: "after-used",
438
+ argsIgnorePattern: "^_"
439
+ }
440
+ ]
441
+ }
442
+ },
443
+ {
444
+ ...typescriptConfig,
445
+ ...reactConfig,
446
+ ...vueConfig
447
+ },
448
+ import_eslint_config_prettier.default
449
+ ];
450
+ }
package/dist/index.js ADDED
@@ -0,0 +1,440 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // ../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/configs/eslint-all.js
28
+ var require_eslint_all = __commonJS({
29
+ "../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/configs/eslint-all.js"(exports, module) {
30
+ "use strict";
31
+ module.exports = Object.freeze({
32
+ "rules": {
33
+ "accessor-pairs": "error",
34
+ "array-callback-return": "error",
35
+ "arrow-body-style": "error",
36
+ "block-scoped-var": "error",
37
+ "camelcase": "error",
38
+ "capitalized-comments": "error",
39
+ "class-methods-use-this": "error",
40
+ "complexity": "error",
41
+ "consistent-return": "error",
42
+ "consistent-this": "error",
43
+ "constructor-super": "error",
44
+ "curly": "error",
45
+ "default-case": "error",
46
+ "default-case-last": "error",
47
+ "default-param-last": "error",
48
+ "dot-notation": "error",
49
+ "eqeqeq": "error",
50
+ "for-direction": "error",
51
+ "func-name-matching": "error",
52
+ "func-names": "error",
53
+ "func-style": "error",
54
+ "getter-return": "error",
55
+ "grouped-accessor-pairs": "error",
56
+ "guard-for-in": "error",
57
+ "id-denylist": "error",
58
+ "id-length": "error",
59
+ "id-match": "error",
60
+ "init-declarations": "error",
61
+ "line-comment-position": "error",
62
+ "logical-assignment-operators": "error",
63
+ "max-classes-per-file": "error",
64
+ "max-depth": "error",
65
+ "max-lines": "error",
66
+ "max-lines-per-function": "error",
67
+ "max-nested-callbacks": "error",
68
+ "max-params": "error",
69
+ "max-statements": "error",
70
+ "multiline-comment-style": "error",
71
+ "new-cap": "error",
72
+ "no-alert": "error",
73
+ "no-array-constructor": "error",
74
+ "no-async-promise-executor": "error",
75
+ "no-await-in-loop": "error",
76
+ "no-bitwise": "error",
77
+ "no-caller": "error",
78
+ "no-case-declarations": "error",
79
+ "no-class-assign": "error",
80
+ "no-compare-neg-zero": "error",
81
+ "no-cond-assign": "error",
82
+ "no-console": "error",
83
+ "no-const-assign": "error",
84
+ "no-constant-binary-expression": "error",
85
+ "no-constant-condition": "error",
86
+ "no-constructor-return": "error",
87
+ "no-continue": "error",
88
+ "no-control-regex": "error",
89
+ "no-debugger": "error",
90
+ "no-delete-var": "error",
91
+ "no-div-regex": "error",
92
+ "no-dupe-args": "error",
93
+ "no-dupe-class-members": "error",
94
+ "no-dupe-else-if": "error",
95
+ "no-dupe-keys": "error",
96
+ "no-duplicate-case": "error",
97
+ "no-duplicate-imports": "error",
98
+ "no-else-return": "error",
99
+ "no-empty": "error",
100
+ "no-empty-character-class": "error",
101
+ "no-empty-function": "error",
102
+ "no-empty-pattern": "error",
103
+ "no-empty-static-block": "error",
104
+ "no-eq-null": "error",
105
+ "no-eval": "error",
106
+ "no-ex-assign": "error",
107
+ "no-extend-native": "error",
108
+ "no-extra-bind": "error",
109
+ "no-extra-boolean-cast": "error",
110
+ "no-extra-label": "error",
111
+ "no-fallthrough": "error",
112
+ "no-func-assign": "error",
113
+ "no-global-assign": "error",
114
+ "no-implicit-coercion": "error",
115
+ "no-implicit-globals": "error",
116
+ "no-implied-eval": "error",
117
+ "no-import-assign": "error",
118
+ "no-inline-comments": "error",
119
+ "no-inner-declarations": "error",
120
+ "no-invalid-regexp": "error",
121
+ "no-invalid-this": "error",
122
+ "no-irregular-whitespace": "error",
123
+ "no-iterator": "error",
124
+ "no-label-var": "error",
125
+ "no-labels": "error",
126
+ "no-lone-blocks": "error",
127
+ "no-lonely-if": "error",
128
+ "no-loop-func": "error",
129
+ "no-loss-of-precision": "error",
130
+ "no-magic-numbers": "error",
131
+ "no-misleading-character-class": "error",
132
+ "no-multi-assign": "error",
133
+ "no-multi-str": "error",
134
+ "no-negated-condition": "error",
135
+ "no-nested-ternary": "error",
136
+ "no-new": "error",
137
+ "no-new-func": "error",
138
+ "no-new-native-nonconstructor": "error",
139
+ "no-new-symbol": "error",
140
+ "no-new-wrappers": "error",
141
+ "no-nonoctal-decimal-escape": "error",
142
+ "no-obj-calls": "error",
143
+ "no-object-constructor": "error",
144
+ "no-octal": "error",
145
+ "no-octal-escape": "error",
146
+ "no-param-reassign": "error",
147
+ "no-plusplus": "error",
148
+ "no-promise-executor-return": "error",
149
+ "no-proto": "error",
150
+ "no-prototype-builtins": "error",
151
+ "no-redeclare": "error",
152
+ "no-regex-spaces": "error",
153
+ "no-restricted-exports": "error",
154
+ "no-restricted-globals": "error",
155
+ "no-restricted-imports": "error",
156
+ "no-restricted-properties": "error",
157
+ "no-restricted-syntax": "error",
158
+ "no-return-assign": "error",
159
+ "no-script-url": "error",
160
+ "no-self-assign": "error",
161
+ "no-self-compare": "error",
162
+ "no-sequences": "error",
163
+ "no-setter-return": "error",
164
+ "no-shadow": "error",
165
+ "no-shadow-restricted-names": "error",
166
+ "no-sparse-arrays": "error",
167
+ "no-template-curly-in-string": "error",
168
+ "no-ternary": "error",
169
+ "no-this-before-super": "error",
170
+ "no-throw-literal": "error",
171
+ "no-undef": "error",
172
+ "no-undef-init": "error",
173
+ "no-undefined": "error",
174
+ "no-underscore-dangle": "error",
175
+ "no-unexpected-multiline": "error",
176
+ "no-unmodified-loop-condition": "error",
177
+ "no-unneeded-ternary": "error",
178
+ "no-unreachable": "error",
179
+ "no-unreachable-loop": "error",
180
+ "no-unsafe-finally": "error",
181
+ "no-unsafe-negation": "error",
182
+ "no-unsafe-optional-chaining": "error",
183
+ "no-unused-expressions": "error",
184
+ "no-unused-labels": "error",
185
+ "no-unused-private-class-members": "error",
186
+ "no-unused-vars": "error",
187
+ "no-use-before-define": "error",
188
+ "no-useless-backreference": "error",
189
+ "no-useless-call": "error",
190
+ "no-useless-catch": "error",
191
+ "no-useless-computed-key": "error",
192
+ "no-useless-concat": "error",
193
+ "no-useless-constructor": "error",
194
+ "no-useless-escape": "error",
195
+ "no-useless-rename": "error",
196
+ "no-useless-return": "error",
197
+ "no-var": "error",
198
+ "no-void": "error",
199
+ "no-warning-comments": "error",
200
+ "no-with": "error",
201
+ "object-shorthand": "error",
202
+ "one-var": "error",
203
+ "operator-assignment": "error",
204
+ "prefer-arrow-callback": "error",
205
+ "prefer-const": "error",
206
+ "prefer-destructuring": "error",
207
+ "prefer-exponentiation-operator": "error",
208
+ "prefer-named-capture-group": "error",
209
+ "prefer-numeric-literals": "error",
210
+ "prefer-object-has-own": "error",
211
+ "prefer-object-spread": "error",
212
+ "prefer-promise-reject-errors": "error",
213
+ "prefer-regex-literals": "error",
214
+ "prefer-rest-params": "error",
215
+ "prefer-spread": "error",
216
+ "prefer-template": "error",
217
+ "radix": "error",
218
+ "require-atomic-updates": "error",
219
+ "require-await": "error",
220
+ "require-unicode-regexp": "error",
221
+ "require-yield": "error",
222
+ "sort-imports": "error",
223
+ "sort-keys": "error",
224
+ "sort-vars": "error",
225
+ "strict": "error",
226
+ "symbol-description": "error",
227
+ "unicode-bom": "error",
228
+ "use-isnan": "error",
229
+ "valid-typeof": "error",
230
+ "vars-on-top": "error",
231
+ "yoda": "error"
232
+ }
233
+ });
234
+ }
235
+ });
236
+
237
+ // ../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/configs/eslint-recommended.js
238
+ var require_eslint_recommended = __commonJS({
239
+ "../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports, module) {
240
+ "use strict";
241
+ module.exports = Object.freeze({
242
+ rules: Object.freeze({
243
+ "constructor-super": "error",
244
+ "for-direction": "error",
245
+ "getter-return": "error",
246
+ "no-async-promise-executor": "error",
247
+ "no-case-declarations": "error",
248
+ "no-class-assign": "error",
249
+ "no-compare-neg-zero": "error",
250
+ "no-cond-assign": "error",
251
+ "no-const-assign": "error",
252
+ "no-constant-condition": "error",
253
+ "no-control-regex": "error",
254
+ "no-debugger": "error",
255
+ "no-delete-var": "error",
256
+ "no-dupe-args": "error",
257
+ "no-dupe-class-members": "error",
258
+ "no-dupe-else-if": "error",
259
+ "no-dupe-keys": "error",
260
+ "no-duplicate-case": "error",
261
+ "no-empty": "error",
262
+ "no-empty-character-class": "error",
263
+ "no-empty-pattern": "error",
264
+ "no-ex-assign": "error",
265
+ "no-extra-boolean-cast": "error",
266
+ "no-extra-semi": "error",
267
+ "no-fallthrough": "error",
268
+ "no-func-assign": "error",
269
+ "no-global-assign": "error",
270
+ "no-import-assign": "error",
271
+ "no-inner-declarations": "error",
272
+ "no-invalid-regexp": "error",
273
+ "no-irregular-whitespace": "error",
274
+ "no-loss-of-precision": "error",
275
+ "no-misleading-character-class": "error",
276
+ "no-mixed-spaces-and-tabs": "error",
277
+ "no-new-symbol": "error",
278
+ "no-nonoctal-decimal-escape": "error",
279
+ "no-obj-calls": "error",
280
+ "no-octal": "error",
281
+ "no-prototype-builtins": "error",
282
+ "no-redeclare": "error",
283
+ "no-regex-spaces": "error",
284
+ "no-self-assign": "error",
285
+ "no-setter-return": "error",
286
+ "no-shadow-restricted-names": "error",
287
+ "no-sparse-arrays": "error",
288
+ "no-this-before-super": "error",
289
+ "no-undef": "error",
290
+ "no-unexpected-multiline": "error",
291
+ "no-unreachable": "error",
292
+ "no-unsafe-finally": "error",
293
+ "no-unsafe-negation": "error",
294
+ "no-unsafe-optional-chaining": "error",
295
+ "no-unused-labels": "error",
296
+ "no-unused-vars": "error",
297
+ "no-useless-backreference": "error",
298
+ "no-useless-catch": "error",
299
+ "no-useless-escape": "error",
300
+ "no-with": "error",
301
+ "require-yield": "error",
302
+ "use-isnan": "error",
303
+ "valid-typeof": "error"
304
+ })
305
+ });
306
+ }
307
+ });
308
+
309
+ // ../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/index.js
310
+ var require_src = __commonJS({
311
+ "../../node_modules/.pnpm/@eslint+js@8.53.0/node_modules/@eslint/js/src/index.js"(exports, module) {
312
+ "use strict";
313
+ module.exports = {
314
+ configs: {
315
+ all: require_eslint_all(),
316
+ recommended: require_eslint_recommended()
317
+ }
318
+ };
319
+ }
320
+ });
321
+
322
+ // src/libs.ts
323
+ var import_js = __toESM(require_src(), 1);
324
+ import { default as default2 } from "eslint-plugin-unused-imports";
325
+ import { default as default3 } from "@typescript-eslint/eslint-plugin";
326
+ import { default as default4 } from "eslint-plugin-react";
327
+ import { default as default5 } from "eslint-plugin-vue";
328
+ import { default as default6 } from "@typescript-eslint/parser";
329
+ import { default as default7 } from "vue-eslint-parser";
330
+ import { default as default9 } from "eslint-config-prettier";
331
+
332
+ // src/index.ts
333
+ import globals from "globals";
334
+ function config(params) {
335
+ const typescriptConfig = params.typescript ?? true ? {
336
+ files: ["**/*.{ts,tsx}"],
337
+ languageOptions: {
338
+ parser: default6,
339
+ parserOptions: {
340
+ sourceType: "module"
341
+ }
342
+ },
343
+ plugins: {
344
+ "@typescript-eslint": default3
345
+ },
346
+ rules: {
347
+ ...default3.configs.recommended.rules
348
+ }
349
+ } : {};
350
+ const reactConfig = params.react ?? false ? {
351
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
352
+ plugins: {
353
+ react: default4
354
+ },
355
+ rules: {
356
+ ...default4.configs.recommended.rules
357
+ }
358
+ } : {};
359
+ const vueConfig = params.vue ?? false ? {
360
+ files: ["**/*.vue"],
361
+ languageOptions: {
362
+ parser: default7,
363
+ parserOptions: {
364
+ parser: params.typescript ? default6 : null,
365
+ sourceType: "module"
366
+ }
367
+ },
368
+ rules: {
369
+ ...default5.configs["base"].rules,
370
+ ...default5.configs["vue3-essential"].rules,
371
+ ...default5.configs["vue3-strongly-recommended"].rules
372
+ }
373
+ } : {};
374
+ return [
375
+ // Files to ignore
376
+ {
377
+ ignores: [
378
+ "**/node_modules",
379
+ "**/dist",
380
+ "**/package-lock.json",
381
+ "**/yarn.lock",
382
+ "**/pnpm-lock.yaml",
383
+ "**/bun.lockb",
384
+ "**/output",
385
+ "**/coverage",
386
+ "**/temp",
387
+ "**/.nuxt",
388
+ "**/.next",
389
+ "**/.vercel",
390
+ "**/.changeset",
391
+ "**/.idea",
392
+ "**/.cache",
393
+ "**/.output",
394
+ "**/*.min.*",
395
+ "**/LICENSE*"
396
+ ]
397
+ },
398
+ // Default
399
+ import_js.default.configs.recommended,
400
+ {
401
+ files: ["**/*.js", "**/*.mjs"],
402
+ languageOptions: {
403
+ ecmaVersion: 2022,
404
+ parserOptions: {
405
+ sourceType: "module"
406
+ },
407
+ globals: {
408
+ ...globals.browser,
409
+ ...globals.node,
410
+ ...globals.es6,
411
+ ...globals.commonjs
412
+ }
413
+ },
414
+ plugins: {
415
+ "unused-imports": default2
416
+ },
417
+ rules: {
418
+ "unused-imports/no-unused-imports": "error",
419
+ "unused-imports/no-unused-vars": [
420
+ "warn",
421
+ {
422
+ vars: "all",
423
+ varsIgnorePattern: "^_",
424
+ args: "after-used",
425
+ argsIgnorePattern: "^_"
426
+ }
427
+ ]
428
+ }
429
+ },
430
+ {
431
+ ...typescriptConfig,
432
+ ...reactConfig,
433
+ ...vueConfig
434
+ },
435
+ default9
436
+ ];
437
+ }
438
+ export {
439
+ config as default
440
+ };
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@lqbach/eslint-config",
3
+ "type": "module",
4
+ "version": "0.1.0",
5
+ "description": "Quan's Personal Eslint Config",
6
+ "exports": {
7
+ "./index": "./dist/index.js"
8
+ },
9
+ "dependencies": {
10
+ "@typescript-eslint/eslint-plugin": "^6.10.0",
11
+ "@typescript-eslint/parser": "^6.10.0",
12
+ "eslint-config-prettier": "^9.0.0",
13
+ "eslint-plugin-react": "^7.33.2",
14
+ "eslint-plugin-unused-imports": "^3.0.0",
15
+ "eslint-plugin-vue": "^9.18.1",
16
+ "globals": "^13.23.0",
17
+ "remove": "^0.1.5",
18
+ "typescript": "^5.2.2",
19
+ "vue-eslint-parser": "^9.3.2"
20
+ },
21
+ "devDependencies": {
22
+ "eslint": "^8.53.0"
23
+ },
24
+ "scripts": {
25
+ "build": "tsup src/index.ts src/react.ts src/vue.ts --format esm,cjs --clean"
26
+ }
27
+ }
package/src/index.ts ADDED
@@ -0,0 +1,139 @@
1
+ import {
2
+ pluginUnusedImports,
3
+ pluginTypeScript,
4
+ pluginReact,
5
+ pluginVue,
6
+ parserTypeScript,
7
+ parserVue,
8
+ jsConfig,
9
+ configPrettier,
10
+ } from "./libs"
11
+
12
+ import { ConfigParams, ConfigObject } from "./types"
13
+
14
+ import globals from "globals"
15
+
16
+ export default function config(params: ConfigParams) {
17
+ // TypeScript Config
18
+ const typescriptConfig: ConfigObject =
19
+ params.typescript ?? true
20
+ ? {
21
+ files: ["**/*.{ts,tsx}"],
22
+ languageOptions: {
23
+ parser: parserTypeScript,
24
+ parserOptions: {
25
+ sourceType: "module",
26
+ },
27
+ },
28
+ plugins: {
29
+ "@typescript-eslint": pluginTypeScript,
30
+ },
31
+ rules: {
32
+ ...pluginTypeScript.configs.recommended.rules,
33
+ },
34
+ }
35
+ : {}
36
+
37
+ // React Config: turned off by default
38
+ const reactConfig: ConfigObject =
39
+ params.react ?? false
40
+ ? {
41
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
42
+ plugins: {
43
+ react: pluginReact,
44
+ },
45
+ rules: {
46
+ ...pluginReact.configs.recommended.rules,
47
+ },
48
+ }
49
+ : {}
50
+
51
+ // Vue Config: turned off by default
52
+ const vueConfig: ConfigObject =
53
+ params.vue ?? false
54
+ ? {
55
+ files: ["**/*.vue"],
56
+ languageOptions: {
57
+ parser: parserVue,
58
+ parserOptions: {
59
+ parser: params.typescript ? parserTypeScript : null,
60
+ sourceType: "module",
61
+ },
62
+ },
63
+ rules: {
64
+ ...pluginVue.configs["base"].rules,
65
+ ...pluginVue.configs["vue3-essential"].rules,
66
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
67
+ },
68
+ }
69
+ : {}
70
+
71
+ return [
72
+ // Files to ignore
73
+ {
74
+ ignores: [
75
+ "**/node_modules",
76
+ "**/dist",
77
+ "**/package-lock.json",
78
+ "**/yarn.lock",
79
+ "**/pnpm-lock.yaml",
80
+ "**/bun.lockb",
81
+
82
+ "**/output",
83
+ "**/coverage",
84
+ "**/temp",
85
+ "**/.nuxt",
86
+ "**/.next",
87
+ "**/.vercel",
88
+ "**/.changeset",
89
+ "**/.idea",
90
+ "**/.cache",
91
+ "**/.output",
92
+
93
+ "**/*.min.*",
94
+ "**/LICENSE*",
95
+ ],
96
+ },
97
+
98
+ // Default
99
+ jsConfig.configs.recommended,
100
+ {
101
+ files: ["**/*.js", "**/*.mjs"],
102
+ languageOptions: {
103
+ ecmaVersion: 2022,
104
+ parserOptions: {
105
+ sourceType: "module",
106
+ },
107
+ globals: {
108
+ ...globals.browser,
109
+ ...globals.node,
110
+ ...globals.es6,
111
+ ...globals.commonjs,
112
+ },
113
+ },
114
+ plugins: {
115
+ "unused-imports": pluginUnusedImports,
116
+ },
117
+ rules: {
118
+ "unused-imports/no-unused-imports": "error",
119
+ "unused-imports/no-unused-vars": [
120
+ "warn",
121
+ {
122
+ vars: "all",
123
+ varsIgnorePattern: "^_",
124
+ args: "after-used",
125
+ argsIgnorePattern: "^_",
126
+ },
127
+ ],
128
+ },
129
+ },
130
+
131
+ {
132
+ ...typescriptConfig,
133
+ ...reactConfig,
134
+ ...vueConfig,
135
+ },
136
+
137
+ configPrettier,
138
+ ]
139
+ }
package/src/libs.ts ADDED
@@ -0,0 +1,15 @@
1
+ // using plugin versioning inspired by antfu
2
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
+ // @ts-nocheck
4
+
5
+ export { default as pluginUnusedImports } from "eslint-plugin-unused-imports"
6
+ export { default as pluginTypeScript } from "@typescript-eslint/eslint-plugin"
7
+ export { default as pluginReact } from "eslint-plugin-react"
8
+ export { default as pluginVue } from "eslint-plugin-vue"
9
+
10
+ export { default as parserTypeScript } from "@typescript-eslint/parser"
11
+ export { default as parserVue } from "vue-eslint-parser"
12
+
13
+ export { default as jsConfig } from "@eslint/js"
14
+
15
+ export { default as configPrettier } from "eslint-config-prettier"
package/src/types.ts ADDED
@@ -0,0 +1,34 @@
1
+ import globals from "globals"
2
+
3
+ export interface ConfigParams {
4
+ typescript?: boolean
5
+ vue?: boolean
6
+ react?: boolean
7
+ json?: boolean
8
+ yaml?: boolean
9
+ markdown?: boolean
10
+ }
11
+
12
+ export interface LanguageOptions {
13
+ ecmaVersion?: string,
14
+ sourceType?: string,
15
+ globals?: object,
16
+ parser?: object,
17
+ parserOptions?: object,
18
+ }
19
+
20
+ export interface LinterOptions {
21
+ noInlineConfig?: boolean,
22
+ reportUnusedDisableDirectives?: boolean
23
+ }
24
+
25
+ export interface ConfigObject {
26
+ files?: Array<string>,
27
+ ignores?: Array<string>,
28
+ languageOptions?: LanguageOptions,
29
+ linterOptions?: LinterOptions,
30
+ processor?: object,
31
+ plugins?: object,
32
+ rules?: object,
33
+ settings?: object
34
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "declaration": true,
7
+ "strict": true,
8
+ "incremental": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "rootDir": "./src",
13
+ "outDir": "./dist",
14
+ "composite": true
15
+ }
16
+ }