@alextheman/eslint-plugin 2.8.0 → 2.8.2

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
@@ -3759,7 +3759,7 @@ module.exports = __toCommonJS(index_exports);
3759
3759
 
3760
3760
  // package.json
3761
3761
  var name = "@alextheman/eslint-plugin";
3762
- var version = "2.8.0";
3762
+ var version = "2.8.2";
3763
3763
 
3764
3764
  // src/configs/index.ts
3765
3765
  var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
@@ -3833,7 +3833,10 @@ function createPluginTestsBaseConfig(plugin) {
3833
3833
  "@alextheman": plugin
3834
3834
  },
3835
3835
  rules: {
3836
- "@alextheman/consistent-test-function": ["error", { preference: "test" }],
3836
+ "@alextheman/consistent-test-function": [
3837
+ "error",
3838
+ { preference: "test" }
3839
+ ],
3837
3840
  "@alextheman/no-isolated-tests": "error",
3838
3841
  "@alextheman/no-skipped-tests": "warn"
3839
3842
  }
@@ -3864,6 +3867,14 @@ var javaScriptLanguageOptions = {
3864
3867
  };
3865
3868
  var javaScriptLanguageOptions_default = javaScriptLanguageOptions;
3866
3869
 
3870
+ // src/configs/miscellaneous/unusedVarsIgnorePatterns.ts
3871
+ var unusedVarsIgnorePatterns = {
3872
+ argsIgnorePattern: "^_",
3873
+ caughtErrorsIgnorePattern: "^_",
3874
+ varsIgnorePattern: "^_"
3875
+ };
3876
+ var unusedVarsIgnorePatterns_default = unusedVarsIgnorePatterns;
3877
+
3867
3878
  // src/configs/general/javaScriptBase.ts
3868
3879
  var javaScriptBase = [
3869
3880
  import_js.default.configs.recommended,
@@ -3897,14 +3908,7 @@ var javaScriptBase = [
3897
3908
  }
3898
3909
  ],
3899
3910
  "no-undef": "error",
3900
- "no-unused-vars": [
3901
- "error",
3902
- {
3903
- argsIgnorePattern: "^_",
3904
- caughtErrorsIgnorePattern: "^_",
3905
- varsIgnorePattern: "^_"
3906
- }
3907
- ],
3911
+ "no-unused-vars": ["error", unusedVarsIgnorePatterns_default],
3908
3912
  "no-useless-rename": "error",
3909
3913
  "no-useless-return": "error",
3910
3914
  "prefer-const": "error"
@@ -4135,26 +4139,15 @@ var typeScriptBase = [
4135
4139
  "@typescript-eslint/explicit-member-accessibility": "error",
4136
4140
  "@typescript-eslint/no-deprecated": "warn",
4137
4141
  "@typescript-eslint/no-redeclare": ["error", { ignoreDeclarationMerge: true }],
4138
- "@typescript-eslint/no-unused-vars": [
4139
- "error",
4140
- {
4141
- argsIgnorePattern: "^_",
4142
- caughtErrorsIgnorePattern: "^_",
4143
- varsIgnorePattern: "^_"
4144
- }
4145
- ],
4142
+ "@typescript-eslint/no-unused-vars": ["error", unusedVarsIgnorePatterns_default],
4143
+ // Disable import/no-unresolved (enabled in general/javascript, being extended here) because the TypeScript compiler already catches unused imports for us.
4144
+ "import/no-unresolved": "off",
4146
4145
  // Disable regular no-redeclare in favour of TypeScript-specific version since that will flag type redeclarations when we do const MyType = {}; export type MyType = ...
4147
4146
  "no-redeclare": "off",
4148
4147
  // Disable no-undef because undefined variables tend to be better caught by the TypeScript compiler.
4149
4148
  "no-undef": "off",
4150
4149
  // Disable regular no-unused-vars rule since that will flag interface declarations. Only use the TypeScript specific rule for this.
4151
4150
  "no-unused-vars": "off"
4152
- },
4153
- settings: {
4154
- "import/resolver": {
4155
- node: true,
4156
- typescript: true
4157
- }
4158
4151
  }
4159
4152
  }
4160
4153
  ];
