@alextheman/eslint-plugin 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +34 -27
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +31 -26
- package/package.json +6 -3
package/dist/index.cjs
CHANGED
|
@@ -3752,6 +3752,7 @@ var require_src = __commonJS({
|
|
|
3752
3752
|
var index_exports = {};
|
|
3753
3753
|
__export(index_exports, {
|
|
3754
3754
|
checkCallExpression: () => checkCallExpression_default,
|
|
3755
|
+
createRuleSchemaFromZodSchema: () => createRuleSchemaFromZodSchema_default,
|
|
3755
3756
|
default: () => index_default,
|
|
3756
3757
|
fixOnCondition: () => fixOnCondition_default,
|
|
3757
3758
|
getImportSpecifiersAfterRemoving: () => getImportSpecifiersAfterRemoving_default,
|
|
@@ -3765,13 +3766,14 @@ __export(index_exports, {
|
|
|
3765
3766
|
reactLanguageOptions: () => reactLanguageOptions_default,
|
|
3766
3767
|
sortObjects: () => sortObjects_default,
|
|
3767
3768
|
typeScriptLanguageOptions: () => typeScriptLanguageOptions_default,
|
|
3768
|
-
unusedVarsIgnorePatterns: () => unusedVarsIgnorePatterns_default
|
|
3769
|
+
unusedVarsIgnorePatterns: () => unusedVarsIgnorePatterns_default,
|
|
3770
|
+
vitestConfig: () => vitestConfig_default
|
|
3769
3771
|
});
|
|
3770
3772
|
module.exports = __toCommonJS(index_exports);
|
|
3771
3773
|
|
|
3772
3774
|
// package.json
|
|
3773
3775
|
var name = "@alextheman/eslint-plugin";
|
|
3774
|
-
var version = "4.
|
|
3776
|
+
var version = "4.1.0";
|
|
3775
3777
|
|
|
3776
3778
|
// src/configs/personal/testsBase.ts
|
|
3777
3779
|
var import_globals = __toESM(require_globals2(), 1);
|
|
@@ -4526,13 +4528,13 @@ function fixOnCondition(fixable, fix) {
|
|
|
4526
4528
|
}
|
|
4527
4529
|
var fixOnCondition_default = fixOnCondition;
|
|
4528
4530
|
|
|
4529
|
-
// src/utility/
|
|
4531
|
+
// src/utility/createRuleSchemaFromZodSchema.ts
|
|
4530
4532
|
var import_utility4 = require("@alextheman/utility");
|
|
4531
4533
|
var import_zod = __toESM(require("zod"), 1);
|
|
4532
|
-
function
|
|
4534
|
+
function createRuleSchemaFromZodSchema(schema5) {
|
|
4533
4535
|
return [(0, import_utility4.omitProperties)(import_zod.default.toJSONSchema(schema5), "$schema")];
|
|
4534
4536
|
}
|
|
4535
|
-
var
|
|
4537
|
+
var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
|
|
4536
4538
|
|
|
4537
4539
|
// src/utility/getImportSpecifiersAfterRemoving.ts
|
|
4538
4540
|
function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
|
|
@@ -4568,7 +4570,7 @@ var consistentTestFunction = createRule_default({
|
|
|
4568
4570
|
},
|
|
4569
4571
|
type: "suggestion",
|
|
4570
4572
|
fixable: "code",
|
|
4571
|
-
schema:
|
|
4573
|
+
schema: createRuleSchemaFromZodSchema_default(consistentTestFunctionOptionsSchema)
|
|
4572
4574
|
},
|
|
4573
4575
|
defaultOptions: [defaultOptions],
|
|
4574
4576
|
create(context) {
|
|
@@ -4725,7 +4727,7 @@ var noNamespaceImportsOptionsSchema = import_zod3.default.object({
|
|
|
4725
4727
|
function parseNoNamespaceImportsOptions(data) {
|
|
4726
4728
|
return noNamespaceImportsOptionsSchema.parse(data);
|
|
4727
4729
|
}
|
|
4728
|
-
var schema =
|
|
4730
|
+
var schema = createRuleSchemaFromZodSchema_default(noNamespaceImportsOptionsSchema);
|
|
4729
4731
|
var noNamespaceImports = createRule_default({
|
|
4730
4732
|
name: "no-namespace-imports",
|
|
4731
4733
|
meta: {
|
|
@@ -4806,7 +4808,7 @@ var noRelativeImportsOptionsSchema = import_zod4.default.object({
|
|
|
4806
4808
|
function parseNoRelativeImportsOptions(data) {
|
|
4807
4809
|
return noRelativeImportsOptionsSchema.parse(data);
|
|
4808
4810
|
}
|
|
4809
|
-
var schema2 =
|
|
4811
|
+
var schema2 = createRuleSchemaFromZodSchema_default(noRelativeImportsOptionsSchema);
|
|
4810
4812
|
var noRelativeImports = createRule_default({
|
|
4811
4813
|
name: "no-relative-imports",
|
|
4812
4814
|
meta: {
|
|
@@ -4933,7 +4935,7 @@ var standardiseErrorMessagesOptionsSchema = import_zod5.default.object({
|
|
|
4933
4935
|
function parseStandardiseErrorMessagesOptions(data) {
|
|
4934
4936
|
return standardiseErrorMessagesOptionsSchema.parse(data);
|
|
4935
4937
|
}
|
|
4936
|
-
var schema3 =
|
|
4938
|
+
var schema3 = createRuleSchemaFromZodSchema_default(standardiseErrorMessagesOptionsSchema);
|
|
4937
4939
|
var defaultErrorRegex = "^[A-Z]+(?:_[A-Z]+)*$";
|
|
4938
4940
|
function checkCurrentNode(context, node) {
|
|
4939
4941
|
var _a;
|
|
@@ -4982,32 +4984,20 @@ var standardiseErrorMessages = createRule_default({
|
|
|
4982
4984
|
var standardise_error_messages_default = standardiseErrorMessages;
|
|
4983
4985
|
|
|
4984
4986
|
// src/rules/use-normalized-imports.ts
|
|
4987
|
+
var import_utility5 = require("@alextheman/utility");
|
|
4985
4988
|
var import_zod6 = __toESM(require("zod"), 1);
|
|
4986
|
-
|
|
4987
|
-
// src/utility/normalizeImportPath.ts
|
|
4988
|
-
var import_path = __toESM(require("path"), 1);
|
|
4989
|
-
function normalizeImportPath(importPath) {
|
|
4990
|
-
const normalizedPath = import_path.default.posix.normalize(importPath);
|
|
4991
|
-
if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) {
|
|
4992
|
-
return `./${normalizedPath}`;
|
|
4993
|
-
}
|
|
4994
|
-
return normalizedPath;
|
|
4995
|
-
}
|
|
4996
|
-
var normalizeImportPath_default = normalizeImportPath;
|
|
4997
|
-
|
|
4998
|
-
// src/rules/use-normalized-imports.ts
|
|
4999
4989
|
var useNormalizedImportsOptionsSchema = import_zod6.default.object({
|
|
5000
4990
|
fixable: import_zod6.default.boolean()
|
|
5001
4991
|
}).partial();
|
|
5002
4992
|
function parseUseNormalizedImportsOptions(data) {
|
|
5003
4993
|
return useNormalizedImportsOptionsSchema.parse(data);
|
|
5004
4994
|
}
|
|
5005
|
-
var schema4 =
|
|
4995
|
+
var schema4 = createRuleSchemaFromZodSchema_default(useNormalizedImportsOptionsSchema);
|
|
5006
4996
|
var useNormalizedImports = createRule_default({
|
|
5007
4997
|
name: "use-normalized-imports",
|
|
5008
4998
|
meta: {
|
|
5009
4999
|
docs: {
|
|
5010
|
-
description: "Enforce the usage of
|
|
5000
|
+
description: "Enforce the usage of normalized imports (i.e. import paths that you would only get from path.posix.normalize())"
|
|
5011
5001
|
},
|
|
5012
5002
|
messages: {
|
|
5013
5003
|
pathNotNormalized: "Import path {{nonNormalized}} is not normalised. Please use {{normalized}} instead."
|
|
@@ -5024,7 +5014,7 @@ var useNormalizedImports = createRule_default({
|
|
|
5024
5014
|
);
|
|
5025
5015
|
return {
|
|
5026
5016
|
ImportDeclaration(node) {
|
|
5027
|
-
const normalizedPath =
|
|
5017
|
+
const normalizedPath = (0, import_utility5.normalizeImportPath)(node.source.value);
|
|
5028
5018
|
if (node.source.value !== normalizedPath) {
|
|
5029
5019
|
return context.report({
|
|
5030
5020
|
node,
|
|
@@ -5065,7 +5055,7 @@ var useObjectShorthand = createRule_default({
|
|
|
5065
5055
|
},
|
|
5066
5056
|
type: "suggestion",
|
|
5067
5057
|
fixable: "code",
|
|
5068
|
-
schema:
|
|
5058
|
+
schema: createRuleSchemaFromZodSchema_default(useObjectShorthandOptionsSchema)
|
|
5069
5059
|
},
|
|
5070
5060
|
defaultOptions: [{ fixable: true }],
|
|
5071
5061
|
create(context) {
|
|
@@ -5120,11 +5110,27 @@ var alexPlugin = {
|
|
|
5120
5110
|
alexPlugin.configs = configs_default(alexPlugin);
|
|
5121
5111
|
var alexPlugin_default = alexPlugin;
|
|
5122
5112
|
|
|
5113
|
+
// src/configs/helpers/vitestConfig.ts
|
|
5114
|
+
var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"), 1);
|
|
5115
|
+
var import_config = require("vitest/config");
|
|
5116
|
+
function vitestConfig(environment = "jsdom") {
|
|
5117
|
+
return (0, import_config.defineConfig)({
|
|
5118
|
+
plugins: [(0, import_vite_tsconfig_paths.default)()],
|
|
5119
|
+
test: {
|
|
5120
|
+
environment,
|
|
5121
|
+
globals: true,
|
|
5122
|
+
include: ["**/tests/**/*.test.ts"]
|
|
5123
|
+
}
|
|
5124
|
+
});
|
|
5125
|
+
}
|
|
5126
|
+
var vitestConfig_default = vitestConfig;
|
|
5127
|
+
|
|
5123
5128
|
// src/index.ts
|
|
5124
5129
|
var index_default = alexPlugin_default;
|
|
5125
5130
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5126
5131
|
0 && (module.exports = {
|
|
5127
5132
|
checkCallExpression,
|
|
5133
|
+
createRuleSchemaFromZodSchema,
|
|
5128
5134
|
fixOnCondition,
|
|
5129
5135
|
getImportSpecifiersAfterRemoving,
|
|
5130
5136
|
parseConsistentTestFunctionOptions,
|
|
@@ -5137,5 +5143,6 @@ var index_default = alexPlugin_default;
|
|
|
5137
5143
|
reactLanguageOptions,
|
|
5138
5144
|
sortObjects,
|
|
5139
5145
|
typeScriptLanguageOptions,
|
|
5140
|
-
unusedVarsIgnorePatterns
|
|
5146
|
+
unusedVarsIgnorePatterns,
|
|
5147
|
+
vitestConfig
|
|
5141
5148
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
import { IgnoreCase } from '@alextheman/utility';
|
|
3
3
|
import { Config } from 'prettier';
|
|
4
|
+
import * as vite from 'vite';
|
|
5
|
+
import { VitestEnvironment } from 'vitest/node';
|
|
4
6
|
import z from 'zod';
|
|
5
7
|
import { RuleFixer, RuleFix, RuleContext } from '@typescript-eslint/utils/ts-eslint';
|
|
6
8
|
import { TSESTree } from '@typescript-eslint/utils';
|
|
9
|
+
import { JSONSchema4 } from '@typescript-eslint/utils/json-schema';
|
|
7
10
|
|
|
8
11
|
var name = "@alextheman/eslint-plugin";
|
|
9
|
-
var version = "4.
|
|
12
|
+
var version = "4.1.0";
|
|
10
13
|
|
|
11
14
|
type CamelToKebab<S extends string> = S extends `${IgnoreCase<"J">}avaScript${infer Rest}` ? Rest extends "" ? "javascript" : `javascript${CamelToKebab<Rest>}` : S extends `${IgnoreCase<"T">}ypeScript${infer Rest}` ? Rest extends "" ? "typescript" : `typescript${CamelToKebab<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
|
|
12
15
|
|
|
@@ -70,6 +73,8 @@ declare const unusedVarsIgnorePatterns: {
|
|
|
70
73
|
varsIgnorePattern: string;
|
|
71
74
|
};
|
|
72
75
|
|
|
76
|
+
declare function vitestConfig(environment?: VitestEnvironment): vite.UserConfig;
|
|
77
|
+
|
|
73
78
|
declare const validTestFunctionsSchema: z.ZodEnum<{
|
|
74
79
|
test: "test";
|
|
75
80
|
it: "it";
|
|
@@ -117,10 +122,12 @@ declare function parseUseNormalizedImportsOptions(data: unknown): {
|
|
|
117
122
|
|
|
118
123
|
declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
|
|
119
124
|
|
|
125
|
+
declare function createRuleSchemaFromZodSchema(schema: z.ZodType): JSONSchema4[];
|
|
126
|
+
|
|
120
127
|
declare function getImportSpecifiersAfterRemoving(context: Readonly<RuleContext<"message", [
|
|
121
128
|
{
|
|
122
129
|
preference: string;
|
|
123
130
|
}
|
|
124
131
|
]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
|
|
125
132
|
|
|
126
|
-
export { type AlexPlugin, type AlexPluginConfigGroup, type CombinedConfig, type ConfigGroupName, type ConfigKey, type ConsistentTestFunctionOptions, type GeneralConfig, type NoNamespaceImportsOptions, type NoRelativeImportsOptions, type PersonalConfig, type PluginConfig, type RuleFixerFunction, type StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, checkCallExpression, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
|
|
133
|
+
export { type AlexPlugin, type AlexPluginConfigGroup, type CombinedConfig, type ConfigGroupName, type ConfigKey, type ConsistentTestFunctionOptions, type GeneralConfig, type NoNamespaceImportsOptions, type NoRelativeImportsOptions, type PersonalConfig, type PluginConfig, type RuleFixerFunction, type StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, checkCallExpression, createRuleSchemaFromZodSchema, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns, vitestConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
import { IgnoreCase } from '@alextheman/utility';
|
|
3
3
|
import { Config } from 'prettier';
|
|
4
|
+
import * as vite from 'vite';
|
|
5
|
+
import { VitestEnvironment } from 'vitest/node';
|
|
4
6
|
import z from 'zod';
|
|
5
7
|
import { RuleFixer, RuleFix, RuleContext } from '@typescript-eslint/utils/ts-eslint';
|
|
6
8
|
import { TSESTree } from '@typescript-eslint/utils';
|
|
9
|
+
import { JSONSchema4 } from '@typescript-eslint/utils/json-schema';
|
|
7
10
|
|
|
8
11
|
var name = "@alextheman/eslint-plugin";
|
|
9
|
-
var version = "4.
|
|
12
|
+
var version = "4.1.0";
|
|
10
13
|
|
|
11
14
|
type CamelToKebab<S extends string> = S extends `${IgnoreCase<"J">}avaScript${infer Rest}` ? Rest extends "" ? "javascript" : `javascript${CamelToKebab<Rest>}` : S extends `${IgnoreCase<"T">}ypeScript${infer Rest}` ? Rest extends "" ? "typescript" : `typescript${CamelToKebab<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
|
|
12
15
|
|
|
@@ -70,6 +73,8 @@ declare const unusedVarsIgnorePatterns: {
|
|
|
70
73
|
varsIgnorePattern: string;
|
|
71
74
|
};
|
|
72
75
|
|
|
76
|
+
declare function vitestConfig(environment?: VitestEnvironment): vite.UserConfig;
|
|
77
|
+
|
|
73
78
|
declare const validTestFunctionsSchema: z.ZodEnum<{
|
|
74
79
|
test: "test";
|
|
75
80
|
it: "it";
|
|
@@ -117,10 +122,12 @@ declare function parseUseNormalizedImportsOptions(data: unknown): {
|
|
|
117
122
|
|
|
118
123
|
declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
|
|
119
124
|
|
|
125
|
+
declare function createRuleSchemaFromZodSchema(schema: z.ZodType): JSONSchema4[];
|
|
126
|
+
|
|
120
127
|
declare function getImportSpecifiersAfterRemoving(context: Readonly<RuleContext<"message", [
|
|
121
128
|
{
|
|
122
129
|
preference: string;
|
|
123
130
|
}
|
|
124
131
|
]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
|
|
125
132
|
|
|
126
|
-
export { type AlexPlugin, type AlexPluginConfigGroup, type CombinedConfig, type ConfigGroupName, type ConfigKey, type ConsistentTestFunctionOptions, type GeneralConfig, type NoNamespaceImportsOptions, type NoRelativeImportsOptions, type PersonalConfig, type PluginConfig, type RuleFixerFunction, type StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, checkCallExpression, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
|
|
133
|
+
export { type AlexPlugin, type AlexPluginConfigGroup, type CombinedConfig, type ConfigGroupName, type ConfigKey, type ConsistentTestFunctionOptions, type GeneralConfig, type NoNamespaceImportsOptions, type NoRelativeImportsOptions, type PersonalConfig, type PluginConfig, type RuleFixerFunction, type StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, checkCallExpression, createRuleSchemaFromZodSchema, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns, vitestConfig };
|
package/dist/index.js
CHANGED
|
@@ -3744,7 +3744,7 @@ var require_src = __commonJS({
|
|
|
3744
3744
|
|
|
3745
3745
|
// package.json
|
|
3746
3746
|
var name = "@alextheman/eslint-plugin";
|
|
3747
|
-
var version = "4.
|
|
3747
|
+
var version = "4.1.0";
|
|
3748
3748
|
|
|
3749
3749
|
// src/configs/personal/testsBase.ts
|
|
3750
3750
|
var import_globals = __toESM(require_globals2(), 1);
|
|
@@ -4499,13 +4499,13 @@ function fixOnCondition(fixable, fix) {
|
|
|
4499
4499
|
}
|
|
4500
4500
|
var fixOnCondition_default = fixOnCondition;
|
|
4501
4501
|
|
|
4502
|
-
// src/utility/
|
|
4502
|
+
// src/utility/createRuleSchemaFromZodSchema.ts
|
|
4503
4503
|
import { omitProperties as omitProperties2 } from "@alextheman/utility";
|
|
4504
4504
|
import z from "zod";
|
|
4505
|
-
function
|
|
4505
|
+
function createRuleSchemaFromZodSchema(schema5) {
|
|
4506
4506
|
return [omitProperties2(z.toJSONSchema(schema5), "$schema")];
|
|
4507
4507
|
}
|
|
4508
|
-
var
|
|
4508
|
+
var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
|
|
4509
4509
|
|
|
4510
4510
|
// src/utility/getImportSpecifiersAfterRemoving.ts
|
|
4511
4511
|
function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
|
|
@@ -4541,7 +4541,7 @@ var consistentTestFunction = createRule_default({
|
|
|
4541
4541
|
},
|
|
4542
4542
|
type: "suggestion",
|
|
4543
4543
|
fixable: "code",
|
|
4544
|
-
schema:
|
|
4544
|
+
schema: createRuleSchemaFromZodSchema_default(consistentTestFunctionOptionsSchema)
|
|
4545
4545
|
},
|
|
4546
4546
|
defaultOptions: [defaultOptions],
|
|
4547
4547
|
create(context) {
|
|
@@ -4698,7 +4698,7 @@ var noNamespaceImportsOptionsSchema = z3.object({
|
|
|
4698
4698
|
function parseNoNamespaceImportsOptions(data) {
|
|
4699
4699
|
return noNamespaceImportsOptionsSchema.parse(data);
|
|
4700
4700
|
}
|
|
4701
|
-
var schema =
|
|
4701
|
+
var schema = createRuleSchemaFromZodSchema_default(noNamespaceImportsOptionsSchema);
|
|
4702
4702
|
var noNamespaceImports = createRule_default({
|
|
4703
4703
|
name: "no-namespace-imports",
|
|
4704
4704
|
meta: {
|
|
@@ -4779,7 +4779,7 @@ var noRelativeImportsOptionsSchema = z4.object({
|
|
|
4779
4779
|
function parseNoRelativeImportsOptions(data) {
|
|
4780
4780
|
return noRelativeImportsOptionsSchema.parse(data);
|
|
4781
4781
|
}
|
|
4782
|
-
var schema2 =
|
|
4782
|
+
var schema2 = createRuleSchemaFromZodSchema_default(noRelativeImportsOptionsSchema);
|
|
4783
4783
|
var noRelativeImports = createRule_default({
|
|
4784
4784
|
name: "no-relative-imports",
|
|
4785
4785
|
meta: {
|
|
@@ -4906,7 +4906,7 @@ var standardiseErrorMessagesOptionsSchema = z5.object({
|
|
|
4906
4906
|
function parseStandardiseErrorMessagesOptions(data) {
|
|
4907
4907
|
return standardiseErrorMessagesOptionsSchema.parse(data);
|
|
4908
4908
|
}
|
|
4909
|
-
var schema3 =
|
|
4909
|
+
var schema3 = createRuleSchemaFromZodSchema_default(standardiseErrorMessagesOptionsSchema);
|
|
4910
4910
|
var defaultErrorRegex = "^[A-Z]+(?:_[A-Z]+)*$";
|
|
4911
4911
|
function checkCurrentNode(context, node) {
|
|
4912
4912
|
var _a;
|
|
@@ -4955,32 +4955,20 @@ var standardiseErrorMessages = createRule_default({
|
|
|
4955
4955
|
var standardise_error_messages_default = standardiseErrorMessages;
|
|
4956
4956
|
|
|
4957
4957
|
// src/rules/use-normalized-imports.ts
|
|
4958
|
+
import { normalizeImportPath } from "@alextheman/utility";
|
|
4958
4959
|
import z6 from "zod";
|
|
4959
|
-
|
|
4960
|
-
// src/utility/normalizeImportPath.ts
|
|
4961
|
-
import path from "path";
|
|
4962
|
-
function normalizeImportPath(importPath) {
|
|
4963
|
-
const normalizedPath = path.posix.normalize(importPath);
|
|
4964
|
-
if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) {
|
|
4965
|
-
return `./${normalizedPath}`;
|
|
4966
|
-
}
|
|
4967
|
-
return normalizedPath;
|
|
4968
|
-
}
|
|
4969
|
-
var normalizeImportPath_default = normalizeImportPath;
|
|
4970
|
-
|
|
4971
|
-
// src/rules/use-normalized-imports.ts
|
|
4972
4960
|
var useNormalizedImportsOptionsSchema = z6.object({
|
|
4973
4961
|
fixable: z6.boolean()
|
|
4974
4962
|
}).partial();
|
|
4975
4963
|
function parseUseNormalizedImportsOptions(data) {
|
|
4976
4964
|
return useNormalizedImportsOptionsSchema.parse(data);
|
|
4977
4965
|
}
|
|
4978
|
-
var schema4 =
|
|
4966
|
+
var schema4 = createRuleSchemaFromZodSchema_default(useNormalizedImportsOptionsSchema);
|
|
4979
4967
|
var useNormalizedImports = createRule_default({
|
|
4980
4968
|
name: "use-normalized-imports",
|
|
4981
4969
|
meta: {
|
|
4982
4970
|
docs: {
|
|
4983
|
-
description: "Enforce the usage of
|
|
4971
|
+
description: "Enforce the usage of normalized imports (i.e. import paths that you would only get from path.posix.normalize())"
|
|
4984
4972
|
},
|
|
4985
4973
|
messages: {
|
|
4986
4974
|
pathNotNormalized: "Import path {{nonNormalized}} is not normalised. Please use {{normalized}} instead."
|
|
@@ -4997,7 +4985,7 @@ var useNormalizedImports = createRule_default({
|
|
|
4997
4985
|
);
|
|
4998
4986
|
return {
|
|
4999
4987
|
ImportDeclaration(node) {
|
|
5000
|
-
const normalizedPath =
|
|
4988
|
+
const normalizedPath = normalizeImportPath(node.source.value);
|
|
5001
4989
|
if (node.source.value !== normalizedPath) {
|
|
5002
4990
|
return context.report({
|
|
5003
4991
|
node,
|
|
@@ -5038,7 +5026,7 @@ var useObjectShorthand = createRule_default({
|
|
|
5038
5026
|
},
|
|
5039
5027
|
type: "suggestion",
|
|
5040
5028
|
fixable: "code",
|
|
5041
|
-
schema:
|
|
5029
|
+
schema: createRuleSchemaFromZodSchema_default(useObjectShorthandOptionsSchema)
|
|
5042
5030
|
},
|
|
5043
5031
|
defaultOptions: [{ fixable: true }],
|
|
5044
5032
|
create(context) {
|
|
@@ -5093,10 +5081,26 @@ var alexPlugin = {
|
|
|
5093
5081
|
alexPlugin.configs = configs_default(alexPlugin);
|
|
5094
5082
|
var alexPlugin_default = alexPlugin;
|
|
5095
5083
|
|
|
5084
|
+
// src/configs/helpers/vitestConfig.ts
|
|
5085
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
5086
|
+
import { defineConfig } from "vitest/config";
|
|
5087
|
+
function vitestConfig(environment = "jsdom") {
|
|
5088
|
+
return defineConfig({
|
|
5089
|
+
plugins: [tsconfigPaths()],
|
|
5090
|
+
test: {
|
|
5091
|
+
environment,
|
|
5092
|
+
globals: true,
|
|
5093
|
+
include: ["**/tests/**/*.test.ts"]
|
|
5094
|
+
}
|
|
5095
|
+
});
|
|
5096
|
+
}
|
|
5097
|
+
var vitestConfig_default = vitestConfig;
|
|
5098
|
+
|
|
5096
5099
|
// src/index.ts
|
|
5097
5100
|
var index_default = alexPlugin_default;
|
|
5098
5101
|
export {
|
|
5099
5102
|
checkCallExpression_default as checkCallExpression,
|
|
5103
|
+
createRuleSchemaFromZodSchema_default as createRuleSchemaFromZodSchema,
|
|
5100
5104
|
index_default as default,
|
|
5101
5105
|
fixOnCondition_default as fixOnCondition,
|
|
5102
5106
|
getImportSpecifiersAfterRemoving_default as getImportSpecifiersAfterRemoving,
|
|
@@ -5110,5 +5114,6 @@ export {
|
|
|
5110
5114
|
reactLanguageOptions_default as reactLanguageOptions,
|
|
5111
5115
|
sortObjects_default as sortObjects,
|
|
5112
5116
|
typeScriptLanguageOptions_default as typeScriptLanguageOptions,
|
|
5113
|
-
unusedVarsIgnorePatterns_default as unusedVarsIgnorePatterns
|
|
5117
|
+
unusedVarsIgnorePatterns_default as unusedVarsIgnorePatterns,
|
|
5118
|
+
vitestConfig_default as vitestConfig
|
|
5114
5119
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/eslint-plugin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "A package to provide custom ESLint rules and configs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"update-peer-dependencies": "bash -c 'npx npm-check-updates --dep peer -u \"$@\" && npm install' --"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@alextheman/utility": "^2.
|
|
43
|
+
"@alextheman/utility": "^2.20.0",
|
|
44
44
|
"@typescript-eslint/utils": "^8.47.0",
|
|
45
45
|
"common-tags": "^1.8.2",
|
|
46
46
|
"zod": "^4.1.12"
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
65
65
|
"globals": "^16.5.0",
|
|
66
66
|
"husky": "^9.1.7",
|
|
67
|
+
"jsdom": "^27.2.0",
|
|
67
68
|
"prettier": "^3.6.2",
|
|
68
69
|
"tsup": "^8.5.1",
|
|
69
70
|
"tsx": "^4.20.6",
|
|
@@ -84,6 +85,8 @@
|
|
|
84
85
|
"eslint-plugin-react": ">=7.0.0",
|
|
85
86
|
"eslint-plugin-react-hooks": ">=7.0.0",
|
|
86
87
|
"eslint-plugin-react-refresh": ">=0.4.0",
|
|
87
|
-
"typescript-eslint": ">=8.0.0"
|
|
88
|
+
"typescript-eslint": ">=8.0.0",
|
|
89
|
+
"vite-tsconfig-paths": ">=5.1.4",
|
|
90
|
+
"vitest": ">=4.0.13"
|
|
88
91
|
}
|
|
89
92
|
}
|