@alextheman/eslint-plugin 2.8.2 → 3.0.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 CHANGED
@@ -3411,7 +3411,7 @@ var require_package = __commonJS({
3411
3411
  "node_modules/@eslint/js/package.json"(exports2, module2) {
3412
3412
  module2.exports = {
3413
3413
  name: "@eslint/js",
3414
- version: "9.31.0",
3414
+ version: "9.39.1",
3415
3415
  description: "ESLint JavaScript language implementation",
3416
3416
  funding: "https://eslint.org/donate",
3417
3417
  main: "./src/index.js",
@@ -3453,7 +3453,7 @@ var require_eslint_all = __commonJS({
3453
3453
  "node_modules/@eslint/js/src/configs/eslint-all.js"(exports2, module2) {
3454
3454
  "use strict";
3455
3455
  module2.exports = Object.freeze({
3456
- "rules": {
3456
+ rules: Object.freeze({
3457
3457
  "accessor-pairs": "error",
3458
3458
  "array-callback-return": "error",
3459
3459
  "arrow-body-style": "error",
@@ -3637,6 +3637,7 @@ var require_eslint_all = __commonJS({
3637
3637
  "prefer-rest-params": "error",
3638
3638
  "prefer-spread": "error",
3639
3639
  "prefer-template": "error",
3640
+ "preserve-caught-error": "error",
3640
3641
  "radix": "error",
3641
3642
  "require-atomic-updates": "error",
3642
3643
  "require-await": "error",
@@ -3652,7 +3653,7 @@ var require_eslint_all = __commonJS({
3652
3653
  "valid-typeof": "error",
3653
3654
  "vars-on-top": "error",
3654
3655
  "yoda": "error"
3655
- }
3656
+ })
3656
3657
  });
3657
3658
  }
3658
3659
  });
@@ -3751,7 +3752,12 @@ var require_src = __commonJS({
3751
3752
  var index_exports = {};
3752
3753
  __export(index_exports, {
3753
3754
  default: () => index_default,
3755
+ parseConsistentTestFunctionOptions: () => parseConsistentTestFunctionOptions,
3756
+ parseNoNamespaceImportsOptions: () => parseNoNamespaceImportsOptions,
3757
+ parseNoRelativeImportsOptions: () => parseNoRelativeImportsOptions,
3758
+ parseStandardiseErrorMessagesOptions: () => parseStandardiseErrorMessagesOptions,
3754
3759
  parseTestFunction: () => parseTestFunction,
3760
+ parseUseNormalizedImportsOptions: () => parseUseNormalizedImportsOptions,
3755
3761
  prettierRules: () => prettierRules_default,
3756
3762
  sortObjects: () => sortObjects_default
3757
3763
  });
@@ -3759,7 +3765,7 @@ module.exports = __toCommonJS(index_exports);
3759
3765
 
3760
3766
  // package.json
3761
3767
  var name = "@alextheman/eslint-plugin";
3762
- var version = "2.8.2";
3768
+ var version = "3.0.0";
3763
3769
 
3764
3770
  // src/configs/index.ts
3765
3771
  var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
@@ -3860,14 +3866,14 @@ var import_js = __toESM(require_src(), 1);
3860
3866
  var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
3861
3867
  var import_eslint_plugin_import = __toESM(require("eslint-plugin-import"), 1);
3862
3868
 
3863
- // src/configs/miscellaneous/javaScriptLanguageOptions.ts
3869
+ // src/configs/helpers/javaScriptLanguageOptions.ts
3864
3870
  var import_globals2 = __toESM(require_globals2(), 1);
3865
3871
  var javaScriptLanguageOptions = {
3866
3872
  globals: __spreadValues(__spreadValues(__spreadValues({}, import_globals2.default.node), import_globals2.default.browser), import_globals2.default.vitest)
3867
3873
  };
3868
3874
  var javaScriptLanguageOptions_default = javaScriptLanguageOptions;
3869
3875
 
3870
- // src/configs/miscellaneous/unusedVarsIgnorePatterns.ts
3876
+ // src/configs/helpers/unusedVarsIgnorePatterns.ts
3871
3877
  var unusedVarsIgnorePatterns = {
3872
3878
  argsIgnorePattern: "^_",
3873
3879
  caughtErrorsIgnorePattern: "^_",
@@ -3926,7 +3932,7 @@ var javaScriptBase_default = javaScriptBase;
3926
3932
  var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
3927
3933
  var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
3928
3934
 
3929
- // src/configs/miscellaneous/prettierRules.ts
3935
+ // src/configs/helpers/prettierRules.ts
3930
3936
  var prettierRules = {
3931
3937
  printWidth: 100
3932
3938
  };
@@ -4009,10 +4015,20 @@ var javaScriptBase_default3 = createCombinedJavaScriptBaseConfig;
4009
4015
  // src/configs/general/reactBase.ts
4010
4016
  var import_eslint_plugin_jsx_a11y = __toESM(require("eslint-plugin-jsx-a11y"), 1);
4011
4017
  var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
4012
- var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
4013
4018
  var import_eslint_plugin_react_refresh = __toESM(require("eslint-plugin-react-refresh"), 1);
4014
4019
 
4015
- // src/configs/miscellaneous/reactLanguageOptions.ts
4020
+ // src/configs/helpers/reactHooks.ts
4021
+ var import_utility = require("@alextheman/utility");
4022
+ var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
4023
+ var reactHooks = __spreadProps(__spreadValues({}, import_eslint_plugin_react_hooks.default), {
4024
+ configs: __spreadProps(__spreadValues({}, (0, import_utility.omitProperties)(import_eslint_plugin_react_hooks.default.configs, "flat")), {
4025
+ "flat/recommended": import_eslint_plugin_react_hooks.default.configs.flat.recommended,
4026
+ "flat/recommended-latest": import_eslint_plugin_react_hooks.default.configs.flat["recommended-latest"]
4027
+ })
4028
+ });
4029
+ var reactHooks_default = reactHooks;
4030
+
4031
+ // src/configs/helpers/reactLanguageOptions.ts
4016
4032
  var import_globals3 = __toESM(require_globals2(), 1);
4017
4033
  var reactLanguageOptions = {
4018
4034
  ecmaVersion: 2020,
@@ -4035,10 +4051,10 @@ var reactBase = [
4035
4051
  name: "@alextheman/general/react",
4036
4052
  plugins: {
4037
4053
  react: import_eslint_plugin_react.default,
4038
- "react-hooks": import_eslint_plugin_react_hooks.default,
4054
+ "react-hooks": reactHooks_default,
4039
4055
  "react-refresh": import_eslint_plugin_react_refresh.default
4040
4056
  },
4041
- rules: __spreadProps(__spreadValues({}, import_eslint_plugin_react_hooks.default.configs.recommended.rules), {
4057
+ rules: __spreadProps(__spreadValues({}, reactHooks_default.configs["flat/recommended"].rules), {
4042
4058
  "react/destructuring-assignment": ["error", "always", { destructureInSignature: "always" }],
4043
4059
  "react/hook-use-state": "error",
4044
4060
  "react/jsx-curly-brace-presence": [
@@ -4060,7 +4076,6 @@ var reactBase_default = reactBase;
4060
4076
 
4061
4077
  // src/configs/personal/reactBase.ts
4062
4078
  var import_eslint_plugin_react2 = __toESM(require("eslint-plugin-react"), 1);
4063
- var import_eslint_plugin_react_hooks2 = __toESM(require("eslint-plugin-react-hooks"), 1);
4064
4079
  var import_eslint_plugin_react_refresh2 = __toESM(require("eslint-plugin-react-refresh"), 1);
4065
4080
  var personalReactBaseConfig = [
4066
4081
  {
@@ -4068,7 +4083,7 @@ var personalReactBaseConfig = [
4068
4083
  name: "@alextheman/personal/react",
4069
4084
  plugins: {
4070
4085
  react: import_eslint_plugin_react2.default,
4071
- "react-hooks": import_eslint_plugin_react_hooks2.default,
4086
+ "react-hooks": reactHooks_default,
4072
4087
  "react-refresh": import_eslint_plugin_react_refresh2.default
4073
4088
  },
4074
4089
  rules: {
@@ -4110,12 +4125,12 @@ function createCombinedJavaScriptReactBaseConfig(plugin) {
4110
4125
  var javaScriptReactBase_default = createCombinedJavaScriptReactBaseConfig;
4111
4126
 
4112
4127
  // src/configs/general/typeScriptBase.ts
4113
- var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
4128
+ var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
4114
4129
 
4115
- // src/configs/miscellaneous/typeScriptLanguageOptions.ts
4116
- var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
4130
+ // src/configs/helpers/typeScriptLanguageOptions.ts
4131
+ var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
4117
4132
  var typeScriptLanguageOptions = {
4118
- parser: import_parser.default,
4133
+ parser: import_typescript_eslint.default.parser,
4119
4134
  parserOptions: {
4120
4135
  ecmaVersion: "latest",
4121
4136
  projectService: true,
@@ -4127,7 +4142,7 @@ var typeScriptLanguageOptions_default = typeScriptLanguageOptions;
4127
4142
 
4128
4143
  // src/configs/general/typeScriptBase.ts
4129
4144
  var typeScriptBase = [
4130
- ...import_typescript_eslint.default.configs.recommended,
4145
+ ...import_typescript_eslint2.default.configs.recommended,
4131
4146
  ...javaScriptBase_default,
4132
4147
  {
4133
4148
  files: ["**/*.ts", "**/*.tsx"],
@@ -4156,7 +4171,7 @@ var typeScriptBase_default = typeScriptBase;
4156
4171
  // src/configs/personal/eslintPlugin.ts
4157
4172
  var import_eslint_plugin_perfectionist2 = __toESM(require("eslint-plugin-perfectionist"), 1);
4158
4173
 
4159
- // src/configs/miscellaneous/sortObjects.ts
4174
+ // src/configs/helpers/sortObjects.ts
4160
4175
  var sortObjects = {
4161
4176
  customGroups: [],
4162
4177
  destructuredObjects: true,
@@ -4195,20 +4210,25 @@ function createPersonalEslintPluginConfig(plugin) {
4195
4210
  "no-restricted-imports": [
4196
4211
  "error",
4197
4212
  {
4198
- paths: ["src/alexPlugin", "src/index", "src"].map((name2) => {
4199
- return {
4213
+ paths: [
4214
+ ...["src/alexPlugin", "src/index", "src"].map((name2) => {
4215
+ return {
4216
+ importNames: ["default"],
4217
+ message: "Do not import the plugin directly from the config files. Please create a function that takes in the plugin and returns the config instead.",
4218
+ name: name2
4219
+ };
4220
+ }),
4221
+ {
4200
4222
  importNames: ["default"],
4201
- message: "Do not import the plugin directly from the config files. Please create a function that takes in the plugin and returns the config instead.",
4202
- name: name2
4203
- };
4204
- })
4223
+ message: 'Please import from "src/configs/helpers/reactHooks" instead.',
4224
+ name: "eslint-plugin-react-hooks"
4225
+ }
4226
+ ]
4205
4227
  }
4206
4228
  ]
4207
4229
  }
4208
4230
  },
4209
4231
  {
4210
- // Since the object exported in the rules index serves the same function as the exports in other projects, it's best to sort them in alphabetical order
4211
- // as well to make it easier to compare against the file directory.
4212
4232
  files: ["src/rules/index.ts", "src/configs/**"],
4213
4233
  rules: {
4214
4234
  "perfectionist/sort-objects": ["error", sortObjects_default]
@@ -4314,7 +4334,7 @@ var neurosongsFrontEndConfig = [
4314
4334
  var neurosongsFrontEnd_default = neurosongsFrontEndConfig;
4315
4335
 
4316
4336
  // src/configs/personal/typeScriptBase.ts
4317
- var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
4337
+ var import_typescript_eslint3 = __toESM(require("typescript-eslint"), 1);
4318
4338
  function createPersonalTypeScriptBaseConfig(plugin) {
4319
4339
  return [
4320
4340
  {
@@ -4323,7 +4343,7 @@ function createPersonalTypeScriptBaseConfig(plugin) {
4323
4343
  name: "@alextheman/personal/typescript",
4324
4344
  plugins: {
4325
4345
  "@alextheman": plugin,
4326
- "@typescript-eslint": import_typescript_eslint2.default.plugin
4346
+ "@typescript-eslint": import_typescript_eslint3.default.plugin
4327
4347
  },
4328
4348
  rules: {
4329
4349
  "@alextheman/standardise-error-messages": "error",
@@ -4341,12 +4361,12 @@ function createPersonalTypeScriptBaseConfig(plugin) {
4341
4361
  var typeScriptBase_default2 = createPersonalTypeScriptBaseConfig;
4342
4362
 
4343
4363
  // src/configs/personal/utility.ts
4344
- var import_typescript_eslint3 = __toESM(require("typescript-eslint"), 1);
4364
+ var import_typescript_eslint4 = __toESM(require("typescript-eslint"), 1);
4345
4365
  var utilityConfig = [
4346
4366
  {
4347
4367
  name: "@alextheman/personal/utility",
4348
4368
  plugins: {
4349
- "@typescript-eslint": import_typescript_eslint3.default.plugin
4369
+ "@typescript-eslint": import_typescript_eslint4.default.plugin
4350
4370
  },
4351
4371
  rules: {
4352
4372
  "@typescript-eslint/explicit-module-boundary-types": "error"
@@ -4393,9 +4413,9 @@ var alexCLineConfig = [
4393
4413
  var alexCLine_default = alexCLineConfig;
4394
4414
 
4395
4415
  // src/utility/camelToKebab.ts
4396
- var import_utility2 = require("@alextheman/utility");
4416
+ var import_utility3 = require("@alextheman/utility");
4397
4417
  function camelToKebab(string) {
4398
- return (0, import_utility2.camelToKebab)(
4418
+ return (0, import_utility3.camelToKebab)(
4399
4419
  string.replace(/[Tt]ypeScript/, "typescript").replace(/[Jj]avaScript/, "javascript")
4400
4420
  );
4401
4421
  }
@@ -4464,7 +4484,7 @@ var configs_default = createAlexPluginConfigs;
4464
4484
 
4465
4485
  // src/rules/consistent-test-function.ts
4466
4486
  var import_utils2 = require("@typescript-eslint/utils");
4467
- var import_zod = __toESM(require("zod"), 1);
4487
+ var import_zod2 = __toESM(require("zod"), 1);
4468
4488
 
4469
4489
  // src/createRule.ts
4470
4490
  var import_utils = require("@typescript-eslint/utils");
@@ -4473,6 +4493,14 @@ var createRule = import_utils.ESLintUtils.RuleCreator((ruleName) => {
4473
4493
  });
4474
4494
  var createRule_default = createRule;
4475
4495
 
4496
+ // src/utility/createRuleSchema.ts
4497
+ var import_utility4 = require("@alextheman/utility");
4498
+ var import_zod = __toESM(require("zod"), 1);
4499
+ function createRuleSchema(schema6) {
4500
+ return [(0, import_utility4.omitProperties)(import_zod.default.toJSONSchema(schema6), "$schema")];
4501
+ }
4502
+ var createRuleSchema_default = createRuleSchema;
4503
+
4476
4504
  // src/utility/getImportSpecifiersAfterRemoving.ts
4477
4505
  function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
4478
4506
  return specifiers.filter((specifier) => {
@@ -4484,10 +4512,17 @@ function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
4484
4512
  var getImportSpecifiersAfterRemoving_default = getImportSpecifiersAfterRemoving;
4485
4513
 
4486
4514
  // src/rules/consistent-test-function.ts
4487
- var validTestFunctionsSchema = import_zod.default.enum(["test", "it"]);
4515
+ var validTestFunctionsSchema = import_zod2.default.enum(["test", "it"]);
4488
4516
  function parseTestFunction(data) {
4489
4517
  return validTestFunctionsSchema.parse(data);
4490
4518
  }
4519
+ var consistentTestFunctionOptionsSchema = import_zod2.default.object({
4520
+ preference: validTestFunctionsSchema
4521
+ }).partial();
4522
+ function parseConsistentTestFunctionOptions(data) {
4523
+ return consistentTestFunctionOptionsSchema.parse(data);
4524
+ }
4525
+ var schema = createRuleSchema_default(consistentTestFunctionOptionsSchema);
4491
4526
  var consistentTestFunction = createRule_default({
4492
4527
  name: "consistent-test-function",
4493
4528
  meta: {
@@ -4499,46 +4534,36 @@ var consistentTestFunction = createRule_default({
4499
4534
  },
4500
4535
  type: "suggestion",
4501
4536
  fixable: "code",
4502
- schema: [
4503
- {
4504
- type: "object",
4505
- properties: {
4506
- preference: {
4507
- type: "string",
4508
- enum: ["it", "test"]
4509
- }
4510
- },
4511
- additionalProperties: false
4512
- }
4513
- ]
4537
+ schema
4514
4538
  },
4515
4539
  defaultOptions: [{ preference: "test" }],
4516
4540
  create(context) {
4517
4541
  var _a;
4518
- const preference = (_a = context.options[0]) == null ? void 0 : _a.preference;
4519
- const validatedPreference = parseTestFunction(preference != null ? preference : "test");
4542
+ const { preference } = parseConsistentTestFunctionOptions(
4543
+ (_a = context.options[0]) != null ? _a : { preference: "test" }
4544
+ );
4520
4545
  return {
4521
4546
  CallExpression(node) {
4522
- if (node.callee.type === import_utils2.AST_NODE_TYPES.Identifier && node.callee.name === "it" && validatedPreference === "test") {
4547
+ if (node.callee.type === import_utils2.AST_NODE_TYPES.Identifier && node.callee.name === "it" && preference === "test") {
4523
4548
  return context.report({
4524
4549
  node,
4525
4550
  messageId: "message",
4526
4551
  data: {
4527
4552
  source: node.callee.name,
4528
- preference: validatedPreference
4553
+ preference
4529
4554
  },
4530
4555
  fix(fixer) {
4531
4556
  return fixer.replaceText(node.callee, "test");
4532
4557
  }
4533
4558
  });
4534
4559
  }
4535
- if (node.callee.type === import_utils2.AST_NODE_TYPES.Identifier && node.callee.name === "test" && validatedPreference === "it") {
4560
+ if (node.callee.type === import_utils2.AST_NODE_TYPES.Identifier && node.callee.name === "test" && preference === "it") {
4536
4561
  return context.report({
4537
4562
  node,
4538
4563
  messageId: "message",
4539
4564
  data: {
4540
4565
  source: node.callee.name,
4541
- preference: validatedPreference
4566
+ preference
4542
4567
  },
4543
4568
  fix(fixer) {
4544
4569
  return fixer.replaceText(node.callee, "it");
@@ -4548,13 +4573,13 @@ var consistentTestFunction = createRule_default({
4548
4573
  },
4549
4574
  ImportDeclaration(node) {
4550
4575
  for (const specifier of node.specifiers) {
4551
- if (specifier.type === import_utils2.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils2.AST_NODE_TYPES.Identifier && specifier.imported.name === "it" && validatedPreference === "test") {
4576
+ if (specifier.type === import_utils2.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils2.AST_NODE_TYPES.Identifier && specifier.imported.name === "it" && preference === "test") {
4552
4577
  return context.report({
4553
4578
  node,
4554
4579
  messageId: "message",
4555
4580
  data: {
4556
4581
  source: specifier.imported.name,
4557
- preference: validatedPreference
4582
+ preference
4558
4583
  },
4559
4584
  fix(fixer) {
4560
4585
  const importedNames = node.specifiers.map((specifier2) => {
@@ -4576,18 +4601,18 @@ var consistentTestFunction = createRule_default({
4576
4601
  }
4577
4602
  return fixer.replaceTextRange(
4578
4603
  [specifier.imported.range[0], specifier.imported.range[1]],
4579
- validatedPreference
4604
+ preference
4580
4605
  );
4581
4606
  }
4582
4607
  });
4583
4608
  }
4584
- if (specifier.type === import_utils2.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils2.AST_NODE_TYPES.Identifier && specifier.imported.name === "test" && validatedPreference === "it") {
4609
+ if (specifier.type === import_utils2.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === import_utils2.AST_NODE_TYPES.Identifier && specifier.imported.name === "test" && preference === "it") {
4585
4610
  return context.report({
4586
4611
  node,
4587
4612
  messageId: "message",
4588
4613
  data: {
4589
4614
  source: specifier.imported.name,
4590
- preference: validatedPreference
4615
+ preference
4591
4616
  },
4592
4617
  fix(fixer) {
4593
4618
  const importedNames = node.specifiers.map((specifier2) => {
@@ -4609,7 +4634,7 @@ var consistentTestFunction = createRule_default({
4609
4634
  }
4610
4635
  return fixer.replaceTextRange(
4611
4636
  [specifier.imported.range[0], specifier.imported.range[1]],
4612
- validatedPreference
4637
+ preference
4613
4638
  );
4614
4639
  }
4615
4640
  });
@@ -4661,6 +4686,14 @@ var noIsolatedTests = createRule_default({
4661
4686
  var no_isolated_tests_default = noIsolatedTests;
4662
4687
 
4663
4688
  // src/rules/no-namespace-imports.ts
4689
+ var import_zod3 = __toESM(require("zod"), 1);
4690
+ var noNamespaceImportsOptionsSchema = import_zod3.default.object({
4691
+ allow: import_zod3.default.array(import_zod3.default.string())
4692
+ }).partial();
4693
+ function parseNoNamespaceImportsOptions(data) {
4694
+ return noNamespaceImportsOptionsSchema.parse(data);
4695
+ }
4696
+ var schema2 = createRuleSchema_default(noNamespaceImportsOptionsSchema);
4664
4697
  var noNamespaceImports = createRule_default({
4665
4698
  name: "no-namespace-imports",
4666
4699
  meta: {
@@ -4671,31 +4704,17 @@ var noNamespaceImports = createRule_default({
4671
4704
  message: 'Import * from "{{source}}" is not allowed. Please use named imports instead.'
4672
4705
  },
4673
4706
  type: "suggestion",
4674
- schema: [
4675
- {
4676
- type: "object",
4677
- properties: {
4678
- allow: {
4679
- type: "array",
4680
- items: {
4681
- type: "string"
4682
- },
4683
- uniqueItems: true
4684
- }
4685
- },
4686
- additionalProperties: false
4687
- }
4688
- ]
4707
+ schema: schema2
4689
4708
  },
4690
4709
  defaultOptions: [{ allow: [""] }],
4691
4710
  create(context) {
4692
4711
  var _a;
4693
- const allowableNamedImports = (_a = context.options[0]) == null ? void 0 : _a.allow;
4712
+ const { allow } = parseNoNamespaceImportsOptions((_a = context.options[0]) != null ? _a : { allow: [] });
4694
4713
  return {
4695
4714
  ImportDeclaration(node) {
4696
4715
  const allSpecifiers = node.specifiers;
4697
4716
  for (const specifier of allSpecifiers) {
4698
- if (specifier.type === "ImportNamespaceSpecifier" && !(allowableNamedImports == null ? void 0 : allowableNamedImports.includes(node.source.value))) {
4717
+ if (specifier.type === "ImportNamespaceSpecifier" && !(allow == null ? void 0 : allow.includes(node.source.value))) {
4699
4718
  context.report({
4700
4719
  node,
4701
4720
  messageId: "message",
@@ -4748,6 +4767,14 @@ var noPluginConfigAccessFromSrcConfigs = createRule_default({
4748
4767
  var no_plugin_configs_access_from_src_configs_default = noPluginConfigAccessFromSrcConfigs;
4749
4768
 
4750
4769
  // src/rules/no-relative-imports.ts
4770
+ var import_zod4 = __toESM(require("zod"), 1);
4771
+ var noRelativeImportsOptionsSchema = import_zod4.default.object({
4772
+ depth: import_zod4.default.int().nonnegative()
4773
+ }).partial();
4774
+ function parseNoRelativeImportsOptions(data) {
4775
+ return noRelativeImportsOptionsSchema.parse(data);
4776
+ }
4777
+ var schema3 = createRuleSchema_default(noRelativeImportsOptionsSchema);
4751
4778
  var noRelativeImports = createRule_default({
4752
4779
  name: "no-relative-imports",
4753
4780
  meta: {
@@ -4759,34 +4786,16 @@ var noRelativeImports = createRule_default({
4759
4786
  stupidPath: "For the love of God, please do not mix relative path parts in your import statements like that! How can you possibly be ok with {{source}}?!"
4760
4787
  },
4761
4788
  type: "suggestion",
4762
- schema: [
4763
- {
4764
- type: "object",
4765
- properties: {
4766
- depth: {
4767
- type: "number"
4768
- }
4769
- },
4770
- additionalProperties: false
4771
- }
4772
- ]
4789
+ schema: schema3
4773
4790
  },
4774
4791
  defaultOptions: [{ depth: void 0 }],
4775
4792
  create(context) {
4776
4793
  var _a;
4777
- const allowedDepth = (_a = context.options[0]) == null ? void 0 : _a.depth;
4778
- if (allowedDepth !== void 0) {
4779
- if (allowedDepth % 1 !== 0) {
4780
- throw new Error("NON_INTEGER_DEPTH_NOT_ALLOWED");
4781
- }
4782
- if (allowedDepth < 0) {
4783
- throw new Error("NEGATIVE_DEPTH_NOT_ALLOWED");
4784
- }
4785
- }
4794
+ const { depth } = parseNoRelativeImportsOptions((_a = context.options[0]) != null ? _a : { depth: void 0 });
4786
4795
  return {
4787
4796
  ImportDeclaration(node) {
4788
4797
  if (node.source.value.includes("./") || node.source.value.includes("../")) {
4789
- if (allowedDepth === void 0) {
4798
+ if (depth === void 0) {
4790
4799
  return context.report({
4791
4800
  node,
4792
4801
  messageId: "strictNoRelative",
@@ -4814,18 +4823,18 @@ var noRelativeImports = createRule_default({
4814
4823
  }
4815
4824
  });
4816
4825
  }
4817
- if (allowedDepth === 0 && importPathParts[0] === ".") {
4826
+ if (depth === 0 && importPathParts[0] === ".") {
4818
4827
  return;
4819
4828
  }
4820
4829
  let endOfRelativePathFound = false;
4821
- for (const part of importPathParts.slice(0, allowedDepth + 1)) {
4830
+ for (const part of importPathParts.slice(0, depth + 1)) {
4822
4831
  if (part !== "..") {
4823
4832
  endOfRelativePathFound = true;
4824
4833
  break;
4825
4834
  }
4826
4835
  }
4827
4836
  if (!endOfRelativePathFound) {
4828
- if (allowedDepth === 0) {
4837
+ if (depth === 0) {
4829
4838
  return context.report({
4830
4839
  node,
4831
4840
  messageId: "rootOnly",
@@ -4839,8 +4848,8 @@ var noRelativeImports = createRule_default({
4839
4848
  messageId: "exceededAllowedDepth",
4840
4849
  data: {
4841
4850
  source: node.source.value,
4842
- depth: allowedDepth,
4843
- s: allowedDepth !== 1 ? "s" : ""
4851
+ depth,
4852
+ s: depth !== 1 ? "s" : ""
4844
4853
  }
4845
4854
  });
4846
4855
  }
@@ -4885,9 +4894,20 @@ var no_skipped_tests_default = noSkippedTests;
4885
4894
 
4886
4895
  // src/rules/standardise-error-messages.ts
4887
4896
  var import_utils4 = require("@typescript-eslint/utils");
4897
+ var import_zod5 = __toESM(require("zod"), 1);
4898
+ var standardiseErrorMessagesOptionsSchema = import_zod5.default.object({
4899
+ regex: import_zod5.default.string()
4900
+ }).partial();
4901
+ function parseStandardiseErrorMessagesOptions(data) {
4902
+ return standardiseErrorMessagesOptionsSchema.parse(data);
4903
+ }
4904
+ var schema4 = createRuleSchema_default(standardiseErrorMessagesOptionsSchema);
4905
+ var defaultErrorRegex = "^[A-Z]+(?:_[A-Z]+)*$";
4888
4906
  function checkCurrentNode(context, node) {
4889
- var _a, _b;
4890
- const errorRegex = (_b = (_a = context.options[0]) == null ? void 0 : _a.regex) != null ? _b : "^[A-Z]+(?:_[A-Z]+)*$";
4907
+ var _a;
4908
+ const { regex: errorRegex = defaultErrorRegex } = parseStandardiseErrorMessagesOptions(
4909
+ (_a = context.options[0]) != null ? _a : { regex: defaultErrorRegex }
4910
+ );
4891
4911
  if (node.callee.type === import_utils4.AST_NODE_TYPES.Identifier && node.callee.name === "Error") {
4892
4912
  const [errorArgument] = node.arguments;
4893
4913
  const errorMessage = errorArgument.type === import_utils4.AST_NODE_TYPES.Literal ? errorArgument.value : "";
@@ -4913,19 +4933,9 @@ var standardiseErrorMessages = createRule_default({
4913
4933
  message: "Expected error message {{error}} to match {{regex}}."
4914
4934
  },
4915
4935
  type: "suggestion",
4916
- schema: [
4917
- {
4918
- type: "object",
4919
- properties: {
4920
- regex: {
4921
- type: "string"
4922
- }
4923
- },
4924
- additionalProperties: false
4925
- }
4926
- ]
4936
+ schema: schema4
4927
4937
  },
4928
- defaultOptions: [{ regex: "^[A-Z]+(?:_[A-Z]+)*$" }],
4938
+ defaultOptions: [{ regex: defaultErrorRegex }],
4929
4939
  create(context) {
4930
4940
  return {
4931
4941
  CallExpression(node) {
@@ -4941,6 +4951,14 @@ var standardise_error_messages_default = standardiseErrorMessages;
4941
4951
 
4942
4952
  // src/rules/use-normalized-imports.ts
4943
4953
  var import_path = __toESM(require("path"), 1);
4954
+ var import_zod6 = __toESM(require("zod"), 1);
4955
+ var useNormalizedImportsOptionsSchema = import_zod6.default.object({
4956
+ fixable: import_zod6.default.boolean()
4957
+ }).partial();
4958
+ function parseUseNormalizedImportsOptions(data) {
4959
+ return useNormalizedImportsOptionsSchema.parse(data);
4960
+ }
4961
+ var schema5 = createRuleSchema_default(useNormalizedImportsOptionsSchema);
4944
4962
  var useNormalizedImports = createRule_default({
4945
4963
  name: "use-normalized-imports",
4946
4964
  meta: {
@@ -4951,23 +4969,15 @@ var useNormalizedImports = createRule_default({
4951
4969
  pathNotNormalized: "Import path {{nonNormalized}} is not normalised. Please use {{normalized}} instead."
4952
4970
  },
4953
4971
  type: "suggestion",
4954
- schema: [
4955
- {
4956
- type: "object",
4957
- properties: {
4958
- fixable: {
4959
- type: "boolean"
4960
- }
4961
- },
4962
- additionalProperties: false
4963
- }
4964
- ],
4972
+ schema: schema5,
4965
4973
  fixable: "code"
4966
4974
  },
4967
4975
  defaultOptions: [{ fixable: true }],
4968
4976
  create(context) {
4969
- var _a, _b;
4970
- const isFixable = (_b = (_a = context.options[0]) == null ? void 0 : _a.fixable) != null ? _b : true;
4977
+ var _a;
4978
+ const { fixable: isFixable } = parseUseNormalizedImportsOptions(
4979
+ (_a = context.options[0]) != null ? _a : { fixable: true }
4980
+ );
4971
4981
  return {
4972
4982
  ImportDeclaration(node) {
4973
4983
  const normalizedPath = import_path.default.posix.normalize(node.source.value);
@@ -5059,7 +5069,12 @@ var alexPlugin_default = alexPlugin;
5059
5069
  var index_default = alexPlugin_default;
5060
5070
  // Annotate the CommonJS export names for ESM import in node:
5061
5071
  0 && (module.exports = {
5072
+ parseConsistentTestFunctionOptions,
5073
+ parseNoNamespaceImportsOptions,
5074
+ parseNoRelativeImportsOptions,
5075
+ parseStandardiseErrorMessagesOptions,
5062
5076
  parseTestFunction,
5077
+ parseUseNormalizedImportsOptions,
5063
5078
  prettierRules,
5064
5079
  sortObjects
5065
5080
  });