@alextheman/eslint-plugin 3.1.3 → 3.1.5

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
@@ -3751,7 +3751,10 @@ var require_src = __commonJS({
3751
3751
  // src/index.ts
3752
3752
  var index_exports = {};
3753
3753
  __export(index_exports, {
3754
+ checkCallExpression: () => checkCallExpression_default,
3754
3755
  default: () => index_default,
3756
+ fixOnCondition: () => fixOnCondition_default,
3757
+ getImportSpecifiersAfterRemoving: () => getImportSpecifiersAfterRemoving_default,
3755
3758
  parseConsistentTestFunctionOptions: () => parseConsistentTestFunctionOptions,
3756
3759
  parseNoNamespaceImportsOptions: () => parseNoNamespaceImportsOptions,
3757
3760
  parseNoRelativeImportsOptions: () => parseNoRelativeImportsOptions,
@@ -3759,13 +3762,16 @@ __export(index_exports, {
3759
3762
  parseTestFunction: () => parseTestFunction,
3760
3763
  parseUseNormalizedImportsOptions: () => parseUseNormalizedImportsOptions,
3761
3764
  prettierRules: () => prettierRules_default,
3762
- sortObjects: () => sortObjects_default
3765
+ reactLanguageOptions: () => reactLanguageOptions_default,
3766
+ sortObjects: () => sortObjects_default,
3767
+ typeScriptLanguageOptions: () => typeScriptLanguageOptions_default,
3768
+ unusedVarsIgnorePatterns: () => unusedVarsIgnorePatterns_default
3763
3769
  });
3764
3770
  module.exports = __toCommonJS(index_exports);
3765
3771
 
3766
3772
  // package.json
3767
3773
  var name = "@alextheman/eslint-plugin";
3768
- var version = "3.1.3";
3774
+ var version = "3.1.5";
3769
3775
 
3770
3776
  // src/configs/index.ts
3771
3777
  var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
@@ -4969,8 +4975,20 @@ var standardiseErrorMessages = createRule_default({
4969
4975
  var standardise_error_messages_default = standardiseErrorMessages;
4970
4976
 
4971
4977
  // src/rules/use-normalized-imports.ts
4972
- var import_path = __toESM(require("path"), 1);
4973
4978
  var import_zod6 = __toESM(require("zod"), 1);
4979
+
4980
+ // src/utility/normalizeImportPath.ts
4981
+ var import_path = __toESM(require("path"), 1);
4982
+ function normalizeImportPath(importPath) {
4983
+ const normalizedPath = import_path.default.posix.normalize(importPath);
4984
+ if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) {
4985
+ return `./${normalizedPath}`;
4986
+ }
4987
+ return normalizedPath;
4988
+ }
4989
+ var normalizeImportPath_default = normalizeImportPath;
4990
+
4991
+ // src/rules/use-normalized-imports.ts
4974
4992
  var useNormalizedImportsOptionsSchema = import_zod6.default.object({
4975
4993
  fixable: import_zod6.default.boolean()
4976
4994
  }).partial();
@@ -4999,7 +5017,7 @@ var useNormalizedImports = createRule_default({
4999
5017
  );
5000
5018
  return {
5001
5019
  ImportDeclaration(node) {
5002
- const normalizedPath = node.source.value.startsWith("./") ? `./${import_path.default.posix.normalize(node.source.value)}` : import_path.default.posix.normalize(node.source.value);
5020
+ const normalizedPath = normalizeImportPath_default(node.source.value);
5003
5021
  if (node.source.value !== normalizedPath) {
5004
5022
  return context.report({
5005
5023
  node,
@@ -5099,6 +5117,9 @@ var alexPlugin_default = alexPlugin;
5099
5117
  var index_default = alexPlugin_default;
5100
5118
  // Annotate the CommonJS export names for ESM import in node:
5101
5119
  0 && (module.exports = {
5120
+ checkCallExpression,
5121
+ fixOnCondition,
5122
+ getImportSpecifiersAfterRemoving,
5102
5123
  parseConsistentTestFunctionOptions,
5103
5124
  parseNoNamespaceImportsOptions,
5104
5125
  parseNoRelativeImportsOptions,
@@ -5106,5 +5127,8 @@ var index_default = alexPlugin_default;
5106
5127
  parseTestFunction,
5107
5128
  parseUseNormalizedImportsOptions,
5108
5129
  prettierRules,
5109
- sortObjects
5130
+ reactLanguageOptions,
5131
+ sortObjects,
5132
+ typeScriptLanguageOptions,
5133
+ unusedVarsIgnorePatterns
5110
5134
  });
package/dist/index.d.cts CHANGED
@@ -2,9 +2,11 @@ import { Linter } from 'eslint';
2
2
  import { IgnoreCase } from '@alextheman/utility';
3
3
  import { Config } from 'prettier';
4
4
  import z from 'zod';
5
+ import { RuleFixer, RuleFix, RuleContext } from '@typescript-eslint/utils/ts-eslint';
6
+ import { TSESTree } from '@typescript-eslint/utils';
5
7
 
6
8
  var name = "@alextheman/eslint-plugin";
7
- var version = "3.1.3";
9
+ var version = "3.1.5";
8
10
 
9
11
  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;
10
12
 
@@ -38,6 +40,8 @@ declare const alexPlugin: AlexPlugin;
38
40
 
39
41
  declare const prettierRules: Config;
40
42
 
43
+ declare const reactLanguageOptions: Linter.LanguageOptions;
44
+
41
45
  declare const sortObjects: {
42
46
  customGroups: never[];
43
47
  destructuredObjects: boolean;
@@ -58,6 +62,14 @@ declare const sortObjects: {
58
62
  useConfigurationIf: {};
59
63
  };
60
64
 
65
+ declare const typeScriptLanguageOptions: Linter.LanguageOptions;
66
+
67
+ declare const unusedVarsIgnorePatterns: {
68
+ argsIgnorePattern: string;
69
+ caughtErrorsIgnorePattern: string;
70
+ varsIgnorePattern: string;
71
+ };
72
+
61
73
  declare const validTestFunctionsSchema: z.ZodEnum<{
62
74
  test: "test";
63
75
  it: "it";
@@ -74,6 +86,9 @@ declare const consistentTestFunctionOptionsSchema: z.ZodObject<{
74
86
  type ConsistentTestFunctionOptions = z.infer<typeof consistentTestFunctionOptionsSchema>;
75
87
  declare function parseConsistentTestFunctionOptions(data: unknown): ConsistentTestFunctionOptions;
76
88
 
89
+ type RuleFixerFunction = (fixer: RuleFixer) => RuleFix | null;
90
+ declare function fixOnCondition(fixable: boolean, fix: RuleFixerFunction): RuleFixerFunction;
91
+
77
92
  declare const noNamespaceImportsOptionsSchema: z.ZodObject<{
78
93
  allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
94
  }, z.core.$strip>;
@@ -100,4 +115,12 @@ declare function parseUseNormalizedImportsOptions(data: unknown): {
100
115
  fixable?: boolean | undefined;
101
116
  };
102
117
 
103
- export { type AlexPlugin, type AlexPluginConfigGroup, type CombinedConfig, type ConfigGroupName, type ConfigKey, type ConsistentTestFunctionOptions, type GeneralConfig, type NoNamespaceImportsOptions, type NoRelativeImportsOptions, type PersonalConfig, type PluginConfig, type StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, alexPlugin as default, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, sortObjects };
118
+ declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
119
+
120
+ declare function getImportSpecifiersAfterRemoving(context: Readonly<RuleContext<"message", [
121
+ {
122
+ preference: string;
123
+ }
124
+ ]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
125
+
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 StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, checkCallExpression, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
package/dist/index.d.ts CHANGED
@@ -2,9 +2,11 @@ import { Linter } from 'eslint';
2
2
  import { IgnoreCase } from '@alextheman/utility';
3
3
  import { Config } from 'prettier';
4
4
  import z from 'zod';
5
+ import { RuleFixer, RuleFix, RuleContext } from '@typescript-eslint/utils/ts-eslint';
6
+ import { TSESTree } from '@typescript-eslint/utils';
5
7
 
6
8
  var name = "@alextheman/eslint-plugin";
7
- var version = "3.1.3";
9
+ var version = "3.1.5";
8
10
 
9
11
  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;
10
12
 
@@ -38,6 +40,8 @@ declare const alexPlugin: AlexPlugin;
38
40
 
39
41
  declare const prettierRules: Config;
40
42
 
43
+ declare const reactLanguageOptions: Linter.LanguageOptions;
44
+
41
45
  declare const sortObjects: {
42
46
  customGroups: never[];
43
47
  destructuredObjects: boolean;
@@ -58,6 +62,14 @@ declare const sortObjects: {
58
62
  useConfigurationIf: {};
59
63
  };
60
64
 
65
+ declare const typeScriptLanguageOptions: Linter.LanguageOptions;
66
+
67
+ declare const unusedVarsIgnorePatterns: {
68
+ argsIgnorePattern: string;
69
+ caughtErrorsIgnorePattern: string;
70
+ varsIgnorePattern: string;
71
+ };
72
+
61
73
  declare const validTestFunctionsSchema: z.ZodEnum<{
62
74
  test: "test";
63
75
  it: "it";
@@ -74,6 +86,9 @@ declare const consistentTestFunctionOptionsSchema: z.ZodObject<{
74
86
  type ConsistentTestFunctionOptions = z.infer<typeof consistentTestFunctionOptionsSchema>;
75
87
  declare function parseConsistentTestFunctionOptions(data: unknown): ConsistentTestFunctionOptions;
76
88
 
89
+ type RuleFixerFunction = (fixer: RuleFixer) => RuleFix | null;
90
+ declare function fixOnCondition(fixable: boolean, fix: RuleFixerFunction): RuleFixerFunction;
91
+
77
92
  declare const noNamespaceImportsOptionsSchema: z.ZodObject<{
78
93
  allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
94
  }, z.core.$strip>;
@@ -100,4 +115,12 @@ declare function parseUseNormalizedImportsOptions(data: unknown): {
100
115
  fixable?: boolean | undefined;
101
116
  };
102
117
 
103
- export { type AlexPlugin, type AlexPluginConfigGroup, type CombinedConfig, type ConfigGroupName, type ConfigKey, type ConsistentTestFunctionOptions, type GeneralConfig, type NoNamespaceImportsOptions, type NoRelativeImportsOptions, type PersonalConfig, type PluginConfig, type StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, alexPlugin as default, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, sortObjects };
118
+ declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
119
+
120
+ declare function getImportSpecifiersAfterRemoving(context: Readonly<RuleContext<"message", [
121
+ {
122
+ preference: string;
123
+ }
124
+ ]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
125
+
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 StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, checkCallExpression, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns };
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 = "3.1.3";
3747
+ var version = "3.1.5";
3748
3748
 
3749
3749
  // src/configs/index.ts
3750
3750
  import packageJson from "eslint-plugin-package-json";
@@ -4948,8 +4948,20 @@ var standardiseErrorMessages = createRule_default({
4948
4948
  var standardise_error_messages_default = standardiseErrorMessages;
4949
4949
 
4950
4950
  // src/rules/use-normalized-imports.ts
4951
- import path from "path";
4952
4951
  import z6 from "zod";
4952
+
4953
+ // src/utility/normalizeImportPath.ts
4954
+ import path from "path";
4955
+ function normalizeImportPath(importPath) {
4956
+ const normalizedPath = path.posix.normalize(importPath);
4957
+ if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) {
4958
+ return `./${normalizedPath}`;
4959
+ }
4960
+ return normalizedPath;
4961
+ }
4962
+ var normalizeImportPath_default = normalizeImportPath;
4963
+
4964
+ // src/rules/use-normalized-imports.ts
4953
4965
  var useNormalizedImportsOptionsSchema = z6.object({
4954
4966
  fixable: z6.boolean()
4955
4967
  }).partial();
@@ -4978,7 +4990,7 @@ var useNormalizedImports = createRule_default({
4978
4990
  );
4979
4991
  return {
4980
4992
  ImportDeclaration(node) {
4981
- const normalizedPath = node.source.value.startsWith("./") ? `./${path.posix.normalize(node.source.value)}` : path.posix.normalize(node.source.value);
4993
+ const normalizedPath = normalizeImportPath_default(node.source.value);
4982
4994
  if (node.source.value !== normalizedPath) {
4983
4995
  return context.report({
4984
4996
  node,
@@ -5077,7 +5089,10 @@ var alexPlugin_default = alexPlugin;
5077
5089
  // src/index.ts
5078
5090
  var index_default = alexPlugin_default;
5079
5091
  export {
5092
+ checkCallExpression_default as checkCallExpression,
5080
5093
  index_default as default,
5094
+ fixOnCondition_default as fixOnCondition,
5095
+ getImportSpecifiersAfterRemoving_default as getImportSpecifiersAfterRemoving,
5081
5096
  parseConsistentTestFunctionOptions,
5082
5097
  parseNoNamespaceImportsOptions,
5083
5098
  parseNoRelativeImportsOptions,
@@ -5085,5 +5100,8 @@ export {
5085
5100
  parseTestFunction,
5086
5101
  parseUseNormalizedImportsOptions,
5087
5102
  prettierRules_default as prettierRules,
5088
- sortObjects_default as sortObjects
5103
+ reactLanguageOptions_default as reactLanguageOptions,
5104
+ sortObjects_default as sortObjects,
5105
+ typeScriptLanguageOptions_default as typeScriptLanguageOptions,
5106
+ unusedVarsIgnorePatterns_default as unusedVarsIgnorePatterns
5089
5107
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/eslint-plugin",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "A package to provide custom ESLint rules and configs",
5
5
  "repository": {
6
6
  "type": "git",