@fabdeh/eslint-config 0.0.2 → 0.0.3

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.cjs CHANGED
@@ -30,10 +30,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- default: () => index_default
33
+ GLOB_EXCLUDE: () => GLOB_EXCLUDE,
34
+ GLOB_HTML: () => GLOB_HTML,
35
+ GLOB_JS: () => GLOB_JS,
36
+ GLOB_SRC: () => GLOB_SRC,
37
+ GLOB_SRC_EXT: () => GLOB_SRC_EXT,
38
+ GLOB_TESTS: () => GLOB_TESTS,
39
+ GLOB_TS: () => GLOB_TS,
40
+ GLOB_TS_EXT: () => GLOB_TS_EXT,
41
+ dedupeTsBaseConfig: () => dedupeTsBaseConfig,
42
+ default: () => index_default,
43
+ ensureCorrectFiles: () => ensureCorrectFiles,
44
+ isInEditorEnv: () => isInEditorEnv
34
45
  });
35
46
  module.exports = __toCommonJS(index_exports);
36
47
 
48
+ // src/configs/index.ts
49
+ var configs_exports = {};
50
+ __export(configs_exports, {
51
+ angular: () => angular_default,
52
+ base: () => base_default,
53
+ jest: () => jest_default,
54
+ ngrx: () => ngrx_exports,
55
+ tailwindcss: () => tailwindcss_default,
56
+ vitest: () => vitest_default
57
+ });
58
+
37
59
  // src/configs/angular.ts
38
60
  var import_eslint_plugin = __toESM(require("@nx/eslint-plugin"), 1);
39
61
  var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
@@ -142,7 +164,6 @@ var angular_default = import_typescript_eslint.default.config(
142
164
  );
143
165
 
144
166
  // src/configs/base.ts
145
- var import_node_process = __toESM(require("process"), 1);
146
167
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
147
168
  var import_eslint_plugin2 = __toESM(require("@nx/eslint-plugin"), 1);
148
169
  var import_eslint_plugin3 = __toESM(require("@stylistic/eslint-plugin"), 1);
@@ -171,6 +192,20 @@ function isInEditorEnv() {
171
192
  const isNeoVim = envKeys.some((k) => /^NVIM$/i.test(k));
172
193
  return isVsCode || isIntelliJ || isJetbrains || isVim || isNeoVim;
173
194
  }
195
+ function dedupeTsBaseConfig(...configs) {
196
+ return configs.filter((c) => !c.name || c.name !== "typescript-eslint/base");
197
+ }
198
+ function ensureCorrectFiles(files) {
199
+ return (config) => {
200
+ if ("rules" in config && !("files" in config)) {
201
+ return {
202
+ ...config,
203
+ files
204
+ };
205
+ }
206
+ return config;
207
+ };
208
+ }
174
209
 
175
210
  // src/configs/rules-configs/member-ordering.ts
