@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.
- package/dist/index.cjs +78 -72
- package/dist/index.d.cts +57 -154
- package/dist/index.d.ts +56 -153
- package/dist/index.js +77 -58
- package/dist/utility/index.cjs +209 -0
- package/dist/utility/index.d.cts +208 -0
- package/dist/utility/index.d.ts +208 -0
- package/dist/utility/index.js +176 -0
- package/package.json +17 -2
package/dist/index.cjs
CHANGED
|
@@ -43,11 +43,11 @@ let eslint_plugin_perfectionist = require("eslint-plugin-perfectionist");
|
|
|
43
43
|
eslint_plugin_perfectionist = __toESM(eslint_plugin_perfectionist);
|
|
44
44
|
let eslint_plugin_prettier = require("eslint-plugin-prettier");
|
|
45
45
|
eslint_plugin_prettier = __toESM(eslint_plugin_prettier);
|
|
46
|
-
let typescript_eslint = require("typescript-eslint");
|
|
47
|
-
typescript_eslint = __toESM(typescript_eslint);
|
|
48
46
|
let vite_tsconfig_paths = require("vite-tsconfig-paths");
|
|
49
47
|
vite_tsconfig_paths = __toESM(vite_tsconfig_paths);
|
|
50
48
|
let vitest_config = require("vitest/config");
|
|
49
|
+
let typescript_eslint = require("typescript-eslint");
|
|
50
|
+
typescript_eslint = __toESM(typescript_eslint);
|
|
51
51
|
let eslint_plugin_jsx_a11y = require("eslint-plugin-jsx-a11y");
|
|
52
52
|
eslint_plugin_jsx_a11y = __toESM(eslint_plugin_jsx_a11y);
|
|
53
53
|
let eslint_plugin_react = require("eslint-plugin-react");
|
|
@@ -3428,6 +3428,8 @@ var generalRestrictedImports_default = generalRestrictedImports;
|
|
|
3428
3428
|
/**
|
|
3429
3429
|
* Checks if a given node matches the expected object and property names.
|
|
3430
3430
|
*
|
|
3431
|
+
* @category Utility
|
|
3432
|
+
*
|
|
3431
3433
|
* @param node - The node to check.
|
|
3432
3434
|
* @param objectName - The object name to compare against the node.
|
|
3433
3435
|
* @param propertyName - The property name to compare against the node.
|
|
@@ -3444,6 +3446,8 @@ var checkCallExpression_default = checkCallExpression;
|
|
|
3444
3446
|
/**
|
|
3445
3447
|
* Combines multiple option groups for the native ESLint `no-restricted-imports` rule, without overwriting previous configurations.
|
|
3446
3448
|
*
|
|
3449
|
+
* @category Utility
|
|
3450
|
+
*
|
|
3447
3451
|
* @param groups - Option groups to combine, applied in the order provided.
|
|
3448
3452
|
*
|
|
3449
3453
|
* @returns A new object combining all paths and patterns from the given groups, suitable as an option to pass to `no-restricted-imports`.
|
|
@@ -3470,6 +3474,8 @@ var combineRestrictedImports_default = combineRestrictedImports;
|
|
|
3470
3474
|
/**
|
|
3471
3475
|
* Converts a Zod schema to a JSON schema for usage in an ESLint rule.
|
|
3472
3476
|
*
|
|
3477
|
+
* @category Utility
|
|
3478
|
+
*
|
|
3473
3479
|
* @param schema - The Zod schema to convert.
|
|
3474
3480
|
*
|
|
3475
3481
|
* @returns An array containing the resulting JSON Schema, formatted for ESLint rule schema compatibility.
|
|
@@ -3479,6 +3485,26 @@ function createRuleSchemaFromZodSchema(schema$1) {
|
|
|
3479
3485
|
}
|
|
3480
3486
|
var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
|
|
3481
3487
|
|
|
3488
|
+
//#endregion
|
|
3489
|
+
//#region src/utility/public/fixOnCondition.ts
|
|
3490
|
+
/**
|
|
3491
|
+
* Returns a rule fixer function to run based on a given condition
|
|
3492
|
+
*
|
|
3493
|
+
* @category Utility
|
|
3494
|
+
*
|
|
3495
|
+
* @param fixable - Whether the rule should be treated as fixable or not, and therefore whether the fixer should run.
|
|
3496
|
+
* @param fix - The rule fixer function to run.
|
|
3497
|
+
*
|
|
3498
|
+
* @returns The rule fixer function invoked with the fixer, provided the fixable condition is met.
|
|
3499
|
+
*/
|
|
3500
|
+
function fixOnCondition(fixable, fix) {
|
|
3501
|
+
return (fixer) => {
|
|
3502
|
+
if (!fixable) return null;
|
|
3503
|
+
return fix(fixer);
|
|
3504
|
+
};
|
|
3505
|
+
}
|
|
3506
|
+
var fixOnCondition_default = fixOnCondition;
|
|
3507
|
+
|
|
3482
3508
|
//#endregion
|
|
3483
3509
|
//#region src/utility/private/camelToKebab.ts
|
|
3484
3510
|
function camelToKebab(string) {
|
|
@@ -3501,6 +3527,8 @@ var createConfigGroup_default = createConfigGroup;
|
|
|
3501
3527
|
/**
|
|
3502
3528
|
* Takes in a nested group of configs, and returns them flattened according to ESLint config naming conventions.
|
|
3503
3529
|
*
|
|
3530
|
+
* @category Utility
|
|
3531
|
+
*
|
|
3504
3532
|
* @template ConfigObject - The type of the input config object.
|
|
3505
3533
|
*
|
|
3506
3534
|
* @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`).
|
|
@@ -3547,6 +3575,8 @@ var flattenConfigs_default = flattenConfigs;
|
|
|
3547
3575
|
*
|
|
3548
3576
|
* Useful for auto-fixable rules that remove a specific import from an import statement.
|
|
3549
3577
|
*
|
|
3578
|
+
* @category Utility
|
|
3579
|
+
*
|
|
3550
3580
|
* @template RuleOptions - The type of the RuleOptions from the given context.
|
|
3551
3581
|
*
|
|
3552
3582
|
* @param context - The current ESLint rule context.
|
|
@@ -3723,9 +3753,49 @@ const generalJavaScript = [
|
|
|
3723
3753
|
var javaScript_default$1 = generalJavaScript;
|
|
3724
3754
|
|
|
3725
3755
|
//#endregion
|
|
3726
|
-
//#region src/configs/
|
|
3727
|
-
const
|
|
3728
|
-
var
|
|
3756
|
+
//#region src/configs/external/prettierConfig.ts
|
|
3757
|
+
const prettierConfig = { printWidth: 100 };
|
|
3758
|
+
var prettierConfig_default = prettierConfig;
|
|
3759
|
+
|
|
3760
|
+
//#endregion
|
|
3761
|
+
//#region src/configs/external/typeDocConfig.ts
|
|
3762
|
+
function typeDocConfig(entryPoints = ["./src/index.ts"]) {
|
|
3763
|
+
return {
|
|
3764
|
+
disableSources: true,
|
|
3765
|
+
entryPoints,
|
|
3766
|
+
excludeNotDocumented: true,
|
|
3767
|
+
includeVersion: true,
|
|
3768
|
+
outputs: [{
|
|
3769
|
+
name: "html",
|
|
3770
|
+
options: { navigation: {
|
|
3771
|
+
excludeReferences: false,
|
|
3772
|
+
includeCategories: true,
|
|
3773
|
+
includeFolders: true,
|
|
3774
|
+
includeGroups: true
|
|
3775
|
+
} },
|
|
3776
|
+
path: "docs/features/html"
|
|
3777
|
+
}, {
|
|
3778
|
+
name: "markdown",
|
|
3779
|
+
path: "docs/features/markdown"
|
|
3780
|
+
}],
|
|
3781
|
+
plugin: ["typedoc-plugin-markdown", "typedoc-rhineai-theme"]
|
|
3782
|
+
};
|
|
3783
|
+
}
|
|
3784
|
+
var typeDocConfig_default = typeDocConfig;
|
|
3785
|
+
|
|
3786
|
+
//#endregion
|
|
3787
|
+
//#region src/configs/external/vitestConfig.ts
|
|
3788
|
+
function vitestConfig(environment = "jsdom") {
|
|
3789
|
+
return (0, vitest_config.defineConfig)({
|
|
3790
|
+
plugins: [(0, vite_tsconfig_paths.default)()],
|
|
3791
|
+
test: {
|
|
3792
|
+
environment,
|
|
3793
|
+
globals: true,
|
|
3794
|
+
include: ["**/tests/**/*.test.ts"]
|
|
3795
|
+
}
|
|
3796
|
+
});
|
|
3797
|
+
}
|
|
3798
|
+
var vitestConfig_default = vitestConfig;
|
|
3729
3799
|
|
|
3730
3800
|
//#endregion
|
|
3731
3801
|
//#region src/configs/helpers/reactLanguageOptions.ts
|
|
@@ -3736,30 +3806,6 @@ const reactLanguageOptions = {
|
|
|
3736
3806
|
};
|
|
3737
3807
|
var reactLanguageOptions_default = reactLanguageOptions;
|
|
3738
3808
|
|
|
3739
|
-
//#endregion
|
|
3740
|
-
//#region src/configs/helpers/typeDocConfig.ts
|
|
3741
|
-
const typeDocConfig = {
|
|
3742
|
-
disableSources: true,
|
|
3743
|
-
entryPoints: ["./src/index.ts"],
|
|
3744
|
-
excludeNotDocumented: true,
|
|
3745
|
-
includeVersion: true,
|
|
3746
|
-
outputs: [{
|
|
3747
|
-
name: "html",
|
|
3748
|
-
options: { navigation: {
|
|
3749
|
-
excludeReferences: false,
|
|
3750
|
-
includeCategories: true,
|
|
3751
|
-
includeFolders: true,
|
|
3752
|
-
includeGroups: true
|
|
3753
|
-
} },
|
|
3754
|
-
path: "docs/features/html"
|
|
3755
|
-
}, {
|
|
3756
|
-
name: "markdown",
|
|
3757
|
-
path: "docs/features/markdown"
|
|
3758
|
-
}],
|
|
3759
|
-
plugin: ["typedoc-plugin-markdown", "typedoc-rhineai-theme"]
|
|
3760
|
-
};
|
|
3761
|
-
var typeDocConfig_default = typeDocConfig;
|
|
3762
|
-
|
|
3763
3809
|
//#endregion
|
|
3764
3810
|
//#region src/configs/helpers/typeScriptLanguageOptions.ts
|
|
3765
3811
|
const typeScriptLanguageOptions = {
|
|
@@ -3773,20 +3819,6 @@ const typeScriptLanguageOptions = {
|
|
|
3773
3819
|
};
|
|
3774
3820
|
var typeScriptLanguageOptions_default = typeScriptLanguageOptions;
|
|
3775
3821
|
|
|
3776
|
-
//#endregion
|
|
3777
|
-
//#region src/configs/helpers/vitestConfig.ts
|
|
3778
|
-
function vitestConfig(environment = "jsdom") {
|
|
3779
|
-
return (0, vitest_config.defineConfig)({
|
|
3780
|
-
plugins: [(0, vite_tsconfig_paths.default)()],
|
|
3781
|
-
test: {
|
|
3782
|
-
environment,
|
|
3783
|
-
globals: true,
|
|
3784
|
-
include: ["**/tests/**/*.test.ts"]
|
|
3785
|
-
}
|
|
3786
|
-
});
|
|
3787
|
-
}
|
|
3788
|
-
var vitestConfig_default = vitestConfig;
|
|
3789
|
-
|
|
3790
3822
|
//#endregion
|
|
3791
3823
|
//#region src/configs/helpers/sorting/sortClasses.ts
|
|
3792
3824
|
const sortClasses = {
|
|
@@ -3929,7 +3961,7 @@ function personalJavaScript(plugin) {
|
|
|
3929
3961
|
"prefer-arrow-callback": ["error", { allowNamedFunctions: false }],
|
|
3930
3962
|
"prefer-destructuring": "error",
|
|
3931
3963
|
"prefer-template": "error",
|
|
3932
|
-
"prettier/prettier": ["warn",
|
|
3964
|
+
"prettier/prettier": ["warn", prettierConfig_default],
|
|
3933
3965
|
"sort-vars": "error"
|
|
3934
3966
|
}
|
|
3935
3967
|
}, {
|
|
@@ -4391,22 +4423,9 @@ const createRule = _typescript_eslint_utils.ESLintUtils.RuleCreator((ruleName) =
|
|
|
4391
4423
|
});
|
|
4392
4424
|
var createRule_default = createRule;
|
|
4393
4425
|
|
|
4394
|
-
//#endregion
|
|
4395
|
-
//#region src/rules/helpers/fixOnCondition.ts
|
|
4396
|
-
function fixOnCondition(fixable, fix) {
|
|
4397
|
-
return (fixer) => {
|
|
4398
|
-
if (!fixable) return null;
|
|
4399
|
-
return fix(fixer);
|
|
4400
|
-
};
|
|
4401
|
-
}
|
|
4402
|
-
var fixOnCondition_default = fixOnCondition;
|
|
4403
|
-
|
|
4404
4426
|
//#endregion
|
|
4405
4427
|
//#region src/rules/consistent-test-function.ts
|
|
4406
4428
|
const validTestFunctionsSchema = zod.default.enum(["test", "it"]);
|
|
4407
|
-
function parseTestFunction(data) {
|
|
4408
|
-
return validTestFunctionsSchema.parse(data);
|
|
4409
|
-
}
|
|
4410
4429
|
const consistentTestFunctionOptionsSchema = zod.default.object({
|
|
4411
4430
|
preference: validTestFunctionsSchema,
|
|
4412
4431
|
fixable: zod.default.boolean()
|
|
@@ -4802,7 +4821,7 @@ var rules_default = {
|
|
|
4802
4821
|
//#endregion
|
|
4803
4822
|
//#region package.json
|
|
4804
4823
|
var name = "@alextheman/eslint-plugin";
|
|
4805
|
-
var version = "5.
|
|
4824
|
+
var version = "5.4.0";
|
|
4806
4825
|
|
|
4807
4826
|
//#endregion
|
|
4808
4827
|
//#region src/alexPlugin.ts
|
|
@@ -4830,19 +4849,6 @@ exports.default = src_default;
|
|
|
4830
4849
|
exports.fixOnCondition = fixOnCondition_default;
|
|
4831
4850
|
exports.flattenConfigs = flattenConfigs_default;
|
|
4832
4851
|
exports.getImportSpecifiersAfterRemoving = getImportSpecifiersAfterRemoving_default;
|
|
4833
|
-
exports.
|
|
4834
|
-
exports.parseNoNamespaceImportsOptions = parseNoNamespaceImportsOptions;
|
|
4835
|
-
exports.parseNoRelativeImportsOptions = parseNoRelativeImportsOptions;
|
|
4836
|
-
exports.parseStandardiseErrorMessagesOptions = parseStandardiseErrorMessagesOptions;
|
|
4837
|
-
exports.parseTestFunction = parseTestFunction;
|
|
4838
|
-
exports.parseUseNormalizedImportsOptions = parseUseNormalizedImportsOptions;
|
|
4839
|
-
exports.prettierRules = prettierRules_default;
|
|
4840
|
-
exports.reactLanguageOptions = reactLanguageOptions_default;
|
|
4841
|
-
exports.sortClasses = sortClasses_default;
|
|
4842
|
-
exports.sortExports = sortExports_default;
|
|
4843
|
-
exports.sortImports = sortImports_default;
|
|
4844
|
-
exports.sortObjects = sortObjects_default;
|
|
4852
|
+
exports.prettierConfig = prettierConfig_default;
|
|
4845
4853
|
exports.typeDocConfig = typeDocConfig_default;
|
|
4846
|
-
exports.typeScriptLanguageOptions = typeScriptLanguageOptions_default;
|
|
4847
|
-
exports.unusedVarsIgnorePatterns = unusedVarsIgnorePatterns_default;
|
|
4848
4854
|
exports.vitestConfig = vitestConfig_default;
|
package/dist/index.d.cts
CHANGED
|
@@ -4,15 +4,25 @@ import { TypeDocOptions } from "typedoc";
|
|
|
4
4
|
import { PluginOptions } from "typedoc-plugin-markdown";
|
|
5
5
|
import * as vite0 from "vite";
|
|
6
6
|
import { VitestEnvironment } from "vitest/node";
|
|
7
|
-
import { RuleContext, RuleFix, RuleFixer } from "@typescript-eslint/utils/ts-eslint";
|
|
8
|
-
import z from "zod";
|
|
9
7
|
import { TSESTree } from "@typescript-eslint/utils";
|
|
10
8
|
import { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
|
|
9
|
+
import z from "zod";
|
|
10
|
+
import { RuleContext, RuleFix, RuleFixer } from "@typescript-eslint/utils/ts-eslint";
|
|
11
11
|
|
|
12
12
|
//#region src/utility/private/camelToKebab.d.ts
|
|
13
13
|
type CamelToKebab<S extends string> = S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/utility/public/GetFlattenedConfigNames.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* A helper type to turn the keys of a doubly-nested object into a flattened ESLint config key.
|
|
18
|
+
*
|
|
19
|
+
* @category Utility
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* type ConfigNames = GetFlattenedConfigNames<{ general: { typescriptReact }}> // "general/typescript-react"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
16
26
|
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];
|
|
17
27
|
//#endregion
|
|
18
28
|
//#region src/configs/AlexPluginConfigGroup.d.ts
|
|
@@ -49,101 +59,30 @@ interface AlexPlugin {
|
|
|
49
59
|
}
|
|
50
60
|
declare const alexPlugin: AlexPlugin;
|
|
51
61
|
//#endregion
|
|
52
|
-
//#region src/configs/
|
|
53
|
-
declare const
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/configs/helpers/reactLanguageOptions.d.ts
|
|
56
|
-
declare const reactLanguageOptions: Linter.LanguageOptions;
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/configs/helpers/typeDocConfig.d.ts
|
|
59
|
-
declare const typeDocConfig: TypeDocOptions & PluginOptions;
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/configs/helpers/typeScriptLanguageOptions.d.ts
|
|
62
|
-
declare const typeScriptLanguageOptions: Linter.LanguageOptions;
|
|
62
|
+
//#region src/configs/external/prettierConfig.d.ts
|
|
63
|
+
declare const prettierConfig: Config;
|
|
63
64
|
//#endregion
|
|
64
|
-
//#region src/configs/
|
|
65
|
-
declare
|
|
66
|
-
argsIgnorePattern: string;
|
|
67
|
-
caughtErrorsIgnorePattern: string;
|
|
68
|
-
varsIgnorePattern: string;
|
|
69
|
-
};
|
|
65
|
+
//#region src/configs/external/typeDocConfig.d.ts
|
|
66
|
+
declare function typeDocConfig(entryPoints?: string[]): TypeDocOptions & PluginOptions;
|
|
70
67
|
//#endregion
|
|
71
|
-
//#region src/configs/
|
|
68
|
+
//#region src/configs/external/vitestConfig.d.ts
|
|
72
69
|
declare function vitestConfig(environment?: VitestEnvironment): vite0.UserConfig;
|
|
73
70
|
//#endregion
|
|
74
|
-
//#region src/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
type: string;
|
|
88
|
-
};
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/configs/helpers/sorting/sortExports.d.ts
|
|
91
|
-
declare const sortExports: {
|
|
92
|
-
customGroups: never[];
|
|
93
|
-
fallbackSort: {
|
|
94
|
-
type: string;
|
|
95
|
-
};
|
|
96
|
-
groups: string[];
|
|
97
|
-
ignoreCase: boolean;
|
|
98
|
-
newlinesBetween: number;
|
|
99
|
-
order: string;
|
|
100
|
-
partitionByComment: boolean;
|
|
101
|
-
partitionByNewLine: boolean;
|
|
102
|
-
specialCharacters: string;
|
|
103
|
-
type: string;
|
|
104
|
-
};
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/configs/helpers/sorting/sortImports.d.ts
|
|
107
|
-
declare const sortImports: {
|
|
108
|
-
customGroups: ({
|
|
109
|
-
elementNamePattern: string[];
|
|
110
|
-
groupName: string;
|
|
111
|
-
selector?: undefined;
|
|
112
|
-
} | {
|
|
113
|
-
elementNamePattern: string[];
|
|
114
|
-
groupName: string;
|
|
115
|
-
selector: string;
|
|
116
|
-
})[];
|
|
117
|
-
groups: string[];
|
|
118
|
-
ignoreCase: boolean;
|
|
119
|
-
internalPattern: string[];
|
|
120
|
-
newlinesBetween: number;
|
|
121
|
-
order: string;
|
|
122
|
-
partitionByComment: boolean;
|
|
123
|
-
partitionByNewLine: boolean;
|
|
124
|
-
specialCharacters: string;
|
|
125
|
-
type: string;
|
|
126
|
-
};
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region src/configs/helpers/sorting/sortObjects.d.ts
|
|
129
|
-
declare const sortObjects: {
|
|
130
|
-
customGroups: never[];
|
|
131
|
-
fallbackSort: {
|
|
132
|
-
type: string;
|
|
133
|
-
};
|
|
134
|
-
groups: never[];
|
|
135
|
-
ignoreCase: boolean;
|
|
136
|
-
newlinesBetween: string;
|
|
137
|
-
order: string;
|
|
138
|
-
partitionByComment: boolean;
|
|
139
|
-
partitionByNewLine: boolean;
|
|
140
|
-
specialCharacters: string;
|
|
141
|
-
styledComponents: boolean;
|
|
142
|
-
type: string;
|
|
143
|
-
useConfigurationIf: {};
|
|
144
|
-
};
|
|
71
|
+
//#region src/utility/public/checkCallExpression.d.ts
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a given node matches the expected object and property names.
|
|
74
|
+
*
|
|
75
|
+
* @category Utility
|
|
76
|
+
*
|
|
77
|
+
* @param node - The node to check.
|
|
78
|
+
* @param objectName - The object name to compare against the node.
|
|
79
|
+
* @param propertyName - The property name to compare against the node.
|
|
80
|
+
*
|
|
81
|
+
* @returns A value of `true` if the given `objectName` and `propertyName` matches those of the node, and `false` otherwise.
|
|
82
|
+
*/
|
|
83
|
+
declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
|
|
145
84
|
//#endregion
|
|
146
|
-
//#region src/
|
|
85
|
+
//#region src/utility/public/NoRestrictedImportsOptions.d.ts
|
|
147
86
|
interface RestrictedPathImportBase {
|
|
148
87
|
message: string;
|
|
149
88
|
name: string;
|
|
@@ -208,75 +147,19 @@ interface NoRestrictedImportsOptionsPathsAndPatterns {
|
|
|
208
147
|
paths: RestrictedPathImport[];
|
|
209
148
|
patterns: RestrictedPatternImport[];
|
|
210
149
|
}
|
|
211
|
-
type NoRestrictedImportsOptions = NoRestrictedImportsOptionsPathsOnly | NoRestrictedImportsOptionsPatternsOnly | NoRestrictedImportsOptionsPathsAndPatterns;
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region src/rules/consistent-test-function.d.ts
|
|
214
|
-
declare const validTestFunctionsSchema: z.ZodEnum<{
|
|
215
|
-
test: "test";
|
|
216
|
-
it: "it";
|
|
217
|
-
}>;
|
|
218
|
-
type TestFunction = z.infer<typeof validTestFunctionsSchema>;
|
|
219
|
-
declare function parseTestFunction(data: unknown): TestFunction;
|
|
220
|
-
declare const consistentTestFunctionOptionsSchema: z.ZodObject<{
|
|
221
|
-
preference: z.ZodOptional<z.ZodEnum<{
|
|
222
|
-
test: "test";
|
|
223
|
-
it: "it";
|
|
224
|
-
}>>;
|
|
225
|
-
fixable: z.ZodOptional<z.ZodBoolean>;
|
|
226
|
-
}, z.core.$strip>;
|
|
227
|
-
type ConsistentTestFunctionOptions = z.infer<typeof consistentTestFunctionOptionsSchema>;
|
|
228
|
-
declare function parseConsistentTestFunctionOptions(data: unknown): ConsistentTestFunctionOptions;
|
|
229
|
-
//#endregion
|
|
230
|
-
//#region src/rules/helpers/fixOnCondition.d.ts
|
|
231
|
-
type RuleFixerFunction = (fixer: RuleFixer) => RuleFix | null;
|
|
232
|
-
declare function fixOnCondition(fixable: boolean, fix: RuleFixerFunction): RuleFixerFunction;
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region src/rules/no-namespace-imports.d.ts
|
|
235
|
-
declare const noNamespaceImportsOptionsSchema: z.ZodObject<{
|
|
236
|
-
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
237
|
-
}, z.core.$strip>;
|
|
238
|
-
type NoNamespaceImportsOptions = z.infer<typeof noNamespaceImportsOptionsSchema>;
|
|
239
|
-
declare function parseNoNamespaceImportsOptions(data: unknown): NoNamespaceImportsOptions;
|
|
240
|
-
//#endregion
|
|
241
|
-
//#region src/rules/no-relative-imports.d.ts
|
|
242
|
-
declare const noRelativeImportsOptionsSchema: z.ZodObject<{
|
|
243
|
-
depth: z.ZodOptional<z.ZodInt>;
|
|
244
|
-
}, z.core.$strip>;
|
|
245
|
-
type NoRelativeImportsOptions = z.infer<typeof noRelativeImportsOptionsSchema>;
|
|
246
|
-
declare function parseNoRelativeImportsOptions(data: unknown): NoRelativeImportsOptions;
|
|
247
|
-
//#endregion
|
|
248
|
-
//#region src/rules/standardise-error-messages.d.ts
|
|
249
|
-
declare const standardiseErrorMessagesOptionsSchema: z.ZodObject<{
|
|
250
|
-
regex: z.ZodOptional<z.ZodString>;
|
|
251
|
-
}, z.core.$strip>;
|
|
252
|
-
type StandardiseErrorMessagesOptions = z.infer<typeof standardiseErrorMessagesOptionsSchema>;
|
|
253
|
-
declare function parseStandardiseErrorMessagesOptions(data: unknown): StandardiseErrorMessagesOptions;
|
|
254
|
-
//#endregion
|
|
255
|
-
//#region src/rules/use-normalized-imports.d.ts
|
|
256
|
-
declare const useNormalizedImportsOptionsSchema: z.ZodObject<{
|
|
257
|
-
fixable: z.ZodOptional<z.ZodBoolean>;
|
|
258
|
-
}, z.core.$strip>;
|
|
259
|
-
type UseNormalizedImportsOptions = z.infer<typeof useNormalizedImportsOptionsSchema>;
|
|
260
|
-
declare function parseUseNormalizedImportsOptions(data: unknown): {
|
|
261
|
-
fixable?: boolean | undefined;
|
|
262
|
-
};
|
|
263
|
-
//#endregion
|
|
264
|
-
//#region src/utility/public/checkCallExpression.d.ts
|
|
265
150
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* @param node - The node to check.
|
|
269
|
-
* @param objectName - The object name to compare against the node.
|
|
270
|
-
* @param propertyName - The property name to compare against the node.
|
|
151
|
+
* Options for the built-in ESLint `no-restricted-imports` rule.
|
|
271
152
|
*
|
|
272
|
-
*
|
|
153
|
+
* @category Rule Options
|
|
273
154
|
*/
|
|
274
|
-
|
|
155
|
+
type NoRestrictedImportsOptions = NoRestrictedImportsOptionsPathsOnly | NoRestrictedImportsOptionsPatternsOnly | NoRestrictedImportsOptionsPathsAndPatterns;
|
|
275
156
|
//#endregion
|
|
276
157
|
//#region src/utility/public/combineRestrictedImports.d.ts
|
|
277
158
|
/**
|
|
278
159
|
* Combines multiple option groups for the native ESLint `no-restricted-imports` rule, without overwriting previous configurations.
|
|
279
160
|
*
|
|
161
|
+
* @category Utility
|
|
162
|
+
*
|
|
280
163
|
* @param groups - Option groups to combine, applied in the order provided.
|
|
281
164
|
*
|
|
282
165
|
* @returns A new object combining all paths and patterns from the given groups, suitable as an option to pass to `no-restricted-imports`.
|
|
@@ -287,16 +170,34 @@ declare function combineRestrictedImports(...groups: NoRestrictedImportsOptions[
|
|
|
287
170
|
/**
|
|
288
171
|
* Converts a Zod schema to a JSON schema for usage in an ESLint rule.
|
|
289
172
|
*
|
|
173
|
+
* @category Utility
|
|
174
|
+
*
|
|
290
175
|
* @param schema - The Zod schema to convert.
|
|
291
176
|
*
|
|
292
177
|
* @returns An array containing the resulting JSON Schema, formatted for ESLint rule schema compatibility.
|
|
293
178
|
*/
|
|
294
179
|
declare function createRuleSchemaFromZodSchema(schema: z.ZodType): JSONSchema4[];
|
|
295
180
|
//#endregion
|
|
181
|
+
//#region src/utility/public/fixOnCondition.d.ts
|
|
182
|
+
type RuleFixerFunction = (fixer: RuleFixer) => RuleFix | null;
|
|
183
|
+
/**
|
|
184
|
+
* Returns a rule fixer function to run based on a given condition
|
|
185
|
+
*
|
|
186
|
+
* @category Utility
|
|
187
|
+
*
|
|
188
|
+
* @param fixable - Whether the rule should be treated as fixable or not, and therefore whether the fixer should run.
|
|
189
|
+
* @param fix - The rule fixer function to run.
|
|
190
|
+
*
|
|
191
|
+
* @returns The rule fixer function invoked with the fixer, provided the fixable condition is met.
|
|
192
|
+
*/
|
|
193
|
+
declare function fixOnCondition(fixable: boolean, fix: RuleFixerFunction): RuleFixerFunction;
|
|
194
|
+
//#endregion
|
|
296
195
|
//#region src/utility/public/flattenConfigs.d.ts
|
|
297
196
|
/**
|
|
298
197
|
* Takes in a nested group of configs, and returns them flattened according to ESLint config naming conventions.
|
|
299
198
|
*
|
|
199
|
+
* @category Utility
|
|
200
|
+
*
|
|
300
201
|
* @template ConfigObject - The type of the input config object.
|
|
301
202
|
*
|
|
302
203
|
* @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`).
|
|
@@ -337,6 +238,8 @@ declare function flattenConfigs<ConfigObject extends { [K in keyof ConfigObject]
|
|
|
337
238
|
*
|
|
338
239
|
* Useful for auto-fixable rules that remove a specific import from an import statement.
|
|
339
240
|
*
|
|
241
|
+
* @category Utility
|
|
242
|
+
*
|
|
340
243
|
* @template RuleOptions - The type of the RuleOptions from the given context.
|
|
341
244
|
*
|
|
342
245
|
* @param context - The current ESLint rule context.
|
|
@@ -347,4 +250,4 @@ declare function flattenConfigs<ConfigObject extends { [K in keyof ConfigObject]
|
|
|
347
250
|
*/
|
|
348
251
|
declare function getImportSpecifiersAfterRemoving<RuleOptions>(context: Readonly<RuleContext<"message", [RuleOptions]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
|
|
349
252
|
//#endregion
|
|
350
|
-
export { AlexConfigGroupName, AlexFlattenedConfigName, type AlexPlugin, AlexPluginConfigFlattened, AlexPluginConfigObject, CombinedConfig,
|
|
253
|
+
export { AlexConfigGroupName, AlexFlattenedConfigName, type AlexPlugin, AlexPluginConfigFlattened, AlexPluginConfigObject, CombinedConfig, GeneralConfig, type GetFlattenedConfigNames, type NoRestrictedImportsOptions, PersonalConfig, PluginConfig, checkCallExpression, combineRestrictedImports, createRuleSchemaFromZodSchema, alexPlugin as default, fixOnCondition, flattenConfigs, getImportSpecifiersAfterRemoving, prettierConfig, typeDocConfig, vitestConfig };
|