@alextheman/eslint-plugin 5.13.1 → 5.14.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.cjs CHANGED
@@ -4489,6 +4489,20 @@ const typeScriptLanguageOptions = {
4489
4489
  }
4490
4490
  };
4491
4491
  //#endregion
4492
+ //#region src/configs/helpers/restrictedImports/personalRestrictedImports.ts
4493
+ const personalRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [...["fs", "node:fs"].map((name) => {
4494
+ return {
4495
+ message: "Please use node:fs/promises instead.",
4496
+ name
4497
+ };
4498
+ })] });
4499
+ //#endregion
4500
+ //#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
4501
+ const reactRestrictedImports = combineRestrictedImports(generalRestrictedImports, { patterns: [{
4502
+ message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
4503
+ regex: "^@mui/[^/]+$"
4504
+ }] });
4505
+ //#endregion
4492
4506
  //#region src/configs/helpers/sorting/sortClasses.ts
4493
4507
  const sortClasses = {
4494
4508
  customGroups: [],
@@ -4588,14 +4602,6 @@ const sortObjects = {
4588
4602
  useConfigurationIf: {}
4589
4603
  };
4590
4604
  //#endregion
4591
- //#region src/configs/helpers/restrictedImports/personalRestrictedImports.ts
4592
- const personalRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [...["fs", "node:fs"].map((name) => {
4593
- return {
4594
- message: "Please use node:fs/promises instead.",
4595
- name
4596
- };
4597
- })] });
4598
- //#endregion
4599
4605
  //#region src/configs/helpers/sorting/sortNamedImports.ts
4600
4606
  const sortNamedImports = {
4601
4607
  fallbackSort: { type: "unsorted" },
@@ -4712,12 +4718,6 @@ const generalReact = [
4712
4718
  }
4713
4719
  ];
4714
4720
  //#endregion
4715
- //#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
4716
- const reactRestrictedImports = combineRestrictedImports(generalRestrictedImports, { patterns: [{
4717
- message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
4718
- regex: "^@mui/[^/]+$"
4719
- }] });
4720
- //#endregion
4721
4721
  //#region src/configs/internal/react.ts