@@ -4511,7 +4504,8 @@ var consistentTestFunction = createRule_default({
4511
4504
  type: "object",
4512
4505
  properties: {
4513
4506
  preference: {
4514
- type: "string"
4507
+ type: "string",
4508
+ enum: ["it", "test"]
4515
4509
  }
4516
4510
  },
4517
4511
  additionalProperties: false
@@ -4522,7 +4516,7 @@ var consistentTestFunction = createRule_default({
4522
4516
  create(context) {
4523
4517
  var _a;
4524
4518
  const preference = (_a = context.options[0]) == null ? void 0 : _a.preference;
4525
- const validatedPreference = validTestFunctionsSchema.parse(preference != null ? preference : "test");
4519
+ const validatedPreference = parseTestFunction(preference != null ? preference : "test");
4526
4520
  return {
4527
4521
  CallExpression(node) {
4528
4522
  if (node.callee.type === import_utils2.AST_NODE_TYPES.Identifier && node.callee.name === "it" && validatedPreference === "test") {
package/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { Config } from 'prettier';
4
4
  import z from 'zod';
5
5
 
6
6
  var name = "@alextheman/eslint-plugin";
7
- var version = "2.8.0";
7
+ var version = "2.8.2";
8
8
 
9
9
  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
10
 
@@ -65,47 +65,32 @@ declare const validTestFunctionsSchema: z.ZodEnum<{
65
65
  type TestFunction = z.infer<typeof validTestFunctionsSchema>;
66
66
  declare function parseTestFunction(data: unknown): TestFunction;
67
67
 
68
- /**
69
- * This file was automatically generated by json-schema-to-typescript.
70
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
71
- * and run json-schema-to-typescript to regenerate this file.
72
- */
68
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
69
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
73
70
  interface ConsistentTestFunctionOptions {
74
- preference?: string;
71
+ preference?: "it" | "test";
75
72
  }
76
73
 
77
- /**
78
- * This file was automatically generated by json-schema-to-typescript.
79
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
80
- * and run json-schema-to-typescript to regenerate this file.
81
- */
74
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
75
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
82
76
  interface NoNamespaceImportsOptions {
83
77
  allow?: string[];
84
78
  }
85
79
 
86
- /**
87
- * This file was automatically generated by json-schema-to-typescript.
88
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
89
- * and run json-schema-to-typescript to regenerate this file.
90
- */
80
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
81
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
91
82
  interface NoRelativeImportsOptions {
92
83
  depth?: number;
93
84
  }
94
85
 
95
- /**
96
- * This file was automatically generated by json-schema-to-typescript.
97
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
98
- * and run json-schema-to-typescript to regenerate this file.
99
- */
86
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
87
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
100
88
  interface StandardiseErrorMessagesOptions {
101
89
  regex?: string;
102
90
  }
103
91
 
104
- /**
105
- * This file was automatically generated by json-schema-to-typescript.
106
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
107
- * and run json-schema-to-typescript to regenerate this file.
108
- */
92
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
93
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
109
94
  interface UseNormalizedImportsOptions {
110
95
  fixable?: boolean;
111
96
  }
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { Config } from 'prettier';
4
4
  import z from 'zod';
5
5
 
6
6
  var name = "@alextheman/eslint-plugin";
7
- var version = "2.8.0";
7
+ var version = "2.8.2";
8
8
 
9
9
  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
10
 
@@ -65,47 +65,32 @@ declare const validTestFunctionsSchema: z.ZodEnum<{
65
65
  type TestFunction = z.infer<typeof validTestFunctionsSchema>;
66
66
  declare function parseTestFunction(data: unknown): TestFunction;
67
67
 
68
- /**
69
- * This file was automatically generated by json-schema-to-typescript.
70
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
71
- * and run json-schema-to-typescript to regenerate this file.
72
- */
68
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
69
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
73
70
  interface ConsistentTestFunctionOptions {
74
- preference?: string;
71
+ preference?: "it" | "test";
75
72
  }
76
73
 
77
- /**
78
- * This file was automatically generated by json-schema-to-typescript.
79
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
80
- * and run json-schema-to-typescript to regenerate this file.
81
- */
74
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
75
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
82
76
  interface NoNamespaceImportsOptions {
83
77
  allow?: string[];
84
78
  }
85
79
 
86
- /**
87
- * This file was automatically generated by json-schema-to-typescript.
88
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
89
- * and run json-schema-to-typescript to regenerate this file.
90
- */
80
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
81
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
91
82
  interface NoRelativeImportsOptions {
92
83
  depth?: number;
93
84
  }
94
85
 
95
- /**
96
- * This file was automatically generated by json-schema-to-typescript.
97
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
98
- * and run json-schema-to-typescript to regenerate this file.
99
- */
86
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
87
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
100
88
  interface StandardiseErrorMessagesOptions {
101
89
  regex?: string;
102
90
  }
103
91
 
104
- /**
105
- * This file was automatically generated by json-schema-to-typescript.
106
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
107
- * and run json-schema-to-typescript to regenerate this file.
108
- */
92
+ /** Generated from src/utility/generateRuleOptionsTypes.ts.
93
+ * You may execute the above file to re-generate this type using `npm run generate-rule-options-types` */
109
94
  interface UseNormalizedImportsOptions {
110
95
  fixable?: boolean;
111
96
  }
package/dist/index.js CHANGED
@@ -3743,7 +3743,7 @@ var require_src = __commonJS({
3743
3743
 
3744
3744
  // package.json
3745
3745
  var name = "@alextheman/eslint-plugin";
3746
- var version = "2.8.0";
3746
+ var version = "2.8.2";
3747
3747
 
3748
3748
  // src/configs/index.ts
3749
3749
  import packageJson from "eslint-plugin-package-json";
@@ -3817,7 +3817,10 @@ function createPluginTestsBaseConfig(plugin) {
3817
3817
  "@alextheman": plugin
3818
3818
  },
3819
3819
  rules: {
3820
- "@alextheman/consistent-test-function": ["error", { preference: "test" }],
3820
+ "@alextheman/consistent-test-function": [
3821
+ "error",
3822
+ { preference: "test" }
3823
+ ],
3821
3824
  "@alextheman/no-isolated-tests": "error",
3822
3825
  "@alextheman/no-skipped-tests": "warn"
3823
3826
  }
@@ -3848,6 +3851,14 @@ var javaScriptLanguageOptions = {
3848
3851
  };
3849
3852
  var javaScriptLanguageOptions_default = javaScriptLanguageOptions;
3850
3853
 
3854
+ // src/configs/miscellaneous/unusedVarsIgnorePatterns.ts
3855
+ var unusedVarsIgnorePatterns = {
3856
+ argsIgnorePattern: "^_",
3857
+ caughtErrorsIgnorePattern: "^_",
3858
+ varsIgnorePattern: "^_"
3859
+ };
3860
+ var unusedVarsIgnorePatterns_default = unusedVarsIgnorePatterns;
3861
+
3851
3862
  // src/configs/general/javaScriptBase.ts
3852
3863
  var javaScriptBase = [
3853
3864
  import_js.default.configs.recommended,
@@ -3881,14 +3892,7 @@ var javaScriptBase = [
3881
3892
  }
3882
3893
  ],
3883
3894
  "no-undef": "error",
3884
- "no-unused-vars": [
3885
- "error",
3886
- {
3887
- argsIgnorePattern: "^_",
3888
- caughtErrorsIgnorePattern: "^_",
3889
- varsIgnorePattern: "^_"
3890
- }
3891
- ],
3895
+ "no-unused-vars": ["error", unusedVarsIgnorePatterns_default],
3892
3896
  "no-useless-rename": "error",
3893
3897
  "no-useless-return": "error",
3894
3898
  "prefer-const": "error"
@@ -4119,26 +4123,15 @@ var typeScriptBase = [
4119
4123
  "@typescript-eslint/explicit-member-accessibility": "error",
4120
4124
  "@typescript-eslint/no-deprecated": "warn",
4121
4125
  "@typescript-eslint/no-redeclare": ["error", { ignoreDeclarationMerge: true }],
4122
- "@typescript-eslint/no-unused-vars": [
4123
- "error",
4124
- {
4125
- argsIgnorePattern: "^_",
4126
- caughtErrorsIgnorePattern: "^_",
4127
- varsIgnorePattern: "^_"
4128
- }
4129
- ],
4126
+ "@typescript-eslint/no-unused-vars": ["error", unusedVarsIgnorePatterns_default],
4127
+ // Disable import/no-unresolved (enabled in general/javascript, being extended here) because the TypeScript compiler already catches unused imports for us.
4128
+ "import/no-unresolved": "off",
4130
4129
  // Disable regular no-redeclare in favour of TypeScript-specific version since that will flag type redeclarations when we do const MyType = {}; export type MyType = ...
4131
4130
  "no-redeclare": "off",
4132
4131
  // Disable no-undef because undefined variables tend to be better caught by the TypeScript compiler.
4133
4132
  "no-undef": "off",
4134
4133
  // Disable regular no-unused-vars rule since that will flag interface declarations. Only use the TypeScript specific rule for this.
4135
4134
  "no-unused-vars": "off"
4136
- },
4137
- settings: {
4138
- "import/resolver": {
4139
- node: true,
4140
- typescript: true
4141
- }
4142
4135
  }
4143
4136
  }
4144
4137
  ];
@@ -4495,7 +4488,8 @@ var consistentTestFunction = createRule_default({
4495
4488
  type: "object",
4496
4489
  properties: {
4497
4490
  preference: {
4498
- type: "string"
4491
+ type: "string",
4492
+ enum: ["it", "test"]
4499
4493
  }
4500
4494
  },
4501
4495
  additionalProperties: false
@@ -4506,7 +4500,7 @@ var consistentTestFunction = createRule_default({
4506
4500
  create(context) {
4507
4501
  var _a;
4508
4502
  const preference = (_a = context.options[0]) == null ? void 0 : _a.preference;
4509
- const validatedPreference = validTestFunctionsSchema.parse(preference != null ? preference : "test");
4503
+ const validatedPreference = parseTestFunction(preference != null ? preference : "test");
4510
4504
  return {
4511
4505
  CallExpression(node) {
4512
4506
  if (node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === "it" && validatedPreference === "test") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/eslint-plugin",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "A package to provide custom ESLint rules and configs",
5
5
  "repository": {
6
6
  "type": "git",