@alextheman/eslint-plugin 5.2.3 → 5.4.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.
@@ -0,0 +1,209 @@
1
+ //#region rolldown:runtime
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ let _typescript_eslint_utils = require("@typescript-eslint/utils");
29
+ let _alextheman_utility = require("@alextheman/utility");
30
+ let zod = require("zod");
31
+ zod = __toESM(zod);
32
+
33
+ //#region src/utility/public/checkCallExpression.ts
34
+ /**
35
+ * Checks if a given node matches the expected object and property names.
36
+ *
37
+ * @category Utility
38
+ *
39
+ * @param node - The node to check.
40
+ * @param objectName - The object name to compare against the node.
41
+ * @param propertyName - The property name to compare against the node.
42
+ *
43
+ * @returns A value of `true` if the given `objectName` and `propertyName` matches those of the node, and `false` otherwise.
44
+ */
45
+ function checkCallExpression(node, objectName, propertyName) {
46
+ return node.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && node.callee.object.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.object.name === objectName && node.callee.property.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.property.name === propertyName;
47
+ }
48
+ var checkCallExpression_default = checkCallExpression;
49
+
50
+ //#endregion
51
+ //#region src/utility/public/combineRestrictedImports.ts
52
+ /**
53
+ * Combines multiple option groups for the native ESLint `no-restricted-imports` rule, without overwriting previous configurations.
54
+ *
55
+ * @category Utility
56
+ *
57
+ * @param groups - Option groups to combine, applied in the order provided.
58
+ *
59
+ * @returns A new object combining all paths and patterns from the given groups, suitable as an option to pass to `no-restricted-imports`.
60
+ */
61
+ function combineRestrictedImports(...groups) {
62
+ const paths = [];
63
+ const patterns = [];
64
+ for (const group of groups) {
65
+ if (group.paths) paths.push(...group.paths);
66
+ if (group.patterns) patterns.push(...group.patterns);
67
+ }
68
+ const combinedGroup = {
69
+ paths,
70
+ patterns
71
+ };
72
+ if (combinedGroup.paths.length === 0) return (0, _alextheman_utility.omitProperties)(combinedGroup, "paths");
73
+ if (combinedGroup.patterns.length === 0) return (0, _alextheman_utility.omitProperties)(combinedGroup, "patterns");
74
+ return combinedGroup;
75
+ }
76
+ var combineRestrictedImports_default = combineRestrictedImports;
77
+
78
+ //#endregion
79
+ //#region src/utility/public/createRuleSchemaFromZodSchema.ts
80
+ /**
81
+ * Converts a Zod schema to a JSON schema for usage in an ESLint rule.
82
+ *
83
+ * @category Utility
84
+ *
85
+ * @param schema - The Zod schema to convert.
86
+ *
87
+ * @returns An array containing the resulting JSON Schema, formatted for ESLint rule schema compatibility.
88
+ */
89
+ function createRuleSchemaFromZodSchema(schema) {
90
+ return [(0, _alextheman_utility.omitProperties)(zod.default.toJSONSchema(schema), "$schema")];
91
+ }
92
+ var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
93
+
94
+ //#endregion
95
+ //#region src/utility/public/fixOnCondition.ts
96
+ /**
97
+ * Returns a rule fixer function to run based on a given condition
98
+ *
99
+ * @category Utility
100
+ *
101
+ * @param fixable - Whether the rule should be treated as fixable or not, and therefore whether the fixer should run.
102
+ * @param fix - The rule fixer function to run.
103
+ *
104
+ * @returns The rule fixer function invoked with the fixer, provided the fixable condition is met.
105
+ */
106
+ function fixOnCondition(fixable, fix) {
107
+ return (fixer) => {
108
+ if (!fixable) return null;
109
+ return fix(fixer);
110
+ };
111
+ }
112
+ var fixOnCondition_default = fixOnCondition;
113
+
114
+ //#endregion
115
+ //#region src/utility/private/camelToKebab.ts
116
+ function camelToKebab(string) {
117
+ if (string[0] === string[0].toUpperCase()) throw new _alextheman_utility.DataError(string, "CAMEL_TO_KEBAB_CONVERSION_ERROR", "camelCase string must start with a lowercase letter.");
118
+ return (0, _alextheman_utility.camelToKebab)(string, { preserveConsecutiveCapitals: false });
119
+ }
120
+ var camelToKebab_default = camelToKebab;
121
+
122
+ //#endregion
123
+ //#region src/utility/private/createConfigGroup.ts
124
+ function createConfigGroup(group, configs) {
125
+ const newConfigs = {};
126
+ for (const key in configs) newConfigs[`${camelToKebab_default(group)}/${camelToKebab_default(key)}`] = configs[key];
127
+ return newConfigs;
128
+ }
129
+ var createConfigGroup_default = createConfigGroup;
130
+
131
+ //#endregion
132
+ //#region src/utility/public/flattenConfigs.ts
133
+ /**
134
+ * Takes in a nested group of configs, and returns them flattened according to ESLint config naming conventions.
135
+ *
136
+ * @category Utility
137
+ *
138
+ * @template ConfigObject - The type of the input config object.
139
+ *
140
+ * @param config - A doubly-nested config object to pass in, where the key of the top-level object is the config group name, and the key of the nested object is the name of the config within the group (e.g. `groupName.configName`).
141
+ *
142
+ * @returns A single-layered object with the key flattened down to be `group-name/config-name`.
143
+ *
144
+ * @example
145
+ * flattenConfigs<AlexPluginConfigGroup>({
146
+ * general: {
147
+ * typeScript: generalTypeScriptConfig,
148
+ * javaScript: generalJavaScriptConfig,
149
+ * react: generalReactConfig,
150
+ * // ...
151
+ * }
152
+ * plugin: {
153
+ * base: pluginBaseConfig,
154
+ * tests: pluginTestsConfig,
155
+ * // ...
156
+ * }
157
+ * })
158
+ *
159
+ * // Returns:
160
+ * {
161
+ * "general/typescript": generalTypeScriptConfig,
162
+ * "general/javascript": generalJavaScriptConfig,
163
+ * "general/react": generalReactConfig,
164
+ * // ...,
165
+ * "plugin/base": pluginBaseConfig,
166
+ * "plugin/tests": pluginTestsConfig
167
+ * // ...
168
+ * }
169
+ */
170
+ function flattenConfigs(config) {
171
+ const allConfigs = {};
172
+ for (const configGroupEntries of Object.entries(config)) Object.assign(allConfigs, createConfigGroup_default(...configGroupEntries));
173
+ return allConfigs;
174
+ }
175
+ var flattenConfigs_default = flattenConfigs;
176
+
177
+ //#endregion
178
+ //#region src/utility/public/getImportSpecifiersAfterRemoving.ts
179
+ /**
180
+ * Returns a comma-separated string of import specifiers, excluding the specified import.
181
+ *
182
+ * Useful for auto-fixable rules that remove a specific import from an import statement.
183
+ *
184
+ * @category Utility
185
+ *
186
+ * @template RuleOptions - The type of the RuleOptions from the given context.
187
+ *
188
+ * @param context - The current ESLint rule context.
189
+ * @param specifiers - Array of import clause nodes.
190
+ * @param importToRemove - The import name to remove from the list.
191
+ *
192
+ * @returns A comma-separated string of import specifiers after removing the specified import.
193
+ */
194
+ function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
195
+ return specifiers.filter((specifier) => {
196
+ return !(specifier.imported.name === importToRemove);
197
+ }).map((specifier) => {
198
+ return context.sourceCode.getText(specifier);
199
+ }).join(", ");
200
+ }
201
+ var getImportSpecifiersAfterRemoving_default = getImportSpecifiersAfterRemoving;
202
+
203
+ //#endregion
204
+ exports.checkCallExpression = checkCallExpression_default;
205
+ exports.combineRestrictedImports = combineRestrictedImports_default;
206
+ exports.createRuleSchemaFromZodSchema = createRuleSchemaFromZodSchema_default;
207
+ exports.fixOnCondition = fixOnCondition_default;
208
+ exports.flattenConfigs = flattenConfigs_default;
209
+ exports.getImportSpecifiersAfterRemoving = getImportSpecifiersAfterRemoving_default;
@@ -0,0 +1,208 @@
1
+ import { TSESTree } from "@typescript-eslint/utils";
2
+ import "typedoc";
3
+ import "typedoc-plugin-markdown";
4
+ import { Linter } from "eslint";
5
+ import { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
6
+ import z from "zod";
7
+ import { RuleContext, RuleFix, RuleFixer } from "@typescript-eslint/utils/ts-eslint";
8
+
9
+ //#region src/utility/public/checkCallExpression.d.ts
10
+
11
+ /**
12
+ * Checks if a given node matches the expected object and property names.
13
+ *
14
+ * @category Utility
15
+ *
16
+ * @param node - The node to check.
17
+ * @param objectName - The object name to compare against the node.
18
+ * @param propertyName - The property name to compare against the node.
19
+ *
20
+ * @returns A value of `true` if the given `objectName` and `propertyName` matches those of the node, and `false` otherwise.
21
+ */
22
+ declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
23
+ //#endregion
24
+ //#region src/utility/public/NoRestrictedImportsOptions.d.ts
25
+ interface RestrictedPathImportBase {
26
+ message: string;
27
+ name: string;
28
+ allowTypeImports?: boolean;
29
+ }
30
+ interface RestrictedPathImportImportNames extends RestrictedPathImportBase {
31
+ importNames: string[];
32
+ allowImportNames?: never;
33
+ }
34
+ interface RestrictedPathImportAllowImportNames extends RestrictedPathImportBase {
35
+ allowImportNames: string[];
36
+ importNames?: never;
37
+ }
38
+ type RestrictedPathImport = RestrictedPathImportBase | RestrictedPathImportImportNames | RestrictedPathImportAllowImportNames;
39
+ interface RestrictedPatternImportBase {
40
+ caseSensitive?: boolean;
41
+ message: string;
42
+ allowTypeImports?: boolean;
43
+ }
44
+ interface RestrictedPatternImportGroup extends RestrictedPatternImportBase {
45
+ group: string[];
46
+ regex?: never;
47
+ }
48
+ interface RestrictedPatternImportRegex extends RestrictedPatternImportBase {
49
+ regex: string;
50
+ group?: never;
51
+ }
52
+ interface RestrictedPatternImportImportNames extends RestrictedPatternImportBase {
53
+ importNames: string[];
54
+ allowImportNames?: never;
55
+ importNamePattern?: never;
56
+ allowImportNamePattern?: never;
57
+ }
58
+ interface RestrictedPatternImportAllowImportNames extends RestrictedPatternImportBase {
59
+ importNames?: never;
60
+ allowImportNames: string[];
61
+ importNamePattern?: never;
62
+ allowImportNamePattern?: never;
63
+ }
64
+ interface RestrictedPatternImportImportNamePattern extends RestrictedPatternImportBase {
65
+ importNames?: never;
66
+ allowImportNames?: never;
67
+ importNamePattern: string;
68
+ allowImportNamePattern?: never;
69
+ }
70
+ interface RestrictedPatternImportAllowImportNamePattern extends RestrictedPatternImportBase {
71
+ importNames?: never;
72
+ allowImportNames?: never;
73
+ importNamePattern?: never;
74
+ allowImportNamePattern: string;
75
+ }
76
+ type RestrictedPatternImport = RestrictedPatternImportGroup | RestrictedPatternImportRegex | RestrictedPatternImportImportNames | RestrictedPatternImportAllowImportNames | RestrictedPatternImportImportNamePattern | RestrictedPatternImportAllowImportNamePattern;
77
+ interface NoRestrictedImportsOptionsPathsOnly {
78
+ paths: RestrictedPathImport[];
79
+ patterns?: never;
80
+ }
81
+ interface NoRestrictedImportsOptionsPatternsOnly {
82
+ paths?: never;
83
+ patterns: RestrictedPatternImport[];
84
+ }
85
+ interface NoRestrictedImportsOptionsPathsAndPatterns {
86
+ paths: RestrictedPathImport[];
87
+ patterns: RestrictedPatternImport[];
88
+ }
89
+ /**
90
+ * Options for the built-in ESLint `no-restricted-imports` rule.
91
+ *
92
+ * @category Rule Options
93
+ */
94
+ type NoRestrictedImportsOptions = NoRestrictedImportsOptionsPathsOnly | NoRestrictedImportsOptionsPatternsOnly | NoRestrictedImportsOptionsPathsAndPatterns;
95
+ //#endregion
96
+ //#region src/utility/public/combineRestrictedImports.d.ts
97
+ /**
98
+ * Combines multiple option groups for the native ESLint `no-restricted-imports` rule, without overwriting previous configurations.
99
+ *
100
+ * @category Utility
101
+ *
102
+ * @param groups - Option groups to combine, applied in the order provided.
103
+ *
104
+ * @returns A new object combining all paths and patterns from the given groups, suitable as an option to pass to `no-restricted-imports`.
105
+ */
106
+ declare function combineRestrictedImports(...groups: NoRestrictedImportsOptions[]): NoRestrictedImportsOptions;
107
+ //#endregion
108
+ //#region src/utility/public/createRuleSchemaFromZodSchema.d.ts
109
+ /**
110
+ * Converts a Zod schema to a JSON schema for usage in an ESLint rule.
111
+ *
112
+ * @category Utility
113
+ *
114
+ * @param schema - The Zod schema to convert.
115
+ *
116
+ * @returns An array containing the resulting JSON Schema, formatted for ESLint rule schema compatibility.
117
+ */
118
+ declare function createRuleSchemaFromZodSchema(schema: z.ZodType): JSONSchema4[];
119
+ //#endregion
120
+ //#region src/utility/public/fixOnCondition.d.ts
121
+ type RuleFixerFunction = (fixer: RuleFixer) => RuleFix | null;
122
+ /**
123
+ * Returns a rule fixer function to run based on a given condition
124
+ *
125
+ * @category Utility
126
+ *
127
+ * @param fixable - Whether the rule should be treated as fixable or not, and therefore whether the fixer should run.
128
+ * @param fix - The rule fixer function to run.
129
+ *
130
+ * @returns The rule fixer function invoked with the fixer, provided the fixable condition is met.
131
+ */
132
+ declare function fixOnCondition(fixable: boolean, fix: RuleFixerFunction): RuleFixerFunction;
133
+ //#endregion
134
+ //#region src/utility/private/camelToKebab.d.ts
135
+ type CamelToKebab<S extends string> = S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
136
+ //#endregion
137
+ //#region src/utility/public/GetFlattenedConfigNames.d.ts
138
+ /**
139
+ * A helper type to turn the keys of a doubly-nested object into a flattened ESLint config key.
140
+ *
141
+ * @category Utility
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * type ConfigNames = GetFlattenedConfigNames<{ general: { typescriptReact }}> // "general/typescript-react"
146
+ * ```
147
+ */
148
+ type GetFlattenedConfigNames<ConfigObject extends { [K in keyof ConfigObject]: Record<string, Linter.Config[]> }> = { [Group in keyof ConfigObject & string]: `${CamelToKebab<Group>}/${CamelToKebab<keyof ConfigObject[Group] & string>}` }[keyof ConfigObject & string];
149
+ //#endregion
150
+ //#region src/utility/public/flattenConfigs.d.ts
151
+ /**
152
+ * Takes in a nested group of configs, and returns them flattened according to ESLint config naming conventions.
153
+ *
154
+ * @category Utility
155
+ *
156
+ * @template ConfigObject - The type of the input config object.
157
+ *
158
+ * @param config - A doubly-nested config object to pass in, where the key of the top-level object is the config group name, and the key of the nested object is the name of the config within the group (e.g. `groupName.configName`).
159
+ *
160
+ * @returns A single-layered object with the key flattened down to be `group-name/config-name`.
161
+ *
162
+ * @example
163
+ * flattenConfigs<AlexPluginConfigGroup>({
164
+ * general: {
165
+ * typeScript: generalTypeScriptConfig,
166
+ * javaScript: generalJavaScriptConfig,
167
+ * react: generalReactConfig,
168
+ * // ...
169
+ * }
170
+ * plugin: {
171
+ * base: pluginBaseConfig,
172
+ * tests: pluginTestsConfig,
173
+ * // ...
174
+ * }
175
+ * })
176
+ *
177
+ * // Returns:
178
+ * {
179
+ * "general/typescript": generalTypeScriptConfig,
180
+ * "general/javascript": generalJavaScriptConfig,
181
+ * "general/react": generalReactConfig,
182
+ * // ...,
183
+ * "plugin/base": pluginBaseConfig,
184
+ * "plugin/tests": pluginTestsConfig
185
+ * // ...
186
+ * }
187
+ */
188
+ declare function flattenConfigs<ConfigObject extends { [K in keyof ConfigObject]: Record<string, Linter.Config[]> }>(config: ConfigObject): Record<GetFlattenedConfigNames<ConfigObject>, Linter.Config[]>;
189
+ //#endregion
190
+ //#region src/utility/public/getImportSpecifiersAfterRemoving.d.ts
191
+ /**
192
+ * Returns a comma-separated string of import specifiers, excluding the specified import.
193
+ *
194
+ * Useful for auto-fixable rules that remove a specific import from an import statement.
195
+ *
196
+ * @category Utility
197
+ *
198
+ * @template RuleOptions - The type of the RuleOptions from the given context.
199
+ *
200
+ * @param context - The current ESLint rule context.
201
+ * @param specifiers - Array of import clause nodes.
202
+ * @param importToRemove - The import name to remove from the list.
203
+ *
204
+ * @returns A comma-separated string of import specifiers after removing the specified import.
205
+ */
206
+ declare function getImportSpecifiersAfterRemoving<RuleOptions>(context: Readonly<RuleContext<"message", [RuleOptions]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
207
+ //#endregion
208
+ export { type GetFlattenedConfigNames, type NoRestrictedImportsOptions, checkCallExpression, combineRestrictedImports, createRuleSchemaFromZodSchema, fixOnCondition, flattenConfigs, getImportSpecifiersAfterRemoving };
@@ -0,0 +1,208 @@
1
+ import { TSESTree } from "@typescript-eslint/utils";
2
+ import z from "zod";
3
+ import "typedoc";
4
+ import "typedoc-plugin-markdown";
5
+ import { Linter } from "eslint";
6
+ import { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
7
+ import { RuleContext, RuleFix, RuleFixer } from "@typescript-eslint/utils/ts-eslint";
8
+
9
+ //#region src/utility/public/checkCallExpression.d.ts
10
+
11
+ /**
12
+ * Checks if a given node matches the expected object and property names.
13
+ *
14
+ * @category Utility
15
+ *
16
+ * @param node - The node to check.
17
+ * @param objectName - The object name to compare against the node.
18
+ * @param propertyName - The property name to compare against the node.
19
+ *
20
+ * @returns A value of `true` if the given `objectName` and `propertyName` matches those of the node, and `false` otherwise.
21
+ */
22
+ declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
23
+ //#endregion
24
+ //#region src/utility/public/NoRestrictedImportsOptions.d.ts
25
+ interface RestrictedPathImportBase {
26
+ message: string;
27
+ name: string;
28
+ allowTypeImports?: boolean;
29
+ }
30
+ interface RestrictedPathImportImportNames extends RestrictedPathImportBase {
31
+ importNames: string[];
32
+ allowImportNames?: never;
33
+ }
34
+ interface RestrictedPathImportAllowImportNames extends RestrictedPathImportBase {
35
+ allowImportNames: string[];
36
+ importNames?: never;
37
+ }
38
+ type RestrictedPathImport = RestrictedPathImportBase | RestrictedPathImportImportNames | RestrictedPathImportAllowImportNames;
39
+ interface RestrictedPatternImportBase {
40
+ caseSensitive?: boolean;
41
+ message: string;
42
+ allowTypeImports?: boolean;
43
+ }
44
+ interface RestrictedPatternImportGroup extends RestrictedPatternImportBase {
45
+ group: string[];
46
+ regex?: never;
47
+ }
48
+ interface RestrictedPatternImportRegex extends RestrictedPatternImportBase {
49
+ regex: string;
50
+ group?: never;
51
+ }
52
+ interface RestrictedPatternImportImportNames extends RestrictedPatternImportBase {
53
+ importNames: string[];
54
+ allowImportNames?: never;
55
+ importNamePattern?: never;
56
+ allowImportNamePattern?: never;
57
+ }
58
+ interface RestrictedPatternImportAllowImportNames extends RestrictedPatternImportBase {
59
+ importNames?: never;
60
+ allowImportNames: string[];
61
+ importNamePattern?: never;
62
+ allowImportNamePattern?: never;
63
+ }
64
+ interface RestrictedPatternImportImportNamePattern extends RestrictedPatternImportBase {
65
+ importNames?: never;
66
+ allowImportNames?: never;
67
+ importNamePattern: string;
68
+ allowImportNamePattern?: never;
69
+ }
70
+ interface RestrictedPatternImportAllowImportNamePattern extends RestrictedPatternImportBase {
71
+ importNames?: never;
72
+ allowImportNames?: never;
73
+ importNamePattern?: never;
74
+ allowImportNamePattern: string;
75
+ }
76
+ type RestrictedPatternImport = RestrictedPatternImportGroup | RestrictedPatternImportRegex | RestrictedPatternImportImportNames | RestrictedPatternImportAllowImportNames | RestrictedPatternImportImportNamePattern | RestrictedPatternImportAllowImportNamePattern;
77
+ interface NoRestrictedImportsOptionsPathsOnly {
78
+ paths: RestrictedPathImport[];
79
+ patterns?: never;
80
+ }
81
+ interface NoRestrictedImportsOptionsPatternsOnly {
82
+ paths?: never;
83
+ patterns: RestrictedPatternImport[];
84
+ }
85
+ interface NoRestrictedImportsOptionsPathsAndPatterns {
86
+ paths: RestrictedPathImport[];
87
+ patterns: RestrictedPatternImport[];
88
+ }
89
+ /**
90
+ * Options for the built-in ESLint `no-restricted-imports` rule.
91
+ *
92
+ * @category Rule Options
93
+ */
94
+ type NoRestrictedImportsOptions = NoRestrictedImportsOptionsPathsOnly | NoRestrictedImportsOptionsPatternsOnly | NoRestrictedImportsOptionsPathsAndPatterns;
95
+ //#endregion
96
+ //#region src/utility/public/combineRestrictedImports.d.ts
97
+ /**
98
+ * Combines multiple option groups for the native ESLint `no-restricted-imports` rule, without overwriting previous configurations.
99
+ *
100
+ * @category Utility
101
+ *
102
+ * @param groups - Option groups to combine, applied in the order provided.
103
+ *
104
+ * @returns A new object combining all paths and patterns from the given groups, suitable as an option to pass to `no-restricted-imports`.
105
+ */
106
+ declare function combineRestrictedImports(...groups: NoRestrictedImportsOptions[]): NoRestrictedImportsOptions;
107
+ //#endregion
108
+ //#region src/utility/public/createRuleSchemaFromZodSchema.d.ts
109
+ /**
110
+ * Converts a Zod schema to a JSON schema for usage in an ESLint rule.
111
+ *
112
+ * @category Utility
113
+ *
114
+ * @param schema - The Zod schema to convert.
115
+ *
116
+ * @returns An array containing the resulting JSON Schema, formatted for ESLint rule schema compatibility.
117
+ */
118
+ declare function createRuleSchemaFromZodSchema(schema: z.ZodType): JSONSchema4[];
119
+ //#endregion
120
+ //#region src/utility/public/fixOnCondition.d.ts
121
+ type RuleFixerFunction = (fixer: RuleFixer) => RuleFix | null;
122
+ /**
123
+ * Returns a rule fixer function to run based on a given condition
124
+ *
125
+ * @category Utility
126
+ *
127
+ * @param fixable - Whether the rule should be treated as fixable or not, and therefore whether the fixer should run.
128
+ * @param fix - The rule fixer function to run.
129
+ *
130
+ * @returns The rule fixer function invoked with the fixer, provided the fixable condition is met.
131
+ */
132
+ declare function fixOnCondition(fixable: boolean, fix: RuleFixerFunction): RuleFixerFunction;
133
+ //#endregion
134
+ //#region src/utility/private/camelToKebab.d.ts
135
+ type CamelToKebab<S extends string> = S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
136
+ //#endregion
137
+ //#region src/utility/public/GetFlattenedConfigNames.d.ts
138
+ /**
139
+ * A helper type to turn the keys of a doubly-nested object into a flattened ESLint config key.
140
+ *
141
+ * @category Utility
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * type ConfigNames = GetFlattenedConfigNames<{ general: { typescriptReact }}> // "general/typescript-react"
146
+ * ```
147
+ */
148
+ type GetFlattenedConfigNames<ConfigObject extends { [K in keyof ConfigObject]: Record<string, Linter.Config[]> }> = { [Group in keyof ConfigObject & string]: `${CamelToKebab<Group>}/${CamelToKebab<keyof ConfigObject[Group] & string>}` }[keyof ConfigObject & string];
149
+ //#endregion
150
+ //#region src/utility/public/flattenConfigs.d.ts
151
+ /**
152
+ * Takes in a nested group of configs, and returns them flattened according to ESLint config naming conventions.
153
+ *
154
+ * @category Utility
155
+ *
156
+ * @template ConfigObject - The type of the input config object.
157
+ *
158
+ * @param config - A doubly-nested config object to pass in, where the key of the top-level object is the config group name, and the key of the nested object is the name of the config within the group (e.g. `groupName.configName`).
159
+ *
160
+ * @returns A single-layered object with the key flattened down to be `group-name/config-name`.
161
+ *
162
+ * @example
163
+ * flattenConfigs<AlexPluginConfigGroup>({
164
+ * general: {
165
+ * typeScript: generalTypeScriptConfig,
166
+ * javaScript: generalJavaScriptConfig,
167
+ * react: generalReactConfig,
168
+ * // ...
169
+ * }
170
+ * plugin: {
171
+ * base: pluginBaseConfig,
172
+ * tests: pluginTestsConfig,
173
+ * // ...
174
+ * }
175
+ * })
176
+ *
177
+ * // Returns:
178
+ * {
179
+ * "general/typescript": generalTypeScriptConfig,
180
+ * "general/javascript": generalJavaScriptConfig,
181
+ * "general/react": generalReactConfig,
182
+ * // ...,
183
+ * "plugin/base": pluginBaseConfig,
184
+ * "plugin/tests": pluginTestsConfig
185
+ * // ...
186
+ * }
187
+ */
188
+ declare function flattenConfigs<ConfigObject extends { [K in keyof ConfigObject]: Record<string, Linter.Config[]> }>(config: ConfigObject): Record<GetFlattenedConfigNames<ConfigObject>, Linter.Config[]>;
189
+ //#endregion
190
+ //#region src/utility/public/getImportSpecifiersAfterRemoving.d.ts
191
+ /**
192
+ * Returns a comma-separated string of import specifiers, excluding the specified import.
193
+ *
194
+ * Useful for auto-fixable rules that remove a specific import from an import statement.
195
+ *
196
+ * @category Utility
197
+ *
198
+ * @template RuleOptions - The type of the RuleOptions from the given context.
199
+ *
200
+ * @param context - The current ESLint rule context.
201
+ * @param specifiers - Array of import clause nodes.
202
+ * @param importToRemove - The import name to remove from the list.
203
+ *
204
+ * @returns A comma-separated string of import specifiers after removing the specified import.
205
+ */
206
+ declare function getImportSpecifiersAfterRemoving<RuleOptions>(context: Readonly<RuleContext<"message", [RuleOptions]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
207
+ //#endregion
208
+ export { type GetFlattenedConfigNames, type NoRestrictedImportsOptions, checkCallExpression, combineRestrictedImports, createRuleSchemaFromZodSchema, fixOnCondition, flattenConfigs, getImportSpecifiersAfterRemoving };