4722
4722
  const internalReact = [{
4723
4723
  languageOptions: reactLanguageOptions,
@@ -5225,7 +5225,7 @@ const consistentTestFunction = createRule({
5225
5225
  //#region src/rules/has-standards.ts
5226
5226
  const hasStandardsOptionsSchema = zod.default.object({ fixable: zod.default.boolean() }).partial();
5227
5227
  function parseHasStandardsOptions(input) {
5228
- return (0, _alextheman_utility.parseZodSchema)(hasStandardsOptionsSchema, input);
5228
+ return _alextheman_utility.az.with(hasStandardsOptionsSchema).parse(input);
5229
5229
  }
5230
5230
  const defaultOptions = { fixable: false };
5231
5231
  const targetValue = "I have standards, you'd better have some too!";
@@ -5509,7 +5509,7 @@ function parseUseObjectShorthandOptions(data) {
5509
5509
  const alexPlugin = {
5510
5510
  meta: {
5511
5511
  name: "@alextheman/eslint-plugin",
5512
- version: "5.13.1",
5512
+ version: "5.14.0",
5513
5513
  namespace: "alextheman"
5514
5514
  },
5515
5515
  configs: {},
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { camelToKebab, deepCopy, deepFreeze, normaliseIndents, omitProperties, parseZodSchema } from "@alextheman/utility";
1
+ import { az, camelToKebab, deepCopy, deepFreeze, normaliseIndents, omitProperties } from "@alextheman/utility";
2
2
  import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
3
3
  import z from "zod";
4
4
  import { DataError } from "@alextheman/utility/v6";
@@ -4470,6 +4470,20 @@ const typeScriptLanguageOptions = {
4470
4470
  }
4471
4471
  };
4472
4472
  //#endregion
4473
+ //#region src/configs/helpers/restrictedImports/personalRestrictedImports.ts
4474
+ const personalRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [...["fs", "node:fs"].map((name) => {
4475
+ return {
4476
+ message: "Please use node:fs/promises instead.",
4477
+ name
4478
+ };
4479
+ })] });
4480
+ //#endregion
4481
+ //#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
4482
+ const reactRestrictedImports = combineRestrictedImports(generalRestrictedImports, { patterns: [{
4483
+ message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
4484
+ regex: "^@mui/[^/]+$"
4485
+ }] });
4486
+ //#endregion
4473
4487
  //#region src/configs/helpers/sorting/sortClasses.ts
4474
4488
  const sortClasses = {
4475
4489
  customGroups: [],
@@ -4569,14 +4583,6 @@ const sortObjects = {
4569
4583
  useConfigurationIf: {}
4570
4584
  };
4571
4585
  //#endregion
4572
- //#region src/configs/helpers/restrictedImports/personalRestrictedImports.ts
4573
- const personalRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [...["fs", "node:fs"].map((name) => {
4574
- return {
4575
- message: "Please use node:fs/promises instead.",
4576
- name
4577
- };
4578
- })] });
4579
- //#endregion
4580
4586
  //#region src/configs/helpers/sorting/sortNamedImports.ts
4581
4587
  const sortNamedImports = {
4582
4588
  fallbackSort: { type: "unsorted" },
@@ -4693,12 +4699,6 @@ const generalReact = [
4693
4699
  }
4694
4700
  ];
4695
4701
  //#endregion
4696
- //#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
4697
- const reactRestrictedImports = combineRestrictedImports(generalRestrictedImports, { patterns: [{
4698
- message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
4699
- regex: "^@mui/[^/]+$"
4700
- }] });
4701
- //#endregion
4702
4702
  //#region src/configs/internal/react.ts
4703
4703
  const internalReact = [{
4704
4704
  languageOptions: reactLanguageOptions,
@@ -5206,7 +5206,7 @@ const consistentTestFunction = createRule({
5206
5206
  //#region src/rules/has-standards.ts
5207
5207
  const hasStandardsOptionsSchema = z.object({ fixable: z.boolean() }).partial();
5208
5208
  function parseHasStandardsOptions(input) {
5209
- return parseZodSchema(hasStandardsOptionsSchema, input);
5209
+ return az.with(hasStandardsOptionsSchema).parse(input);
5210
5210
  }
5211
5211
  const defaultOptions = { fixable: false };
5212
5212
  const targetValue = "I have standards, you'd better have some too!";
@@ -5490,7 +5490,7 @@ function parseUseObjectShorthandOptions(data) {
5490
5490
  const alexPlugin = {
5491
5491
  meta: {
5492
5492
  name: "@alextheman/eslint-plugin",
5493
- version: "5.13.1",
5493
+ version: "5.14.0",
5494
5494
  namespace: "alextheman"
5495
5495
  },
5496
5496
  configs: {},
@@ -24,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  //#endregion
25
25
  let typescript_eslint = require("typescript-eslint");
26
26
  typescript_eslint = __toESM(typescript_eslint, 1);
27
+ let _alextheman_utility = require("@alextheman/utility");
27
28
  //#region node_modules/.pnpm/globals@17.5.0/node_modules/globals/globals.json
28
29
  var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29
30
  module.exports = {
@@ -4144,6 +4145,58 @@ const unusedVarsIgnorePatterns = {
4144
4145
  varsIgnorePattern: "^_"
4145
4146
  };
4146
4147
  //#endregion
4148
+ //#region src/configs/helpers/restrictedImports/generalRestrictedImports.ts
4149
+ const generalRestrictedImports = { patterns: [{
4150
+ group: ["node_modules"],
4151
+ message: "Do not import directly from node_modules."
4152
+ }] };
4153
+ //#endregion
4154
+ //#region src/utility/public/combineRestrictedImports.ts
4155
+ /**
4156
+ * Combines multiple option groups for the native ESLint `no-restricted-imports` rule, without overwriting previous configurations.
4157
+ *
4158
+ * @category Utility
4159
+ *
4160
+ * @param groups - Option groups to combine, applied in the order provided.
4161
+ *
4162
+ * @returns A new object combining all paths and patterns from the given groups, suitable as an option to pass to `no-restricted-imports`.
4163
+ */
4164
+ function combineRestrictedImports(...groups) {
4165
+ const paths = [];
4166
+ const patterns = [];
4167
+ for (const group of groups) {
4168
+ if (group.paths) paths.push(...group.paths);
4169
+ if (group.patterns) patterns.push(...group.patterns);
4170
+ }
4171
+ const combinedGroup = {
4172
+ paths,
4173
+ patterns
4174
+ };
4175
+ if (combinedGroup.paths.length === 0) return (0, _alextheman_utility.omitProperties)(combinedGroup, "paths");
4176
+ if (combinedGroup.patterns.length === 0) return (0, _alextheman_utility.omitProperties)(combinedGroup, "patterns");
4177
+ return combinedGroup;
4178
+ }
4179
+ //#endregion
4180
+ //#region src/configs/helpers/restrictedImports/personalRestrictedImports.ts
4181
+ const personalRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [...["fs", "node:fs"].map((name) => {
4182
+ return {
4183
+ message: "Please use node:fs/promises instead.",
4184
+ name
4185
+ };
4186
+ })] });
4187
+ //#endregion
4188
+ //#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
4189
+ const reactRestrictedImports = combineRestrictedImports(generalRestrictedImports, { patterns: [{
4190
+ message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
4191
+ regex: "^@mui/[^/]+$"
4192
+ }] });
4193
+ //#endregion
4194
+ //#region src/configs/helpers/restrictedImports/testsRestrictedImports.ts
4195
+ const testsRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [{
4196
+ message: "Use test functions from vitest instead.",
4197
+ name: "node:test"
4198
+ }] });
4199
+ //#endregion
4147
4200
  //#region src/configs/helpers/sorting/sortClasses.ts
4148
4201
  const sortClasses = {
4149
4202
  customGroups: [],
@@ -4243,10 +4296,14 @@ const sortObjects = {
4243
4296
  useConfigurationIf: {}
4244
4297
  };
4245
4298
  //#endregion
4299
+ exports.generalRestrictedImports = generalRestrictedImports;
4300
+ exports.personalRestrictedImports = personalRestrictedImports;
4246
4301
  exports.reactLanguageOptions = reactLanguageOptions;
4302
+ exports.reactRestrictedImports = reactRestrictedImports;
4247
4303
  exports.sortClasses = sortClasses;
4248
4304
  exports.sortExports = sortExports;
4249
4305
  exports.sortImports = sortImports;
4250
4306
  exports.sortObjects = sortObjects;
4307
+ exports.testsRestrictedImports = testsRestrictedImports;
4251
4308
  exports.typeScriptLanguageOptions = typeScriptLanguageOptions;
4252
4309
  exports.unusedVarsIgnorePatterns = unusedVarsIgnorePatterns;
@@ -1,5 +1,4 @@
1
1
  import { Linter } from "eslint";
2
-
3
2
  //#region src/configs/helpers/reactLanguageOptions.d.ts
4
3
  declare const reactLanguageOptions: Linter.LanguageOptions;
5
4
  //#endregion
@@ -13,78 +12,6 @@ declare const unusedVarsIgnorePatterns: {
13
12
  varsIgnorePattern: string;
14
13
  };
15
14
  //#endregion
16
- //#region src/configs/helpers/sorting/sortClasses.d.ts
17
- declare const sortClasses: {
18
- customGroups: never[];
19
- fallbackSort: {
20
- type: string;
21
- };
22
- groups: (string | string[])[];
23
- ignoreCase: boolean;
24
- newlinesBetween: number;
25
- order: string;
26
- partitionByComment: boolean;
27
- partitionByNewLine: boolean;
28
- specialCharacters: string;
29
- type: string;
30
- };
31
- //#endregion
32
- //#region src/configs/helpers/sorting/sortExports.d.ts
33
- declare const sortExports: {
34
- customGroups: never[];
35
- fallbackSort: {
36
- type: string;
37
- };
38
- groups: string[];
39
- ignoreCase: boolean;
40
- newlinesBetween: number;
41
- order: string;
42
- partitionByComment: boolean;
43
- partitionByNewLine: boolean;
44
- specialCharacters: string;
45
- type: string;
46
- };
47
- //#endregion
48
- //#region src/configs/helpers/sorting/sortImports.d.ts
49
- declare const sortImports: {
50
- customGroups: ({
51
- elementNamePattern: string[];
52
- groupName: string;
53
- selector?: undefined;
54
- } | {
55
- elementNamePattern: string[];
56
- groupName: string;
57
- selector: string;
58
- })[];
59
- groups: string[];
60
- ignoreCase: boolean;
61
- internalPattern: string[];
62
- newlinesBetween: number;
63
- order: string;
64
- partitionByComment: boolean;
65
- partitionByNewLine: boolean;
66
- specialCharacters: string;
67
- type: string;
68
- };
69
- //#endregion
70
- //#region src/configs/helpers/sorting/sortObjects.d.ts
71
- declare const sortObjects: {
72
- customGroups: never[];
73
- fallbackSort: {
74
- type: string;
75
- };
76
- groups: never[];
77
- ignoreCase: boolean;
78
- newlinesBetween: string;
79
- order: string;
80
- partitionByComment: boolean;
81
- partitionByNewLine: boolean;
82
- specialCharacters: string;
83
- styledComponents: boolean;
84
- type: string;
85
- useConfigurationIf: {};
86
- };
87
- //#endregion
88
15
  //#region src/utility/public/NoRestrictedImportsOptions.d.ts
89
16
  interface RestrictedPathImportBase {
90
17
  message: string;
@@ -157,4 +84,88 @@ interface NoRestrictedImportsOptionsPathsAndPatterns {
157
84
  */
158
85
  type NoRestrictedImportsOptions = NoRestrictedImportsOptionsPathsOnly | NoRestrictedImportsOptionsPatternsOnly | NoRestrictedImportsOptionsPathsAndPatterns;
159
86
  //#endregion
160
- export { type NoRestrictedImportsOptions, type RestrictedPathImport, type RestrictedPatternImport, reactLanguageOptions, sortClasses, sortExports, sortImports, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
87
+ //#region src/configs/helpers/restrictedImports/generalRestrictedImports.d.ts
88
+ declare const generalRestrictedImports: NoRestrictedImportsOptions;
89
+ //#endregion
90
+ //#region src/configs/helpers/restrictedImports/personalRestrictedImports.d.ts
91
+ declare const personalRestrictedImports: NoRestrictedImportsOptions;
92
+ //#endregion
93
+ //#region src/configs/helpers/restrictedImports/reactRestrictedImports.d.ts
94
+ declare const reactRestrictedImports: NoRestrictedImportsOptions;
95
+ //#endregion
96
+ //#region src/configs/helpers/restrictedImports/testsRestrictedImports.d.ts
97
+ declare const testsRestrictedImports: NoRestrictedImportsOptions;
98
+ //#endregion
99
+ //#region src/configs/helpers/sorting/sortClasses.d.ts
100
+ declare const sortClasses: {
101
+ customGroups: never[];
102
+ fallbackSort: {
103
+ type: string;
104
+ };
105
+ groups: (string | string[])[];
106
+ ignoreCase: boolean;
107
+ newlinesBetween: number;
108
+ order: string;
109
+ partitionByComment: boolean;
110
+ partitionByNewLine: boolean;
111
+ specialCharacters: string;
112
+ type: string;
113
+ };
114
+ //#endregion
115
+ //#region src/configs/helpers/sorting/sortExports.d.ts
116
+ declare const sortExports: {
117
+ customGroups: never[];
118
+ fallbackSort: {
119
+ type: string;
120
+ };
121
+ groups: string[];
122
+ ignoreCase: boolean;
123
+ newlinesBetween: number;
124
+ order: string;
125
+ partitionByComment: boolean;
126
+ partitionByNewLine: boolean;
127
+ specialCharacters: string;
128
+ type: string;
129
+ };
130
+ //#endregion
131
+ //#region src/configs/helpers/sorting/sortImports.d.ts
132
+ declare const sortImports: {
133
+ customGroups: ({
134
+ elementNamePattern: string[];
135
+ groupName: string;
136
+ selector?: undefined;
137
+ } | {
138
+ elementNamePattern: string[];
139
+ groupName: string;
140
+ selector: string;
141
+ })[];
142
+ groups: string[];
143
+ ignoreCase: boolean;
144
+ internalPattern: string[];
145
+ newlinesBetween: number;
146
+ order: string;
147
+ partitionByComment: boolean;
148
+ partitionByNewLine: boolean;
149
+ specialCharacters: string;
150
+ type: string;
151
+ };
152
+ //#endregion
153
+ //#region src/configs/helpers/sorting/sortObjects.d.ts
154
+ declare const sortObjects: {
155
+ customGroups: never[];
156
+ fallbackSort: {
157
+ type: string;
158
+ };
159
+ groups: never[];
160
+ ignoreCase: boolean;
161
+ newlinesBetween: string;
162
+ order: string;
163
+ partitionByComment: boolean;
164
+ partitionByNewLine: boolean;
165
+ specialCharacters: string;
166
+ styledComponents: boolean;
167
+ type: string;
168
+ useConfigurationIf: {};
169
+ };
170
+ //#endregion
171
+ export { type NoRestrictedImportsOptions, type RestrictedPathImport, type RestrictedPatternImport, generalRestrictedImports, personalRestrictedImports, reactLanguageOptions, reactRestrictedImports, sortClasses, sortExports, sortImports, sortObjects, testsRestrictedImports, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
@@ -1,5 +1,4 @@
1
1
  import { Linter } from "eslint";
2
-
3
2
  //#region src/configs/helpers/reactLanguageOptions.d.ts
4
3
  declare const reactLanguageOptions: Linter.LanguageOptions;
5
4
  //#endregion
@@ -13,78 +12,6 @@ declare const unusedVarsIgnorePatterns: {
13
12
  varsIgnorePattern: string;
14
13
  };
15
14
  //#endregion
16
- //#region src/configs/helpers/sorting/sortClasses.d.ts
17
- declare const sortClasses: {
18
- customGroups: never[];
19
- fallbackSort: {
20
- type: string;
21
- };
22
- groups: (string | string[])[];
23
- ignoreCase: boolean;
24
- newlinesBetween: number;
25
- order: string;
26
- partitionByComment: boolean;
27
- partitionByNewLine: boolean;
28
- specialCharacters: string;
29
- type: string;
30
- };
31
- //#endregion
32
- //#region src/configs/helpers/sorting/sortExports.d.ts
33
- declare const sortExports: {
34
- customGroups: never[];
35
- fallbackSort: {
36
- type: string;
37
- };
38
- groups: string[];
39
- ignoreCase: boolean;
40
- newlinesBetween: number;
41
- order: string;
42
- partitionByComment: boolean;
43
- partitionByNewLine: boolean;
44
- specialCharacters: string;
45
- type: string;
46
- };
47
- //#endregion
48
- //#region src/configs/helpers/sorting/sortImports.d.ts
49
- declare const sortImports: {
50
- customGroups: ({
51
- elementNamePattern: string[];
52
- groupName: string;
53
- selector?: undefined;
54
- } | {
55
- elementNamePattern: string[];
56
- groupName: string;
57
- selector: string;
58
- })[];
59
- groups: string[];
60
- ignoreCase: boolean;
61
- internalPattern: string[];
62
- newlinesBetween: number;
63
- order: string;
64
- partitionByComment: boolean;
65
- partitionByNewLine: boolean;
66
- specialCharacters: string;
67
- type: string;
68
- };
69
- //#endregion
70
- //#region src/configs/helpers/sorting/sortObjects.d.ts
71
- declare const sortObjects: {
72
- customGroups: never[];
73
- fallbackSort: {
74
- type: string;
75
- };
76
- groups: never[];
77
- ignoreCase: boolean;
78
- newlinesBetween: string;
79
- order: string;
80
- partitionByComment: boolean;
81
- partitionByNewLine: boolean;
82
- specialCharacters: string;
83
- styledComponents: boolean;
84
- type: string;
85
- useConfigurationIf: {};
86
- };
87
- //#endregion
88
15
  //#region src/utility/public/NoRestrictedImportsOptions.d.ts
89
16
  interface RestrictedPathImportBase {
90
17
  message: string;
@@ -157,4 +84,88 @@ interface NoRestrictedImportsOptionsPathsAndPatterns {
157
84
  */
158
85
  type NoRestrictedImportsOptions = NoRestrictedImportsOptionsPathsOnly | NoRestrictedImportsOptionsPatternsOnly | NoRestrictedImportsOptionsPathsAndPatterns;
159
86
  //#endregion
160
- export { type NoRestrictedImportsOptions, type RestrictedPathImport, type RestrictedPatternImport, reactLanguageOptions, sortClasses, sortExports, sortImports, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
87
+ //#region src/configs/helpers/restrictedImports/generalRestrictedImports.d.ts
88
+ declare const generalRestrictedImports: NoRestrictedImportsOptions;
89
+ //#endregion
90
+ //#region src/configs/helpers/restrictedImports/personalRestrictedImports.d.ts
91
+ declare const personalRestrictedImports: NoRestrictedImportsOptions;
92
+ //#endregion
93
+ //#region src/configs/helpers/restrictedImports/reactRestrictedImports.d.ts
94
+ declare const reactRestrictedImports: NoRestrictedImportsOptions;
95
+ //#endregion
96
+ //#region src/configs/helpers/restrictedImports/testsRestrictedImports.d.ts
97
+ declare const testsRestrictedImports: NoRestrictedImportsOptions;
98
+ //#endregion
99
+ //#region src/configs/helpers/sorting/sortClasses.d.ts
100
+ declare const sortClasses: {
101
+ customGroups: never[];
102
+ fallbackSort: {
103
+ type: string;
104
+ };
105
+ groups: (string | string[])[];
106
+ ignoreCase: boolean;
107
+ newlinesBetween: number;
108
+ order: string;
109
+ partitionByComment: boolean;
110
+ partitionByNewLine: boolean;
111
+ specialCharacters: string;
112
+ type: string;
113
+ };
114
+ //#endregion
115
+ //#region src/configs/helpers/sorting/sortExports.d.ts
116
+ declare const sortExports: {
117
+ customGroups: never[];
118
+ fallbackSort: {
119
+ type: string;
120
+ };
121
+ groups: string[];
122
+ ignoreCase: boolean;
123
+ newlinesBetween: number;
124
+ order: string;
125
+ partitionByComment: boolean;
126
+ partitionByNewLine: boolean;
127
+ specialCharacters: string;
128
+ type: string;
129
+ };
130
+ //#endregion
131
+ //#region src/configs/helpers/sorting/sortImports.d.ts
132
+ declare const sortImports: {
133
+ customGroups: ({
134
+ elementNamePattern: string[];
135
+ groupName: string;
136
+ selector?: undefined;
137
+ } | {
138
+ elementNamePattern: string[];
139
+ groupName: string;
140
+ selector: string;
141
+ })[];
142
+ groups: string[];
143
+ ignoreCase: boolean;
144
+ internalPattern: string[];
145
+ newlinesBetween: number;
146
+ order: string;
147
+ partitionByComment: boolean;
148
+ partitionByNewLine: boolean;
149
+ specialCharacters: string;
150
+ type: string;
151
+ };
152
+ //#endregion
153
+ //#region src/configs/helpers/sorting/sortObjects.d.ts
154
+ declare const sortObjects: {
155
+ customGroups: never[];
156
+ fallbackSort: {
157
+ type: string;
158
+ };
159
+ groups: never[];
160
+ ignoreCase: boolean;
161
+ newlinesBetween: string;
162
+ order: string;
163
+ partitionByComment: boolean;
164
+ partitionByNewLine: boolean;
165
+ specialCharacters: string;
166
+ styledComponents: boolean;
167
+ type: string;
168
+ useConfigurationIf: {};
169
+ };
170
+ //#endregion
171
+ export { type NoRestrictedImportsOptions, type RestrictedPathImport, type RestrictedPatternImport, generalRestrictedImports, personalRestrictedImports, reactLanguageOptions, reactRestrictedImports, sortClasses, sortExports, sortImports, sortObjects, testsRestrictedImports, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
@@ -1,4 +1,5 @@
1
1
  import tseslint from "typescript-eslint";
2
+ import { omitProperties } from "@alextheman/utility";
2
3
  //#region \0rolldown/runtime.js
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
@@ -4142,6 +4143,58 @@ const unusedVarsIgnorePatterns = {
4142
4143
  varsIgnorePattern: "^_"
4143
4144
  };
4144
4145
  //#endregion
4146
+ //#region src/configs/helpers/restrictedImports/generalRestrictedImports.ts
4147
+ const generalRestrictedImports = { patterns: [{
4148
+ group: ["node_modules"],
4149
+ message: "Do not import directly from node_modules."
4150
+ }] };
4151
+ //#endregion
4152
+ //#region src/utility/public/combineRestrictedImports.ts
4153
+ /**
4154
+ * Combines multiple option groups for the native ESLint `no-restricted-imports` rule, without overwriting previous configurations.
4155
+ *
4156
+ * @category Utility
4157
+ *
4158
+ * @param groups - Option groups to combine, applied in the order provided.
4159
+ *
4160
+ * @returns A new object combining all paths and patterns from the given groups, suitable as an option to pass to `no-restricted-imports`.
4161
+ */
4162
+ function combineRestrictedImports(...groups) {
4163
+ const paths = [];
4164
+ const patterns = [];
4165
+ for (const group of groups) {
4166
+ if (group.paths) paths.push(...group.paths);
4167
+ if (group.patterns) patterns.push(...group.patterns);
4168
+ }
4169
+ const combinedGroup = {
4170
+ paths,
4171
+ patterns
4172
+ };
4173
+ if (combinedGroup.paths.length === 0) return omitProperties(combinedGroup, "paths");
4174
+ if (combinedGroup.patterns.length === 0) return omitProperties(combinedGroup, "patterns");
4175
+ return combinedGroup;
4176
+ }
4177
+ //#endregion
4178
+ //#region src/configs/helpers/restrictedImports/personalRestrictedImports.ts
4179
+ const personalRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [...["fs", "node:fs"].map((name) => {
4180
+ return {
4181
+ message: "Please use node:fs/promises instead.",
4182
+ name
4183
+ };
4184
+ })] });
4185
+ //#endregion
4186
+ //#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
4187
+ const reactRestrictedImports = combineRestrictedImports(generalRestrictedImports, { patterns: [{
4188
+ message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
4189
+ regex: "^@mui/[^/]+$"
4190
+ }] });
4191
+ //#endregion
4192
+ //#region src/configs/helpers/restrictedImports/testsRestrictedImports.ts
4193
+ const testsRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [{
4194
+ message: "Use test functions from vitest instead.",
4195
+ name: "node:test"
4196
+ }] });
4197
+ //#endregion
4145
4198
  //#region src/configs/helpers/sorting/sortClasses.ts
4146
4199
  const sortClasses = {
4147
4200
  customGroups: [],
@@ -4241,4 +4294,4 @@ const sortObjects = {
4241
4294
  useConfigurationIf: {}
4242
4295
  };
4243
4296
  //#endregion
4244
- export { reactLanguageOptions, sortClasses, sortExports, sortImports, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
4297
+ export { generalRestrictedImports, personalRestrictedImports, reactLanguageOptions, reactRestrictedImports, sortClasses, sortExports, sortImports, sortObjects, testsRestrictedImports, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/eslint-plugin",
3
- "version": "5.13.1",
3
+ "version": "5.14.0",
4
4
  "description": "A package to provide custom ESLint rules and configs.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,10 +34,10 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@alextheman/utility": "5.13.1",
37
+ "@alextheman/utility": "5.14.0",
38
38
  "@eslint/compat": "2.0.5",
39
- "@typescript-eslint/types": "8.58.2",
40
- "@typescript-eslint/utils": "8.58.2",
39
+ "@typescript-eslint/types": "8.59.0",
40
+ "@typescript-eslint/utils": "8.59.0",
41
41
  "common-tags": "1.8.2",
42
42
  "prettier": "3.8.3",
43
43
  "zod": "4.3.6"
@@ -48,8 +48,8 @@
48
48
  "@types/eslint": "9.6.1",
49
49
  "@types/eslint-plugin-jsx-a11y": "6.10.1",
50
50
  "@types/node": "25.6.0",
51
- "@typescript-eslint/rule-tester": "8.58.2",
52
- "alex-c-line": "2.7.0",
51
+ "@typescript-eslint/rule-tester": "8.59.0",
52
+ "alex-c-line": "2.7.2",
53
53
  "dotenv-cli": "11.0.0",
54
54
  "eslint": "10.2.1",
55
55
  "eslint-config-prettier": "10.1.8",
@@ -60,7 +60,7 @@
60
60
  "eslint-plugin-markdownlint": "0.9.0",
61
61
  "eslint-plugin-n": "17.24.0",
62
62
  "eslint-plugin-package-json": "0.91.1",
63
- "eslint-plugin-perfectionist": "5.8.0",
63
+ "eslint-plugin-perfectionist": "5.9.0",
64
64
  "eslint-plugin-prettier": "5.5.5",
65
65
  "eslint-plugin-react": "7.37.5",
66
66
  "eslint-plugin-react-hooks": "7.1.1",
@@ -70,14 +70,14 @@
70
70
  "globals": "17.5.0",
71
71
  "husky": "9.1.7",
72
72
  "jsdom": "29.0.2",
73
- "markdownlint-cli2": "0.22.0",
73
+ "markdownlint-cli2": "0.22.1",
74
74
  "tempy": "3.2.0",
75
- "tsdown": "0.21.9",
75
+ "tsdown": "0.21.10",
76
76
  "tsx": "4.21.0",
77
77
  "typescript": "6.0.3",
78
- "typescript-eslint": "8.58.2",
79
- "vite": "8.0.8",
80
- "vitest": "4.1.4"
78
+ "typescript-eslint": "8.59.0",
79
+ "vite": "8.0.10",
80
+ "vitest": "4.1.5"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@eslint/js": ">=9.0.0",