@fabdeh/eslint-config 0.0.3 → 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/dist/index.js DELETED
@@ -1,880 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/configs/index.ts
8
- var configs_exports = {};
9
- __export(configs_exports, {
10
- angular: () => angular_default,
11
- base: () => base_default,
12
- jest: () => jest_default,
13
- ngrx: () => ngrx_exports,
14
- tailwindcss: () => tailwindcss_default,
15
- vitest: () => vitest_default
16
- });
17
-
18
- // src/configs/angular.ts
19
- import nx from "@nx/eslint-plugin";
20
- import tseslint from "typescript-eslint";
21
-
22
- // src/globs.ts
23
- var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
24
- var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
25
- var GLOB_JS = "**/*.?([cm])js?(x)";
26
- var GLOB_TS_EXT = "?([cm])ts?(x)";
27
- var GLOB_TS = `**/*.${GLOB_TS_EXT}`;
28
- var GLOB_HTML = "**/*.htm?(l)";
29
- var GLOB_TESTS = [`**/*.spec.${GLOB_SRC_EXT}`, `**/*.test.${GLOB_SRC_EXT}`, `**/test-setup.${GLOB_SRC_EXT}`];
30
- var GLOB_EXCLUDE = [
31
- "**/node_modules",
32
- "**/dist",
33
- "**/package-lock.json",
34
- "**/yarn.lock",
35
- "**/pnpm-lock.yaml",
36
- "**/bun.lockb",
37
- "**/output",
38
- "**/coverage",
39
- "**/temp",
40
- "**/.temp",
41
- "**/tmp",
42
- "**/.tmp",
43
- "**/.history",
44
- "**/.vitepress/cache",
45
- "**/.nuxt",
46
- "**/.next",
47
- "**/.svelte-kit",
48
- "**/.vercel",
49
- "**/.changeset",
50
- "**/.idea",
51
- "**/.cache",
52
- "**/.output",
53
- "**/.tsup",
54
- "**/.vite-inspect",
55
- "**/.yarn",
56
- "**/vite.config.*.timestamp-*",
57
- "**/CHANGELOG*.md",
58
- "**/*.min.*",
59
- "**/LICENSE*",
60
- "**/__snapshots__",
61
- "**/auto-import?(s).d.ts",
62
- "**/components.d.ts"
63
- ];
64
-
65
- // src/configs/angular.ts
66
- var angular_default = tseslint.config(
67
- nx.configs["flat/angular"],
68
- nx.configs["flat/angular-template"],
69
- {
70
- name: "fabdeh/angular/rules",
71
- files: [GLOB_TS],
72
- rules: {
73
- "max-classes-per-file": ["error", 1],
74
- "max-lines": ["error", 400],
75
- "@angular-eslint/component-max-inline-declarations": "error",
76
- "@angular-eslint/contextual-decorator": "error",
77
- "@angular-eslint/no-async-lifecycle-method": "error",
78
- "@angular-eslint/no-attribute-decorator": "error",
79
- "@angular-eslint/no-conflicting-lifecycle": "error",
80
- "@angular-eslint/no-duplicates-in-metadata-arrays": "error",
81
- "@angular-eslint/no-forward-ref": "error",
82
- "@angular-eslint/no-lifecycle-call": "error",
83
- "@angular-eslint/no-pipe-impure": "error",
84
- "@angular-eslint/no-queries-metadata-property": "error",
85
- "@angular-eslint/prefer-output-readonly": "error",
86
- "@angular-eslint/prefer-signals": "error",
87
- "@angular-eslint/relative-url-prefix": "error",
88
- "@angular-eslint/sort-lifecycle-methods": "error",
89
- "@angular-eslint/use-component-selector": "error",
90
- "@angular-eslint/use-component-view-encapsulation": "error",
91
- "@angular-eslint/use-lifecycle-interface": "error"
92
- }
93
- },
94
- {
95
- name: "fabdeh/angular-template/rules",
96
- files: [GLOB_HTML],
97
- rules: {
98
- "@angular-eslint/template/attributes-order": ["error", { alphabetical: true }],
99
- "@angular-eslint/template/button-has-type": "error",
100
- "@angular-eslint/template/conditional-complexity": "error",
101
- "@angular-eslint/template/eqeqeq": ["error", { allowNullOrUndefined: true }],
102
- "@angular-eslint/template/no-any": "error",
103
- "@angular-eslint/template/no-duplicate-attributes": "error",
104
- "@angular-eslint/template/no-interpolation-in-attributes": "error",
105
- "@angular-eslint/template/no-positive-tabindex": "error",
106
- "@angular-eslint/template/prefer-control-flow": "error",
107
- "@angular-eslint/template/prefer-ngsrc": "error",
108
- "@angular-eslint/template/prefer-self-closing-tags": "error",
109
- // accessibility
110
- "@angular-eslint/template/alt-text": "error",
111
- "@angular-eslint/template/click-events-have-key-events": "warn",
112
- "@angular-eslint/template/elements-content": "error",
113
- "@angular-eslint/template/interactive-supports-focus": "warn",
114
- "@angular-eslint/template/label-has-associated-control": "error",
115
- "@angular-eslint/template/mouse-events-have-key-events": "warn",
116
- "@angular-eslint/template/no-autofocus": "error",
117
- "@angular-eslint/template/no-distracting-elements": "error",
118
- "@angular-eslint/template/role-has-required-aria": "error",
119
- "@angular-eslint/template/table-scope": "error",
120
- "@angular-eslint/template/valid-aria": "error"
121
- }
122
- }
123
- );
124
-
125
- // src/configs/base.ts
126
- import eslintComments from "@eslint-community/eslint-plugin-eslint-comments";
127
- import nx2 from "@nx/eslint-plugin";
128
- import stylistic from "@stylistic/eslint-plugin";
129
- import * as importX from "eslint-plugin-import-x";
130
- import jsdoc from "eslint-plugin-jsdoc";
131
- import perfectionist from "eslint-plugin-perfectionist";
132
- import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
133
- import unicorn from "eslint-plugin-unicorn";
134
- import unusedImports from "eslint-plugin-unused-imports";
135
- import globals from "globals";
136
- import tseslint2 from "typescript-eslint";
137
-
138
- // src/utils.ts
139
- function isInEditorEnv() {
140
- if (process.env.CI) {
141
- return false;
142
- }
143
- const envKeys = Object.keys(process.env);
144
- if (envKeys.some((k) => /^GIT_/i.test(k))) {
145
- return false;
146
- }
147
- const isVsCode = envKeys.some((k) => /^VSCODE_/i.test(k));
148
- const isIntelliJ = envKeys.some((k) => /^INTELLIJ_/i.test(k));
149
- const isJetbrains = envKeys.some((k) => /^JETBRAINS_/i.test(k));
150
- const isVim = envKeys.some((k) => /^VIM$/i.test(k));
151
- const isNeoVim = envKeys.some((k) => /^NVIM$/i.test(k));
152
- return isVsCode || isIntelliJ || isJetbrains || isVim || isNeoVim;
153
- }
154
- function dedupeTsBaseConfig(...configs) {
155
- return configs.filter((c) => !c.name || c.name !== "typescript-eslint/base");
156
- }
157
- function ensureCorrectFiles(files) {
158
- return (config) => {
159
- if ("rules" in config && !("files" in config)) {
160
- return {
161
- ...config,
162
- files
163
- };
164
- }
165
- return config;
166
- };
167
- }
168
-
169
- // src/configs/rules-configs/member-ordering.ts
170
- var member_ordering_default = {
171
- default: [
172
- "signature",
173
- "#private-field",
174
- "private-field",
175
- "protected-field",
176
- "public-field",
177
- ["#private-accessor", "#private-get", "#private-set"],
178
- ["private-accessor", "private-get", "private-set"],
179
- ["protected-accessor", "protected-get", "protected-set"],
180
- ["public-accessor", "public-get", "public-set"],
181
- "static-initialization",
182
- "constructor",
183
- "call-signature",
184
- "public-method",
185
- "protected-method",
186
- "private-method",
187
- "#private-method"
188
- ]
189
- };
190
-
191
- // src/configs/rules-configs/naming-convention.ts
192
- var naming_convention_default = [
193
- { selector: "default", format: ["camelCase"], leadingUnderscore: "forbid", trailingUnderscore: "forbid" },
194
- { selector: ["variableLike", "memberLike"], format: ["camelCase"] },
195
- // eslint-disable-next-line unicorn/no-null
196
- { selector: "memberLike", modifiers: ["requiresQuotes"], format: null },
197
- { selector: "typeLike", format: ["PascalCase"] },
198
- { selector: "variable", modifiers: ["const", "global"], format: ["UPPER_CASE"] },
199
- { selector: "enumMember", format: ["UPPER_CASE"] },
200
- { selector: "parameter", modifiers: ["unused"], format: ["camelCase"], leadingUnderscore: "allow" },
201
- { selector: "import", modifiers: ["default"], format: ["camelCase", "PascalCase"] },
202
- { selector: "import", modifiers: ["namespace"], format: ["camelCase", "PascalCase"] }
203
- ];
204
-
205
- // src/configs/rules-configs/perfectionist-groups.ts
206
- var SORT_IMPORT_GROUPS = [
207
- "type",
208
- "builtin-type",
209
- "builtin",
210
- { newlinesBetween: "always" },
211
- "external-type",
212
- "external",
213
- { newlinesBetween: "always" },
214
- "internal-type",
215
- "internal",
216
- { newlinesBetween: "always" },
217
- "parent-type",
218
- "parent",
219
- { newlinesBetween: "always" },
220
- "sibling-type",
221
- "sibling",
222
- { newlinesBetween: "always" },
223
- "index-type",
224
- "index",
225
- { newlinesBetween: "always" },
226
- "object",
227
- { newlinesBetween: "always" },
228
- "side-effect",
229
- { newlinesBetween: "always" },
230
- "unknown"
231
- ];
232
- var SORT_UNION_OR_INTERSECTION_GROUPS = [
233
- "named",
234
- "keyword",
235
- "operator",
236
- "literal",
237
- "function",
238
- "import",
239
- "conditional",
240
- "object",
241
- "tuple",
242
- "intersection",
243
- "union",
244
- "nullish",
245
- "unknown"
246
- ];
247
-
248
- // src/configs/base.ts
249
- var IS_IN_EDITOR = isInEditorEnv();
250
- var base_default = tseslint2.config(
251
- {
252
- name: "fabdeh/base/ignores",
253
- ignores: GLOB_EXCLUDE
254
- },
255
- {
256
- name: "fabdeh/base/setup",
257
- files: [GLOB_SRC],
258
- plugins: {
259
- "@eslint-community/eslint-comments": eslintComments,
260
- "@typescript-eslint": tseslint2.plugin,
261
- "import-x": importX,
262
- jsdoc,
263
- perfectionist,
264
- "prefer-arrow-functions": preferArrowFunctions,
265
- "@stylistic": stylistic,
266
- unicorn,
267
- "unused-imports": unusedImports
268
- },
269
- languageOptions: {
270
- ecmaVersion: 2022,
271
- globals: {
272
- ...globals.browser,
273
- ...globals.es2021,
274
- ...globals.node,
275
- document: "readonly",
276
- navigator: "readonly",
277
- window: "readonly"
278
- },
279
- parser: tseslint2.parser,
280
- parserOptions: {
281
- ecmaFeatures: {
282
- jsx: true
283
- },
284
- ecmaVersion: 2022,
285
- sourceType: "module"
286
- },
287
- sourceType: "module"
288
- },
289
- linterOptions: {
290
- reportUnusedDisableDirectives: "error"
291
- }
292
- },
293
- {
294
- name: "fabdeh/base/common-rules",
295
- files: [GLOB_SRC],
296
- extends: [stylistic.configs["recommended-flat"]],
297
- rules: {
298
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
299
- "@eslint-community/eslint-comments/no-aggregating-enable": "error",
300
- "@eslint-community/eslint-comments/no-duplicate-disable": "error",
301
- "@eslint-community/eslint-comments/no-unlimited-disable": "error",
302
- "@eslint-community/eslint-comments/no-unused-disable": "error",
303
- "@eslint-community/eslint-comments/no-unused-enable": "error",
304
- "@stylistic/no-extra-semi": "error",
305
- "@typescript-eslint/no-empty-function": "error",
306
- "@typescript-eslint/no-invalid-this": "error",
307
- "@typescript-eslint/no-redeclare": "error",
308
- "@typescript-eslint/no-restricted-imports": ["error", "rxjs/Rx"],
309
- "@typescript-eslint/no-shadow": ["error", { hoist: "all" }],
310
- "@typescript-eslint/no-unused-expressions": "error",
311
- "@typescript-eslint/no-use-before-define": "error",
312
- "@typescript-eslint/no-useless-constructor": "error",
313
- "accessor-pairs": "error",
314
- "array-callback-return": "error",
315
- "block-scoped-var": "error",
316
- "default-case-last": "error",
317
- "dot-notation": "error",
318
- eqeqeq: "error",
319
- "id-denylist": [
320
- "error",
321
- "any",
322
- "Number",
323
- "number",
324
- "String",
325
- "string",
326
- "Boolean",
327
- "boolean",
328
- "Undefined",
329
- "undefined"
330
- ],
331
- "new-cap": [
332
- "error",
333
- {
334
- capIsNewExceptions: [
335
- "Attribute",
336
- "Component",
337
- "ContentChild",
338
- "ContentChildren",
339
- "Directive",
340
- "Host",
341
- "HostBinding",
342
- "HostListener",
343
- "Inject",
344
- "Injectable",
345
- "Input",
346
- "NgModule",
347
- "Optional",
348
- "Output",
349
- "Pipe",
350
- "Self",
351
- "SkipSelf",
352
- "ViewChild",
353
- "ViewChildren"
354
- ]
355
- }
356
- ],
357
- "no-alert": "error",
358
- "no-array-constructor": "error",
359
- "no-caller": "error",
360
- "no-cond-assign": ["error", "always"],
361
- "no-console": ["error", { allow: ["warn", "error"] }],
362
- "no-empty": ["error", { allowEmptyCatch: true }],
363
- "no-eval": "error",
364
- "no-extend-native": "error",
365
- "no-extra-bind": "error",
366
- "no-implied-eval": "error",
367
- "no-iterator": "error",
368
- "no-labels": "error",
369
- "no-lone-blocks": "error",
370
- "no-lonely-if": "error",
371
- "no-multi-str": "error",
372
- "no-new": "error",
373
- "no-new-func": "error",
374
- "no-new-wrappers": "error",
375
- "no-octal-escape": "error",
376
- "no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
377
- "no-proto": "error",
378
- "no-restricted-syntax": ["error", "TSEnumDeclaration[const=true]", "TSExportAssignment", "ForInStatement"],
379
- "no-self-compare": "error",
380
- "no-sequences": "error",
381
- "no-template-curly-in-string": "error",
382
- "no-throw-literal": "error",
383
- "no-undef": "error",
384
- "no-undef-init": "error",
385
- "no-unmodified-loop-condition": "error",
386
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
387
- "no-unreachable-loop": "error",
388
- "no-unused-expressions": [
389
- "error",
390
- {
391
- allowShortCircuit: true,
392
- allowTaggedTemplates: true,
393
- allowTernary: true
394
- }
395
- ],
396
- "no-unused-vars": "off",
397
- "no-use-before-define": ["error", { classes: false, functions: false }],
398
- "no-useless-call": "error",
399
- "no-useless-computed-key": "error",
400
- "no-useless-constructor": "error",
401
- "no-useless-rename": "error",
402
- "no-useless-return": "error",
403
- "no-var": "error",
404
- "object-shorthand": [
405
- "error",
406
- "always",
407
- {
408
- avoidQuotes: true,
409
- ignoreConstructors: false
410
- }
411
- ],
412
- "prefer-arrow-callback": "error",
413
- "prefer-arrow-functions/prefer-arrow-functions": ["error", { singleReturnOnly: true, allowNamedFunctions: true }],
414
- "prefer-exponentiation-operator": "error",
415
- "prefer-object-spread": "error",
416
- "prefer-promise-reject-errors": "error",
417
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
418
- "prefer-rest-params": "error",
419
- "prefer-spread": "error",
420
- "prefer-template": "error",
421
- "symbol-description": "error",
422
- "unicode-bom": ["error", "never"],
423
- "unused-imports/no-unused-imports": IS_IN_EDITOR ? "off" : "error",
424
- "unused-imports/no-unused-vars": [
425
- "error",
426
- {
427
- args: "after-used",
428
- argsIgnorePattern: "^_",
429
- ignoreRestSiblings: true,
430
- vars: "all",
431
- varsIgnorePattern: "^_"
432
- }
433
- ],
434
- "use-isnan": ["error", { enforceForIndexOf: true }],
435
- "valid-typeof": ["error", { requireStringLiterals: true }],
436
- "vars-on-top": "error",
437
- yoda: ["error", "never", { exceptRange: true }],
438
- "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
439
- "import-x/default": "error",
440
- "import-x/export": "error",
441
- "import-x/first": "error",
442
- "import-x/newline-after-import": ["error", { considerComments: true }],
443
- "import-x/no-absolute-path": "error",
444
- "import-x/no-duplicates": "error",
445
- "import-x/no-empty-named-blocks": "error",
446
- "import-x/no-extraneous-dependencies": "error",
447
- "import-x/no-mutable-exports": "error",
448
- "import-x/no-named-as-default": "warn",
449
- "import-x/no-named-as-default-member": "warn",
450
- "import-x/no-named-default": "error",
451
- "import-x/no-self-import": "error",
452
- "import-x/no-useless-path-segments": "error",
453
- "import-x/no-webpack-loader-syntax": "error",
454
- "perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
455
- "perfectionist/sort-imports": [
456
- "error",
457
- {
458
- groups: SORT_IMPORT_GROUPS,
459
- tsconfigRootDir: process.cwd(),
460
- order: "asc",
461
- type: "natural"
462
- }
463
- ],
464
- "perfectionist/sort-intersection-types": [
465
- "error",
466
- {
467
- groups: SORT_UNION_OR_INTERSECTION_GROUPS,
468
- order: "asc",
469
- type: "natural"
470
- }
471
- ],
472
- "perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
473
- "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }],
474
- "perfectionist/sort-switch-case": ["error", { order: "asc", type: "natural" }],
475
- "perfectionist/sort-union-types": [
476
- "error",
477
- {
478
- groups: SORT_UNION_OR_INTERSECTION_GROUPS,
479
- order: "asc",
480
- type: "natural"
481
- }
482
- ],
483
- "unicorn/catch-error-name": "error",
484
- "unicorn/consistent-empty-array-spread": "error",
485
- "unicorn/consistent-existence-index-check": "error",
486
- "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
487
- "unicorn/custom-error-definition": "error",
488
- "unicorn/error-message": "error",
489
- "unicorn/escape-case": "error",
490
- "unicorn/explicit-length-check": "error",
491
- "unicorn/filename-case": ["error", { case: "kebabCase" }],
492
- "unicorn/new-for-builtins": "error",
493
- "unicorn/no-abusive-eslint-disable": "error",
494
- "unicorn/no-anonymous-default-export": "error",
495
- "unicorn/no-array-for-each": "error",
496
- "unicorn/no-array-method-this-argument": "error",
497
- "unicorn/no-array-push-push": "error",
498
- "unicorn/no-array-reduce": "error",
499
- "unicorn/no-await-expression-member": "error",
500
- "unicorn/no-await-in-promise-methods": "error",
501
- "unicorn/no-document-cookie": "error",
502
- "unicorn/no-empty-file": "error",
503
- "unicorn/no-for-loop": "error",
504
- "unicorn/no-hex-escape": "error",
505
- "unicorn/no-instanceof-array": "error",
506
- "unicorn/no-invalid-fetch-options": "error",
507
- "unicorn/no-invalid-remove-event-listener": "error",
508
- "unicorn/no-length-as-slice-end": "error",
509
- "unicorn/no-lonely-if": "error",
510
- "unicorn/no-magic-array-flat-depth": "error",
511
- "unicorn/no-negated-condition": "error",
512
- "unicorn/no-negation-in-equality-check": "error",
513
- "unicorn/no-new-array": "error",
514
- "unicorn/no-new-buffer": "error",
515
- "unicorn/no-null": "error",
516
- "unicorn/no-process-exit": "error",
517
- "unicorn/no-single-promise-in-promise-methods": "error",
518
- "unicorn/no-thenable": "error",
519
- "unicorn/no-this-assignment": "error",
520
- "unicorn/no-typeof-undefined": "error",
521
- "unicorn/no-unnecessary-await": "error",
522
- "unicorn/no-unused-properties": "warn",
523
- "unicorn/no-useless-fallback-in-spread": "error",
524
- "unicorn/no-useless-length-check": "error",
525
- "unicorn/no-useless-promise-resolve-reject": "error",
526
- "unicorn/no-useless-spread": "error",
527
- "unicorn/no-useless-switch-case": "error",
528
- "unicorn/no-zero-fractions": "error",
529
- "unicorn/number-literal-case": "error",
530
- "unicorn/numeric-separators-style": "error",
531
- "unicorn/prefer-array-find": "error",
532
- "unicorn/prefer-array-flat": "error",
533
- "unicorn/prefer-array-flat-map": "error",
534
- "unicorn/prefer-array-index-of": "error",
535
- "unicorn/prefer-array-some": "error",
536
- "unicorn/prefer-at": "error",
537
- "unicorn/prefer-blob-reading-methods": "error",
538
- "unicorn/prefer-code-point": "error",
539
- "unicorn/prefer-date-now": "error",
540
- "unicorn/prefer-default-parameters": "error",
541
- "unicorn/prefer-export-from": "error",
542
- "unicorn/prefer-includes": "error",
543
- "unicorn/prefer-keyboard-event-key": "error",
544
- "unicorn/prefer-logical-operator-over-ternary": "error",
545
- "unicorn/prefer-math-min-max": "error",
546
- "unicorn/prefer-math-trunc": "error",
547
- "unicorn/prefer-modern-math-apis": "error",
548
- "unicorn/prefer-negative-index": "error",
549
- "unicorn/prefer-node-protocol": "error",
550
- "unicorn/prefer-number-properties": "error",
551
- "unicorn/prefer-object-from-entries": "error",
552
- "unicorn/prefer-optional-catch-binding": "error",
553
- "unicorn/prefer-query-selector": "error",
554
- "unicorn/prefer-regexp-test": "error",
555
- "unicorn/prefer-set-has": "error",
556
- "unicorn/prefer-set-size": "error",
557
- "unicorn/prefer-spread": "error",
558
- "unicorn/prefer-string-raw": "error",
559
- "unicorn/prefer-string-replace-all": "error",
560
- "unicorn/prefer-string-slice": "error",
561
- "unicorn/prefer-string-starts-ends-with": "error",
562
- "unicorn/prefer-string-trim-start-end": "error",
563
- "unicorn/prefer-structured-clone": "error",
564
- "unicorn/prefer-switch": "error",
565
- "unicorn/prefer-ternary": "error",
566
- "unicorn/prefer-type-error": "error",
567
- "unicorn/require-array-join-separator": "error",
568
- "unicorn/require-number-to-fixed-digits-argument": "error",
569
- "unicorn/require-post-message-target-origin": "error",
570
- "unicorn/throw-new-error": "error"
571
- }
572
- },
573
- {
574
- name: "fabdeh/base/javascript-rules",
575
- files: [GLOB_JS],
576
- extends: [nx2.configs["flat/javascript"], jsdoc.configs["flat/recommended"]],
577
- rules: {
578
- "@typescript-eslint/no-empty-interface": "off",
579
- // deprecated but included in nx
580
- "importx-/named": "error",
581
- "import-x/no-deprecated": "error"
582
- }
583
- },
584
- {
585
- name: "fabdeh/base/typescript-rules",
586
- files: [GLOB_TS],
587
- extends: [
588
- tseslint2.configs.strictTypeChecked,
589
- tseslint2.configs.stylisticTypeChecked,
590
- nx2.configs["flat/typescript"],
591
- jsdoc.configs["flat/recommended-typescript"]
592
- ],
593
- rules: {
594
- "@typescript-eslint/array-type": ["error", { default: "array" }],
595
- "@typescript-eslint/consistent-indexed-object-style": "error",
596
- "@typescript-eslint/consistent-type-assertions": [
597
- "error",
598
- { assertionStyle: "as", objectLiteralTypeAssertions: "never" }
599
- ],
600
- "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
601
- "@typescript-eslint/dot-notation": "error",
602
- "@typescript-eslint/explicit-function-return-type": [
603
- "error",
604
- {
605
- allowExpressions: true,
606
- allowTypedFunctionExpressions: true,
607
- allowHigherOrderFunctions: true,
608
- allowDirectConstAssertionInArrowFunctions: true,
609
- allowConciseArrowFunctionExpressionsStartingWithVoid: true
610
- }
611
- ],
612
- "@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public" }],
613
- "@typescript-eslint/member-ordering": ["error", member_ordering_default],
614
- "@typescript-eslint/method-signature-style": "error",
615
- "@typescript-eslint/naming-convention": ["error", ...naming_convention_default],
616
- "@typescript-eslint/no-base-to-string": "error",
617
- "@typescript-eslint/no-confusing-non-null-assertion": "error",
618
- "@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
619
- "@typescript-eslint/no-empty-interface": "off",
620
- // deprecated but included in nx
621
- "@typescript-eslint/no-extra-non-null-assertion": "error",
622
- "@typescript-eslint/no-extraneous-class": ["error", { allowStaticOnly: true, allowWithDecorator: true }],
623
- "@typescript-eslint/no-invalid-void-type": "error",
624
- "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
625
- "@typescript-eslint/no-require-imports": "error",
626
- "@typescript-eslint/only-throw-error": "error",
627
- "@typescript-eslint/no-unnecessary-condition": "error",
628
- "@typescript-eslint/no-unnecessary-type-arguments": "error",
629
- "@typescript-eslint/no-unsafe-unary-minus": "error",
630
- "@typescript-eslint/parameter-properties": ["error", { prefer: "parameter-property" }],
631
- "@typescript-eslint/prefer-enum-initializers": "error",
632
- "@typescript-eslint/prefer-for-of": "error",
633
- "@typescript-eslint/prefer-function-type": "error",
634
- "@typescript-eslint/prefer-includes": "error",
635
- "@typescript-eslint/prefer-literal-enum-member": "error",
636
- "@typescript-eslint/prefer-nullish-coalescing": "error",
637
- "@typescript-eslint/prefer-optional-chain": "error",
638
- "@typescript-eslint/prefer-readonly": "error",
639
- "@typescript-eslint/prefer-reduce-type-parameter": "error",
640
- "@typescript-eslint/prefer-return-this-type": "error",
641
- "@typescript-eslint/prefer-string-starts-ends-with": "error",
642
- "@typescript-eslint/require-array-sort-compare": "error",
643
- "@typescript-eslint/restrict-plus-operands": ["error", { skipCompoundAssignments: true }],
644
- "@typescript-eslint/restrict-template-expressions": "off",
645
- "@typescript-eslint/switch-exhaustiveness-check": "error",
646
- "@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
647
- "@typescript-eslint/unified-signatures": "error",
648
- "import-x/named": "off",
649
- "import-x/no-deprecated": "off"
650
- }
651
- }
652
- );
653
-
654
- // src/configs/jest.ts
655
- import jest from "eslint-plugin-jest";
656
- import jestDom from "eslint-plugin-jest-dom";
657
- import testingLibrary from "eslint-plugin-testing-library";
658
- import globals2 from "globals";
659
- import tseslint3 from "typescript-eslint";
660
- var jest_default = tseslint3.config({
661
- name: "fabdeh/jest/rules",
662
- plugins: {
663
- jest
664
- },
665
- languageOptions: {
666
- globals: {
667
- ...globals2.node,
668
- ...globals2.jest
669
- }
670
- },
671
- files: [...GLOB_TESTS, `**/jest.config.${GLOB_SRC_EXT}`],
672
- extends: [
673
- jest.configs["flat/recommended"],
674
- jest.configs["flat/style"],
675
- jestDom.configs["flat/recommended"],
676
- testingLibrary.configs["flat/angular"]
677
- ],
678
- rules: {
679
- "max-classes-per-file": "off",
680
- "max-lines": "off",
681
- "@typescript-eslint/consistent-type-assertions": "off",
682
- "@typescript-eslint/no-empty-function": "off",
683
- "@typescript-eslint/no-unsafe-assignment": "off",
684
- "@typescript-eslint/no-unsafe-call": "off",
685
- "@typescript-eslint/no-unsafe-member-access": "off",
686
- "@typescript-eslint/unbound-method": "off",
687
- "jest/consistent-test-it": ["error", { fn: "test" }],
688
- "jest/prefer-spy-on": "error",
689
- "jest/require-top-level-describe": "error",
690
- "jest/unbound-method": "error",
691
- "unicorn/no-null": "off"
692
- }
693
- });
694
-
695
- // src/configs/ngrx/index.ts
696
- var ngrx_exports = {};
697
- __export(ngrx_exports, {
698
- effects: () => effects_default,
699
- signals: () => signals_default,
700
- store: () => store_default
701
- });
702
-
703
- // src/configs/ngrx/effects.ts
704
- import ngrx from "@ngrx/eslint-plugin/v9";
705
- import tseslint4 from "typescript-eslint";
706
- var effects_default = tseslint4.config({
707
- name: "fabdeh/ngrx-effects/rules",
708
- files: [`**/*.effects.${GLOB_TS_EXT}`],
709
- extends: [ngrx.configs.effects, ngrx.configs.operators],
710
- rules: {
711
- "@typescript-eslint/naming-convention": [
712
- "error",
713
- ...naming_convention_default,
714
- {
715
- selector: "variable",
716
- modifiers: ["const", "global", "exported"],
717
- format: ["camelCase"],
718
- leadingUnderscore: "forbid",
719
- trailingUnderscore: "forbid",
720
- suffix: ["$"]
721
- }
722
- ]
723
- }
724
- });
725
-
726
- // src/configs/ngrx/signals.ts
727
- import ngrx2 from "@ngrx/eslint-plugin/v9";
728
- import tseslint5 from "typescript-eslint";
729
- function allowLeadingUnderscoreOnMemberLike(conventions) {
730
- return [
731
- ...conventions.filter((c) => !Array.isArray(c.selector)),
732
- { selector: "variableLike", format: ["camelCase"] },
733
- { selector: "memberLike", format: ["camelCase"], leadingUnderscore: "allow" }
734
- ];
735
- }
736
- var signals_default = tseslint5.config({
737
- name: "fabdeh/ngrx-signals/rules",
738
- files: [`**/*.store.${GLOB_TS_EXT}`],
739
- extends: [ngrx2.configs.signals, ngrx2.configs.operators],
740
- rules: {
741
- "@typescript-eslint/naming-convention": [
742
- "error",
743
- ...allowLeadingUnderscoreOnMemberLike(naming_convention_default),
744
- {
745
- selector: "variable",
746
- modifiers: ["const", "global", "exported"],
747
- format: ["PascalCase"],
748
- leadingUnderscore: "forbid",
749
- trailingUnderscore: "forbid"
750
- }
751
- ]
752
- }
753
- });
754
-
755
- // src/configs/ngrx/store.ts
756
- import ngrx3 from "@ngrx/eslint-plugin/v9";
757
- import tseslint6 from "typescript-eslint";
758
- var store_default = tseslint6.config({
759
- name: "fabdeh/ngrx-store/rules",
760
- files: [
761
- `**/*.actions.${GLOB_TS_EXT}`,
762
- `**/*.feature.${GLOB_TS_EXT}`,
763
- `**/*.reducer.${GLOB_TS_EXT}`,
764
- `**/*.state.${GLOB_TS_EXT}`
765
- ],
766
- extends: [ngrx3.configs.store, ngrx3.configs.operators],
767
- rules: {
768
- "@typescript-eslint/naming-convention": [
769
- "error",
770
- ...naming_convention_default,
771
- {
772
- selector: ["objectLiteralProperty"],
773
- // eslint-disable-next-line unicorn/no-null
774
- format: null,
775
- custom: {
776
- regex: String.raw`^(?:(?:[a-z]+(?:[A-Z][a-z]*)*)|[A-Z][a-z]*(?:\s[A-Z][a-z]*)*)$`,
777
- match: true
778
- }
779
- },
780
- {
781
- selector: "variable",
782
- modifiers: ["const", "global", "exported"],
783
- format: ["camelCase", "PascalCase"],
784
- leadingUnderscore: "forbid",
785
- trailingUnderscore: "forbid"
786
- }
787
- ]
788
- }
789
- });
790
-
791
- // src/configs/tailwindcss.ts
792
- import tailwindcss from "eslint-plugin-tailwindcss";
793
- import tseslint7 from "typescript-eslint";
794
- var tailwindcss_default = tseslint7.config({
795
- name: "fabdeh/tailwindcss/rules",
796
- plugins: {
797
- tailwindcss
798
- },
799
- files: [GLOB_SRC, GLOB_HTML],
800
- rules: {
801
- "tailwindcss/classnames-order": "error",
802
- // replace by prettier plugin ???
803
- "tailwindcss/enforces-negative-arbitrary-values": "error",
804
- "tailwindcss/enforces-shorthand": "error",
805
- "tailwindcss/no-contradicting-classname": "error",
806
- "tailwindcss/no-unnecessary-arbitrary-value": "error"
807
- }
808
- });
809
-
810
- // src/configs/vitest.ts
811
- import vitest from "@vitest/eslint-plugin";
812
- import jestDom2 from "eslint-plugin-jest-dom";
813
- import testingLibrary2 from "eslint-plugin-testing-library";
814
- import globals3 from "globals";
815
- import tseslint8 from "typescript-eslint";
816
- var vitest_default = tseslint8.config({
817
- name: "fabdeh/vitest/rules",
818
- plugins: {
819
- vitest
820
- },
821
- languageOptions: {
822
- globals: {
823
- ...globals3.node,
824
- ...globals3.vitest,
825
- ...vitest.environments.env.globals
826
- }
827
- },
828
- settings: {
829
- vitest: {
830
- typecheck: true
831
- }
832
- },
833
- files: [...GLOB_TESTS],
834
- extends: [vitest.configs.recommended, jestDom2.configs["flat/recommended"], testingLibrary2.configs["flat/angular"]],
835
- rules: {
836
- "max-classes-per-file": "off",
837
- "max-lines": "off",
838
- "@typescript-eslint/consistent-type-assertions": "off",
839
- "@typescript-eslint/no-empty-function": "off",
840
- "@typescript-eslint/no-unsafe-assignment": "off",
841
- "@typescript-eslint/no-unsafe-call": "off",
842
- "@typescript-eslint/no-unsafe-member-access": "off",
843
- "@typescript-eslint/unbound-method": "off",
844
- "unicorn/no-null": "off",
845
- "vitest/consistent-test-it": ["error", { fn: "test" }],
846
- "vitest/no-standalone-expect": "error",
847
- "vitest/no-test-return-statement": "error",
848
- "vitest/prefer-hooks-in-order": "error",
849
- "vitest/prefer-hooks-on-top": "error",
850
- "vitest/prefer-lowercase-title": "error",
851
- "vitest/prefer-spy-on": "error",
852
- "vitest/prefer-to-be": "error",
853
- "vitest/prefer-to-be-falsy": "error",
854
- "vitest/prefer-to-be-object": "error",
855
- "vitest/prefer-to-be-truthy": "error",
856
- "vitest/prefer-to-contain": "error",
857
- "vitest/prefer-to-have-length": "error",
858
- "vitest/prefer-todo": "error",
859
- "vitest/prefer-vi-mocked": "error",
860
- "vitest/require-top-level-describe": "error"
861
- }
862
- });
863
-
864
- // src/index.ts
865
- var DEFAULT = { configs: configs_exports };
866
- var index_default = DEFAULT;
867
- export {
868
- GLOB_EXCLUDE,
869
- GLOB_HTML,
870
- GLOB_JS,
871
- GLOB_SRC,
872
- GLOB_SRC_EXT,
873
- GLOB_TESTS,
874
- GLOB_TS,
875
- GLOB_TS_EXT,
876
- dedupeTsBaseConfig,
877
- index_default as default,
878
- ensureCorrectFiles,
879
- isInEditorEnv
880
- };