176
211
  var member_ordering_default = {
@@ -334,7 +369,32 @@ var base_default = import_typescript_eslint2.default.config(
334
369
  "Undefined",
335
370
  "undefined"
336
371
  ],
337
- "new-cap": "error",
372
+ "new-cap": [
373
+ "error",
374
+ {
375
+ capIsNewExceptions: [
376
+ "Attribute",
377
+ "Component",
378
+ "ContentChild",
379
+ "ContentChildren",
380
+ "Directive",
381
+ "Host",
382
+ "HostBinding",
383
+ "HostListener",
384
+ "Inject",
385
+ "Injectable",
386
+ "Input",
387
+ "NgModule",
388
+ "Optional",
389
+ "Output",
390
+ "Pipe",
391
+ "Self",
392
+ "SkipSelf",
393
+ "ViewChild",
394
+ "ViewChildren"
395
+ ]
396
+ }
397
+ ],
338
398
  "no-alert": "error",
339
399
  "no-array-constructor": "error",
340
400
  "no-caller": "error",
@@ -422,7 +482,6 @@ var base_default = import_typescript_eslint2.default.config(
422
482
  "import-x/first": "error",
423
483
  "import-x/newline-after-import": ["error", { considerComments: true }],
424
484
  "import-x/no-absolute-path": "error",
425
- "import-x/no-deprecated": "warn",
426
485
  "import-x/no-duplicates": "error",
427
486
  "import-x/no-empty-named-blocks": "error",
428
487
  "import-x/no-extraneous-dependencies": "error",
@@ -438,7 +497,7 @@ var base_default = import_typescript_eslint2.default.config(
438
497
  "error",
439
498
  {
440
499
  groups: SORT_IMPORT_GROUPS,
441
- tsconfigRootDir: import_node_process.default.cwd(),
500
+ tsconfigRootDir: process.cwd(),
442
501
  order: "asc",
443
502
  type: "natural"
444
503
  }
@@ -559,7 +618,8 @@ var base_default = import_typescript_eslint2.default.config(
559
618
  rules: {
560
619
  "@typescript-eslint/no-empty-interface": "off",
561
620
  // deprecated but included in nx
562
- "importx-/named": "error"
621
+ "importx-/named": "error",
622
+ "import-x/no-deprecated": "error"
563
623
  }
564
624
  },
565
625
  {
@@ -626,7 +686,8 @@ var base_default = import_typescript_eslint2.default.config(
626
686
  "@typescript-eslint/switch-exhaustiveness-check": "error",
627
687
  "@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
628
688
  "@typescript-eslint/unified-signatures": "error",
629
- "import-x/named": "off"
689
+ "import-x/named": "off",
690
+ "import-x/no-deprecated": "off"
630
691
  }
631
692
  }
632
693
  );
@@ -648,7 +709,7 @@ var jest_default = import_typescript_eslint3.default.config({
648
709
  ...import_globals2.default.jest
649
710
  }
650
711
  },
651
- files: [GLOB_TESTS, `**/jest.config.${GLOB_SRC_EXT}`],
712
+ files: [...GLOB_TESTS, `**/jest.config.${GLOB_SRC_EXT}`],
652
713
  extends: [
653
714
  import_eslint_plugin_jest.default.configs["flat/recommended"],
654
715
  import_eslint_plugin_jest.default.configs["flat/style"],
@@ -810,7 +871,7 @@ var vitest_default = import_typescript_eslint8.default.config({
810
871
  typecheck: true
811
872
  }
812
873
  },
813
- files: [GLOB_TESTS],
874
+ files: [...GLOB_TESTS],
814
875
  extends: [import_eslint_plugin4.default.configs.recommended, import_eslint_plugin_jest_dom2.default.configs["flat/recommended"], import_eslint_plugin_testing_library2.default.configs["flat/angular"]],
815
876
  rules: {
816
877
  "max-classes-per-file": "off",
@@ -842,20 +903,19 @@ var vitest_default = import_typescript_eslint8.default.config({
842
903
  });
843
904
 
844
905
  // src/index.ts
845
- var index_default = {
846
- configs: {
847
- angular: angular_default,
848
- base: base_default,
849
- jest: jest_default,
850
- ngrx: ngrx_exports,
851
- tailwindcss: tailwindcss_default,
852
- vitest: vitest_default
853
- }
854
- };
855
-
856
- // fix-cjs-exports
857
- if (module.exports.default) {
858
- Object.assign(module.exports.default, module.exports);
859
- module.exports = module.exports.default;
860
- delete module.exports.default;
861
- }
906
+ var DEFAULT = { configs: configs_exports };
907
+ var index_default = DEFAULT;
908
+ // Annotate the CommonJS export names for ESM import in node:
909
+ 0 && (module.exports = {
910
+ GLOB_EXCLUDE,
911
+ GLOB_HTML,
912
+ GLOB_JS,
913
+ GLOB_SRC,
914
+ GLOB_SRC_EXT,
915
+ GLOB_TESTS,
916
+ GLOB_TS,
917
+ GLOB_TS_EXT,
918
+ dedupeTsBaseConfig,
919
+ ensureCorrectFiles,
920
+ isInEditorEnv
921
+ });
package/dist/index.d.cts CHANGED
@@ -1,25 +1,60 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
+ import { TSESLint } from '@typescript-eslint/utils';
3
+ import { ConfigWithExtends } from 'typescript-eslint';
4
+
5
+ declare const _default$7: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
6
+
7
+ declare const _default$6: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
8
+
9
+ declare const _default$5: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
10
+
11
+ declare const _default$4: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
2
12
 
3
13
  declare const _default$3: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
4
14
 
5
15
  declare const _default$2: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
6
16
 
17
+ declare namespace index {
18
+ export { _default$4 as effects, _default$3 as signals, _default$2 as store };
19
+ }
20
+
7
21
  declare const _default$1: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
8
22
 
9
- declare namespace ngrx {
10
- export { _default$3 as effects, _default$2 as signals, _default$1 as store };
23
+ declare const _default: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
24
+
25
+ declare namespace configs {
26
+ export { _default$7 as angular, _default$6 as base, _default$5 as jest, index as ngrx, _default$1 as tailwindcss, _default as vitest };
11
27
  }
12
28
 
13
- declare const _default: {
14
- configs: {
15
- angular: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
16
- base: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
17
- jest: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
18
- ngrx: typeof ngrx;
19
- tailwindcss: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
20
- vitest: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
21
- };
29
+ declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
30
+ declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
31
+ declare const GLOB_JS = "**/*.?([cm])js?(x)";
32
+ declare const GLOB_TS_EXT = "?([cm])ts?(x)";
33
+ declare const GLOB_TS = "**/*.?([cm])ts?(x)";
34
+ declare const GLOB_HTML = "**/*.htm?(l)";
35
+ declare const GLOB_TESTS: string[];
36
+ declare const GLOB_EXCLUDE: string[];
37
+
38
+ /**
39
+ * Detect if the program is running inside an editor environment.
40
+ * @returns `true` if the program is running inside an editor environment; `false` otherwise.
41
+ */
42
+ declare function isInEditorEnv(): boolean;
43
+ /**
44
+ * Dedupe the base TS ESLint config.
45
+ * @param configs The list of configs.
46
+ * @returns The filtered configs.
47
+ */
48
+ declare function dedupeTsBaseConfig(...configs: ConfigWithExtends[]): TSESLint.FlatConfig.ConfigArray;
49
+ /**
50
+ * Ensures that the "files" property is correctly set.
51
+ * @param files The files property value to use.
52
+ * @returns A function that takes the configuration and fix it.
53
+ */
54
+ declare function ensureCorrectFiles<T extends object>(files: string[]): (config: T) => T;
55
+
56
+ declare const DEFAULT: {
57
+ configs: typeof configs;
22
58
  };
23
59
 
24
- export { _default as default };
25
- export = _default
60
+ export { GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TS_EXT, dedupeTsBaseConfig, DEFAULT as default, ensureCorrectFiles, isInEditorEnv };
package/dist/index.d.ts CHANGED
@@ -1,25 +1,60 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
+ import { TSESLint } from '@typescript-eslint/utils';
3
+ import { ConfigWithExtends } from 'typescript-eslint';
4
+
5
+ declare const _default$7: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
6
+
7
+ declare const _default$6: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
8
+
9
+ declare const _default$5: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
10
+
11
+ declare const _default$4: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
2
12
 
3
13
  declare const _default$3: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
4
14
 
5
15
  declare const _default$2: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
6
16
 
17
+ declare namespace index {
18
+ export { _default$4 as effects, _default$3 as signals, _default$2 as store };
19
+ }
20
+
7
21
  declare const _default$1: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
8
22
 
9
- declare namespace ngrx {
10
- export { _default$3 as effects, _default$2 as signals, _default$1 as store };
23
+ declare const _default: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
24
+
25
+ declare namespace configs {
26
+ export { _default$7 as angular, _default$6 as base, _default$5 as jest, index as ngrx, _default$1 as tailwindcss, _default as vitest };
11
27
  }
12
28
 
13
- declare const _default: {
14
- configs: {
15
- angular: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
16
- base: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
17
- jest: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
18
- ngrx: typeof ngrx;
19
- tailwindcss: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
20
- vitest: _typescript_eslint_utils_ts_eslint.FlatConfig.ConfigArray;
21
- };
29
+ declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
30
+ declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
31
+ declare const GLOB_JS = "**/*.?([cm])js?(x)";
32
+ declare const GLOB_TS_EXT = "?([cm])ts?(x)";
33
+ declare const GLOB_TS = "**/*.?([cm])ts?(x)";
34
+ declare const GLOB_HTML = "**/*.htm?(l)";
35
+ declare const GLOB_TESTS: string[];
36
+ declare const GLOB_EXCLUDE: string[];
37
+
38
+ /**
39
+ * Detect if the program is running inside an editor environment.
40
+ * @returns `true` if the program is running inside an editor environment; `false` otherwise.
41
+ */
42
+ declare function isInEditorEnv(): boolean;
43
+ /**
44
+ * Dedupe the base TS ESLint config.
45
+ * @param configs The list of configs.
46
+ * @returns The filtered configs.
47
+ */
48
+ declare function dedupeTsBaseConfig(...configs: ConfigWithExtends[]): TSESLint.FlatConfig.ConfigArray;
49
+ /**
50
+ * Ensures that the "files" property is correctly set.
51
+ * @param files The files property value to use.
52
+ * @returns A function that takes the configuration and fix it.
53
+ */
54
+ declare function ensureCorrectFiles<T extends object>(files: string[]): (config: T) => T;
55
+
56
+ declare const DEFAULT: {
57
+ configs: typeof configs;
22
58
  };
23
59
 
24
- export { _default as default };
25
- export = _default
60
+ export { GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TS, GLOB_TS_EXT, dedupeTsBaseConfig, DEFAULT as default, ensureCorrectFiles, isInEditorEnv };
package/dist/index.js CHANGED
@@ -4,6 +4,17 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
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
+
7
18
  // src/configs/angular.ts
8
19
  import nx from "@nx/eslint-plugin";
9
20
  import tseslint from "typescript-eslint";
@@ -112,7 +123,6 @@ var angular_default = tseslint.config(
112
123
  );
113
124
 
114
125
  // src/configs/base.ts
115
- import process2 from "node:process";
116
126
  import eslintComments from "@eslint-community/eslint-plugin-eslint-comments";
117
127
  import nx2 from "@nx/eslint-plugin";
118
128
  import stylistic from "@stylistic/eslint-plugin";
@@ -141,6 +151,20 @@ function isInEditorEnv() {
141
151
  const isNeoVim = envKeys.some((k) => /^NVIM$/i.test(k));
142
152
  return isVsCode || isIntelliJ || isJetbrains || isVim || isNeoVim;
143
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
+ }
144
168
 
145
169
  // src/configs/rules-configs/member-ordering.ts
146
170
  var member_ordering_default = {
@@ -304,7 +328,32 @@ var base_default = tseslint2.config(
304
328
  "Undefined",
305
329
  "undefined"
306
330
  ],
307
- "new-cap": "error",
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
+ ],
308
357
  "no-alert": "error",
309
358
  "no-array-constructor": "error",
310
359
  "no-caller": "error",
@@ -392,7 +441,6 @@ var base_default = tseslint2.config(
392
441
  "import-x/first": "error",
393
442
  "import-x/newline-after-import": ["error", { considerComments: true }],
394
443
  "import-x/no-absolute-path": "error",
395
- "import-x/no-deprecated": "warn",
396
444
  "import-x/no-duplicates": "error",
397
445
  "import-x/no-empty-named-blocks": "error",
398
446
  "import-x/no-extraneous-dependencies": "error",
@@ -408,7 +456,7 @@ var base_default = tseslint2.config(
408
456
  "error",
409
457
  {
410
458
  groups: SORT_IMPORT_GROUPS,
411
- tsconfigRootDir: process2.cwd(),
459
+ tsconfigRootDir: process.cwd(),
412
460
  order: "asc",
413
461
  type: "natural"
414
462
  }
@@ -529,7 +577,8 @@ var base_default = tseslint2.config(
529
577
  rules: {
530
578
  "@typescript-eslint/no-empty-interface": "off",
531
579
  // deprecated but included in nx
532
- "importx-/named": "error"
580
+ "importx-/named": "error",
581
+ "import-x/no-deprecated": "error"
533
582
  }
534
583
  },
535
584
  {
@@ -596,7 +645,8 @@ var base_default = tseslint2.config(
596
645
  "@typescript-eslint/switch-exhaustiveness-check": "error",
597
646
  "@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
598
647
  "@typescript-eslint/unified-signatures": "error",
599
- "import-x/named": "off"
648
+ "import-x/named": "off",
649
+ "import-x/no-deprecated": "off"
600
650
  }
601
651
  }
602
652
  );
@@ -618,7 +668,7 @@ var jest_default = tseslint3.config({
618
668
  ...globals2.jest
619
669
  }
620
670
  },
621
- files: [GLOB_TESTS, `**/jest.config.${GLOB_SRC_EXT}`],
671
+ files: [...GLOB_TESTS, `**/jest.config.${GLOB_SRC_EXT}`],
622
672
  extends: [
623
673
  jest.configs["flat/recommended"],
624
674
  jest.configs["flat/style"],
@@ -780,7 +830,7 @@ var vitest_default = tseslint8.config({
780
830
  typecheck: true
781
831
  }
782
832
  },
783
- files: [GLOB_TESTS],
833
+ files: [...GLOB_TESTS],
784
834
  extends: [vitest.configs.recommended, jestDom2.configs["flat/recommended"], testingLibrary2.configs["flat/angular"]],
785
835
  rules: {
786
836
  "max-classes-per-file": "off",
@@ -812,16 +862,19 @@ var vitest_default = tseslint8.config({
812
862
  });
813
863
 
814
864
  // src/index.ts
815
- var index_default = {
816
- configs: {
817
- angular: angular_default,
818
- base: base_default,
819
- jest: jest_default,
820
- ngrx: ngrx_exports,
821
- tailwindcss: tailwindcss_default,
822
- vitest: vitest_default
823
- }
824
- };
865
+ var DEFAULT = { configs: configs_exports };
866
+ var index_default = DEFAULT;
825
867
  export {
826
- index_default as default
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
827
880
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fabdeh/eslint-config",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "description": "My personal eslint config preset",
6
6
  "homepage": "https://github.com/FabienDehopre/eslint-config",
7
7
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  "dist"
36
36
  ],
37
37
  "scripts": {
38
- "build": "tsup && fix-tsup-cjs",
38
+ "build": "tsup",
39
39
  "build:inspector": "pnpm build && pnpm dlx @eslint/config-inspector build",
40
40
  "dev": "pnpm dlx @eslint/config-inspector --config eslint.config.ts",
41
41
  "preinstall": "npx only-allow pnpm",
@@ -105,6 +105,7 @@
105
105
  "@commitlint/config-conventional": "^19.6.0",
106
106
  "@commitlint/cz-commitlint": "^19.6.1",
107
107
  "@ngrx/eslint-plugin": "^19.0.0",
108
+ "@types/node": "^22.10.5",
108
109
  "@vitest/eslint-plugin": "^1.1.25",
109
110
  "bumpp": "^9.10.1",
110
111
  "commitizen": "^4.3.1",