@alextheman/eslint-plugin 2.9.0 → 3.0.1

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.9.0";
3768
+ var version = "3.0.1";
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: {
@@ -4084,6 +4099,7 @@ var personalReactBaseConfig = [
4084
4099
  }
4085
4100
  ],
4086
4101
  "react-hooks/exhaustive-deps": "off",
4102
+ "react-hooks/refs": "off",
4087
4103
  "react-refresh/only-export-components": "off",
4088
4104
  "react/jsx-boolean-value": "error"
4089
4105
  }
@@ -4110,12 +4126,12 @@ function createCombinedJavaScriptReactBaseConfig(plugin) {
4110
4126
  var javaScriptReactBase_default = createCombinedJavaScriptReactBaseConfig;
4111
4127
 
4112
4128
  // src/configs/general/typeScriptBase.ts
4113
- var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
4129
+ var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
4114
4130
 
4115
- // src/configs/miscellaneous/typeScriptLanguageOptions.ts
4116
- var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
4131
+ // src/configs/helpers/typeScriptLanguageOptions.ts
4132
+ var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
4117
4133
  var typeScriptLanguageOptions = {
4118
- parser: import_parser.default,
4134
+ parser: import_typescript_eslint.default.parser,
4119
4135
  parserOptions: {
4120
4136
  ecmaVersion: "latest",
4121
4137
  projectService: true,
@@ -4127,7 +4143,7 @@ var typeScriptLanguageOptions_default = typeScriptLanguageOptions;
4127
4143
 
4128
4144
  // src/configs/general/typeScriptBase.ts
4129
4145
  var typeScriptBase = [
4130
- ...import_typescript_eslint.default.configs.recommended,
4146
+ ...import_typescript_eslint2.default.configs.recommended,
4131
4147
  ...javaScriptBase_default,
4132
4148
  {
4133
4149
  files: ["**/*.ts", "**/*.tsx"],
@@ -4156,7 +4172,7 @@ var typeScriptBase_default = typeScriptBase;
4156
4172
  // src/configs/personal/eslintPlugin.ts
4157
4173
  var import_eslint_plugin_perfectionist2 = __toESM(require("eslint-plugin-perfectionist"), 1);
4158
4174
 
4159
- // src/configs/miscellaneous/sortObjects.ts
4175
+ // src/configs/helpers/sortObjects.ts
4160
4176
  var sortObjects = {
4161
4177
  customGroups: [],
4162
4178
  destructuredObjects: true,
@@ -4195,20 +4211,25 @@ function createPersonalEslintPluginConfig(plugin) {
4195
4211
  "no-restricted-imports": [
4196
4212
  "error",
4197
4213
  {
4198
- paths: ["src/alexPlugin", "src/index", "src"].map((name2) => {
4199
- return {
4214
+ paths: [
4215
+ ...["src/alexPlugin", "src/index", "src"].map((name2) => {
4216
+ return {
4217
+ importNames: ["default"],
4218
+ 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.",
4219
+ name: name2
4220
+ };
4221
+ }),
4222
+ {
4200
4223
  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
- })
4224
+ message: 'Please import from "src/configs/helpers/reactHooks" instead.',
4225
+ name: "eslint-plugin-react-hooks"
4226
+ }
4227
+ ]
4205
4228
  }
4206
4229
  ]
4207
4230
  }
4208
4231
  },
4209
4232
  {
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
4233
  files: ["src/rules/index.ts", "src/configs/**"],
4213
4234
  rules: {
4214
4235
  "perfectionist/sort-objects": ["error", sortObjects_default]
@@ -4314,7 +4335,7 @@ var neurosongsFrontEndConfig = [
4314
4335
  var neurosongsFrontEnd_default = neurosongsFrontEndConfig;
4315
4336
 
4316
4337
  // src/configs/personal/typeScriptBase.ts
4317
- var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
4338
+ var import_typescript_eslint3 = __toESM(require("typescript-eslint"), 1);
4318
4339
  function createPersonalTypeScriptBaseConfig(plugin) {
4319
4340
  return [
4320
4341
  {
@@ -4323,7 +4344,7 @@ function createPersonalTypeScriptBaseConfig(plugin) {
4323
4344
  name: "@alextheman/personal/typescript",
4324
4345
  plugins: {
4325
4346
  "@alextheman": plugin,
4326
- "@typescript-eslint": import_typescript_eslint2.default.plugin
4347
+ "@typescript-eslint": import_typescript_eslint3.default.plugin
4327
4348
  },
4328
4349
  rules: {
4329
4350
  "@alextheman/standardise-error-messages": "error",
@@ -4341,12 +4362,12 @@ function createPersonalTypeScriptBaseConfig(plugin) {
4341
4362
  var typeScriptBase_default2 = createPersonalTypeScriptBaseConfig;
4342
4363
 
4343
4364
  // src/configs/personal/utility.ts
4344
- var import_typescript_eslint3 = __toESM(require("typescript-eslint"), 1);
4365
+ var import_typescript_eslint4 = __toESM(require("typescript-eslint"), 1);
4345
4366
  var utilityConfig = [
4346
4367
  {
4347
4368
  name: "@alextheman/personal/utility",
4348
4369
  plugins: {
4349
- "@typescript-eslint": import_typescript_eslint3.default.plugin
4370
+ "@typescript-eslint": import_typescript_eslint4.default.plugin
4350
4371
  },
4351
4372
  rules: {
4352
4373
  "@typescript-eslint/explicit-module-boundary-types": "error"
@@ -4393,9 +4414,9 @@ var alexCLineConfig = [
4393
4414
  var alexCLine_default = alexCLineConfig;
4394
4415
 
4395
4416
  // src/utility/camelToKebab.ts
4396
- var import_utility2 = require("@alextheman/utility");
4417
+ var import_utility3 = require("@alextheman/utility");
4397
4418
  function camelToKebab(string) {
4398
- return (0, import_utility2.camelToKebab)(
4419
+ return (0, import_utility3.camelToKebab)(
4399
4420
  string.replace(/[Tt]ypeScript/, "typescript").replace(/[Jj]avaScript/, "javascript")
4400
4421
  );
4401
4422
  }
@@ -4474,10 +4495,10 @@ var createRule = import_utils.ESLintUtils.RuleCreator((ruleName) => {
4474
4495
  var createRule_default = createRule;
4475
4496
 
4476
4497
  // src/utility/createRuleSchema.ts
4477
- var import_utility3 = require("@alextheman/utility");
4498
+ var import_utility4 = require("@alextheman/utility");
4478
4499
  var import_zod = __toESM(require("zod"), 1);
4479
4500
  function createRuleSchema(schema6) {
4480
- return [(0, import_utility3.omitProperties)(import_zod.default.toJSONSchema(schema6), "$schema")];
4501
+ return [(0, import_utility4.omitProperties)(import_zod.default.toJSONSchema(schema6), "$schema")];
4481
4502
  }
4482
4503
  var createRuleSchema_default = createRuleSchema;
4483
4504
 
@@ -4935,7 +4956,7 @@ var import_zod6 = __toESM(require("zod"), 1);
4935
4956
  var useNormalizedImportsOptionsSchema = import_zod6.default.object({
4936
4957
  fixable: import_zod6.default.boolean()
4937
4958
  }).partial();
4938
- function parseUseNormalizedImportsOptionsSchema(data) {
4959
+ function parseUseNormalizedImportsOptions(data) {
4939
4960
  return useNormalizedImportsOptionsSchema.parse(data);
4940
4961
  }
4941
4962
  var schema5 = createRuleSchema_default(useNormalizedImportsOptionsSchema);
@@ -4955,7 +4976,7 @@ var useNormalizedImports = createRule_default({
4955
4976
  defaultOptions: [{ fixable: true }],
4956
4977
  create(context) {
4957
4978
  var _a;
4958
- const { fixable: isFixable } = parseUseNormalizedImportsOptionsSchema(
4979
+ const { fixable: isFixable } = parseUseNormalizedImportsOptions(
4959
4980
  (_a = context.options[0]) != null ? _a : { fixable: true }
4960
4981
  );
4961
4982
  return {
@@ -5049,7 +5070,12 @@ var alexPlugin_default = alexPlugin;
5049
5070
  var index_default = alexPlugin_default;
5050
5071
  // Annotate the CommonJS export names for ESM import in node:
5051
5072
  0 && (module.exports = {
5073
+ parseConsistentTestFunctionOptions,
5074
+ parseNoNamespaceImportsOptions,
5075
+ parseNoRelativeImportsOptions,
5076
+ parseStandardiseErrorMessagesOptions,
5052
5077
  parseTestFunction,
5078
+ parseUseNormalizedImportsOptions,
5053
5079
  prettierRules,
5054
5080
  sortObjects
5055
5081
  });
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.9.0";
7
+ var version = "3.0.1";
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
 
@@ -71,25 +71,32 @@ declare const consistentTestFunctionOptionsSchema: z.ZodObject<{
71
71
  }>>;
72
72
  }, z.core.$strip>;
73
73
  type ConsistentTestFunctionOptions = z.infer<typeof consistentTestFunctionOptionsSchema>;
74
+ declare function parseConsistentTestFunctionOptions(data: unknown): ConsistentTestFunctionOptions;
74
75
 
75
76
  declare const noNamespaceImportsOptionsSchema: z.ZodObject<{
76
77
  allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
78
  }, z.core.$strip>;
78
79
  type NoNamespaceImportsOptions = z.infer<typeof noNamespaceImportsOptionsSchema>;
80
+ declare function parseNoNamespaceImportsOptions(data: unknown): NoNamespaceImportsOptions;
79
81
 
80
82
  declare const noRelativeImportsOptionsSchema: z.ZodObject<{
81
83
  depth: z.ZodOptional<z.ZodInt>;
82
84
  }, z.core.$strip>;
83
85
  type NoRelativeImportsOptions = z.infer<typeof noRelativeImportsOptionsSchema>;
86
+ declare function parseNoRelativeImportsOptions(data: unknown): NoRelativeImportsOptions;
84
87
 
85
88
  declare const standardiseErrorMessagesOptionsSchema: z.ZodObject<{
86
89
  regex: z.ZodOptional<z.ZodString>;
87
90
  }, z.core.$strip>;
88
91
  type StandardiseErrorMessagesOptions = z.infer<typeof standardiseErrorMessagesOptionsSchema>;
92
+ declare function parseStandardiseErrorMessagesOptions(data: unknown): StandardiseErrorMessagesOptions;
89
93
 
90
94
  declare const useNormalizedImportsOptionsSchema: z.ZodObject<{
91
95
  fixable: z.ZodOptional<z.ZodBoolean>;
92
96
  }, z.core.$strip>;
93
97
  type UseNormalizedImportsOptions = z.infer<typeof useNormalizedImportsOptionsSchema>;
98
+ declare function parseUseNormalizedImportsOptions(data: unknown): {
99
+ fixable?: boolean | undefined;
100
+ };
94
101
 
95
- 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, parseTestFunction, prettierRules, sortObjects };
102
+ 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 };
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.9.0";
7
+ var version = "3.0.1";
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
 
@@ -71,25 +71,32 @@ declare const consistentTestFunctionOptionsSchema: z.ZodObject<{
71
71
  }>>;
72
72
  }, z.core.$strip>;
73
73
  type ConsistentTestFunctionOptions = z.infer<typeof consistentTestFunctionOptionsSchema>;
74
+ declare function parseConsistentTestFunctionOptions(data: unknown): ConsistentTestFunctionOptions;
74
75
 
75
76
  declare const noNamespaceImportsOptionsSchema: z.ZodObject<{
76
77
  allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
78
  }, z.core.$strip>;
78
79
  type NoNamespaceImportsOptions = z.infer<typeof noNamespaceImportsOptionsSchema>;
80
+ declare function parseNoNamespaceImportsOptions(data: unknown): NoNamespaceImportsOptions;
79
81
 
80
82
  declare const noRelativeImportsOptionsSchema: z.ZodObject<{
81
83
  depth: z.ZodOptional<z.ZodInt>;
82
84
  }, z.core.$strip>;
83
85
  type NoRelativeImportsOptions = z.infer<typeof noRelativeImportsOptionsSchema>;
86
+ declare function parseNoRelativeImportsOptions(data: unknown): NoRelativeImportsOptions;
84
87
 
85
88
  declare const standardiseErrorMessagesOptionsSchema: z.ZodObject<{
86
89
  regex: z.ZodOptional<z.ZodString>;
87
90
  }, z.core.$strip>;
88
91
  type StandardiseErrorMessagesOptions = z.infer<typeof standardiseErrorMessagesOptionsSchema>;
92
+ declare function parseStandardiseErrorMessagesOptions(data: unknown): StandardiseErrorMessagesOptions;
89
93
 
90
94
  declare const useNormalizedImportsOptionsSchema: z.ZodObject<{
91
95
  fixable: z.ZodOptional<z.ZodBoolean>;
92
96
  }, z.core.$strip>;
93
97
  type UseNormalizedImportsOptions = z.infer<typeof useNormalizedImportsOptionsSchema>;
98
+ declare function parseUseNormalizedImportsOptions(data: unknown): {
99
+ fixable?: boolean | undefined;
100
+ };
94
101
 
95
- 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, parseTestFunction, prettierRules, sortObjects };
102
+ 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 };
package/dist/index.js CHANGED
@@ -3405,7 +3405,7 @@ var require_package = __commonJS({
3405
3405
  "node_modules/@eslint/js/package.json"(exports, module) {
3406
3406
  module.exports = {
3407
3407
  name: "@eslint/js",
3408
- version: "9.31.0",
3408
+ version: "9.39.1",
3409
3409
  description: "ESLint JavaScript language implementation",
3410
3410
  funding: "https://eslint.org/donate",
3411
3411
  main: "./src/index.js",
@@ -3447,7 +3447,7 @@ var require_eslint_all = __commonJS({
3447
3447
  "node_modules/@eslint/js/src/configs/eslint-all.js"(exports, module) {
3448
3448
  "use strict";
3449
3449
  module.exports = Object.freeze({
3450
- "rules": {
3450
+ rules: Object.freeze({
3451
3451
  "accessor-pairs": "error",
3452
3452
  "array-callback-return": "error",
3453
3453
  "arrow-body-style": "error",
@@ -3631,6 +3631,7 @@ var require_eslint_all = __commonJS({
3631
3631
  "prefer-rest-params": "error",
3632
3632
  "prefer-spread": "error",
3633
3633
  "prefer-template": "error",
3634
+ "preserve-caught-error": "error",
3634
3635
  "radix": "error",
3635
3636
  "require-atomic-updates": "error",
3636
3637
  "require-await": "error",
@@ -3646,7 +3647,7 @@ var require_eslint_all = __commonJS({
3646
3647
  "valid-typeof": "error",
3647
3648
  "vars-on-top": "error",
3648
3649
  "yoda": "error"
3649
- }
3650
+ })
3650
3651
  });
3651
3652
  }
3652
3653
  });
@@ -3743,7 +3744,7 @@ var require_src = __commonJS({
3743
3744
 
3744
3745
  // package.json
3745
3746
  var name = "@alextheman/eslint-plugin";
3746
- var version = "2.9.0";
3747
+ var version = "3.0.1";
3747
3748
 
3748
3749
  // src/configs/index.ts
3749
3750
  import packageJson from "eslint-plugin-package-json";
@@ -3844,14 +3845,14 @@ var import_js = __toESM(require_src(), 1);
3844
3845
  import prettierConfig from "eslint-config-prettier";
3845
3846
  import importPlugin from "eslint-plugin-import";
3846
3847
 
3847
- // src/configs/miscellaneous/javaScriptLanguageOptions.ts
3848
+ // src/configs/helpers/javaScriptLanguageOptions.ts
3848
3849
  var import_globals2 = __toESM(require_globals2(), 1);
3849
3850
  var javaScriptLanguageOptions = {
3850
3851
  globals: __spreadValues(__spreadValues(__spreadValues({}, import_globals2.default.node), import_globals2.default.browser), import_globals2.default.vitest)
3851
3852
  };
3852
3853
  var javaScriptLanguageOptions_default = javaScriptLanguageOptions;
3853
3854
 
3854
- // src/configs/miscellaneous/unusedVarsIgnorePatterns.ts
3855
+ // src/configs/helpers/unusedVarsIgnorePatterns.ts
3855
3856
  var unusedVarsIgnorePatterns = {
3856
3857
  argsIgnorePattern: "^_",
3857
3858
  caughtErrorsIgnorePattern: "^_",
@@ -3910,7 +3911,7 @@ var javaScriptBase_default = javaScriptBase;
3910
3911
  import perfectionist from "eslint-plugin-perfectionist";
3911
3912
  import prettierPlugin from "eslint-plugin-prettier";
3912
3913
 
3913
- // src/configs/miscellaneous/prettierRules.ts
3914
+ // src/configs/helpers/prettierRules.ts
3914
3915
  var prettierRules = {
3915
3916
  printWidth: 100
3916
3917
  };
@@ -3993,10 +3994,20 @@ var javaScriptBase_default3 = createCombinedJavaScriptBaseConfig;
3993
3994
  // src/configs/general/reactBase.ts
3994
3995
  import jsxA11y from "eslint-plugin-jsx-a11y";
3995
3996
  import reactPlugin from "eslint-plugin-react";
3996
- import reactHooks from "eslint-plugin-react-hooks";
3997
3997
  import reactRefresh from "eslint-plugin-react-refresh";
3998
3998
 
3999
- // src/configs/miscellaneous/reactLanguageOptions.ts
3999
+ // src/configs/helpers/reactHooks.ts
4000
+ import { omitProperties } from "@alextheman/utility";
4001
+ import reactHooksPlugin from "eslint-plugin-react-hooks";
4002
+ var reactHooks = __spreadProps(__spreadValues({}, reactHooksPlugin), {
4003
+ configs: __spreadProps(__spreadValues({}, omitProperties(reactHooksPlugin.configs, "flat")), {
4004
+ "flat/recommended": reactHooksPlugin.configs.flat.recommended,
4005
+ "flat/recommended-latest": reactHooksPlugin.configs.flat["recommended-latest"]
4006
+ })
4007
+ });
4008
+ var reactHooks_default = reactHooks;
4009
+
4010
+ // src/configs/helpers/reactLanguageOptions.ts
4000
4011
  var import_globals3 = __toESM(require_globals2(), 1);
4001
4012
  var reactLanguageOptions = {
4002
4013
  ecmaVersion: 2020,
@@ -4019,10 +4030,10 @@ var reactBase = [
4019
4030
  name: "@alextheman/general/react",
4020
4031
  plugins: {
4021
4032
  react: reactPlugin,
4022
- "react-hooks": reactHooks,
4033
+ "react-hooks": reactHooks_default,
4023
4034
  "react-refresh": reactRefresh
4024
4035
  },
4025
- rules: __spreadProps(__spreadValues({}, reactHooks.configs.recommended.rules), {
4036
+ rules: __spreadProps(__spreadValues({}, reactHooks_default.configs["flat/recommended"].rules), {
4026
4037
  "react/destructuring-assignment": ["error", "always", { destructureInSignature: "always" }],
4027
4038
  "react/hook-use-state": "error",
4028
4039
  "react/jsx-curly-brace-presence": [
@@ -4044,7 +4055,6 @@ var reactBase_default = reactBase;
4044
4055
 
4045
4056
  // src/configs/personal/reactBase.ts
4046
4057
  import reactPlugin2 from "eslint-plugin-react";
4047
- import reactHooks2 from "eslint-plugin-react-hooks";
4048
4058
  import reactRefresh2 from "eslint-plugin-react-refresh";
4049
4059
  var personalReactBaseConfig = [
4050
4060
  {
@@ -4052,7 +4062,7 @@ var personalReactBaseConfig = [
4052
4062
  name: "@alextheman/personal/react",
4053
4063
  plugins: {
4054
4064
  react: reactPlugin2,
4055
- "react-hooks": reactHooks2,
4065
+ "react-hooks": reactHooks_default,
4056
4066
  "react-refresh": reactRefresh2
4057
4067
  },
4058
4068
  rules: {
@@ -4068,6 +4078,7 @@ var personalReactBaseConfig = [
4068
4078
  }
4069
4079
  ],
4070
4080
  "react-hooks/exhaustive-deps": "off",
4081
+ "react-hooks/refs": "off",
4071
4082
  "react-refresh/only-export-components": "off",
4072
4083
  "react/jsx-boolean-value": "error"
4073
4084
  }
@@ -4094,12 +4105,12 @@ function createCombinedJavaScriptReactBaseConfig(plugin) {
4094
4105
  var javaScriptReactBase_default = createCombinedJavaScriptReactBaseConfig;
4095
4106
 
4096
4107
  // src/configs/general/typeScriptBase.ts
4097
- import tseslint from "typescript-eslint";
4108
+ import tseslint2 from "typescript-eslint";
4098
4109
 
4099
- // src/configs/miscellaneous/typeScriptLanguageOptions.ts
4100
- import tsparser from "@typescript-eslint/parser";
4110
+ // src/configs/helpers/typeScriptLanguageOptions.ts
4111
+ import tseslint from "typescript-eslint";
4101
4112
  var typeScriptLanguageOptions = {
4102
- parser: tsparser,
4113
+ parser: tseslint.parser,
4103
4114
  parserOptions: {
4104
4115
  ecmaVersion: "latest",
4105
4116
  projectService: true,
@@ -4111,7 +4122,7 @@ var typeScriptLanguageOptions_default = typeScriptLanguageOptions;
4111
4122
 
4112
4123
  // src/configs/general/typeScriptBase.ts
4113
4124
  var typeScriptBase = [
4114
- ...tseslint.configs.recommended,
4125
+ ...tseslint2.configs.recommended,
4115
4126
  ...javaScriptBase_default,
4116
4127
  {
4117
4128
  files: ["**/*.ts", "**/*.tsx"],
@@ -4140,7 +4151,7 @@ var typeScriptBase_default = typeScriptBase;
4140
4151
  // src/configs/personal/eslintPlugin.ts
4141
4152
  import perfectionist2 from "eslint-plugin-perfectionist";
4142
4153
 
4143
- // src/configs/miscellaneous/sortObjects.ts
4154
+ // src/configs/helpers/sortObjects.ts
4144
4155
  var sortObjects = {
4145
4156
  customGroups: [],
4146
4157
  destructuredObjects: true,
@@ -4179,20 +4190,25 @@ function createPersonalEslintPluginConfig(plugin) {
4179
4190
  "no-restricted-imports": [
4180
4191
  "error",
4181
4192
  {
4182
- paths: ["src/alexPlugin", "src/index", "src"].map((name2) => {
4183
- return {
4193
+ paths: [
4194
+ ...["src/alexPlugin", "src/index", "src"].map((name2) => {
4195
+ return {
4196
+ importNames: ["default"],
4197
+ 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.",
4198
+ name: name2
4199
+ };
4200
+ }),
4201
+ {
4184
4202
  importNames: ["default"],
4185
- 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.",
4186
- name: name2
4187
- };
4188
- })
4203
+ message: 'Please import from "src/configs/helpers/reactHooks" instead.',
4204
+ name: "eslint-plugin-react-hooks"
4205
+ }
4206
+ ]
4189
4207
  }
4190
4208
  ]
4191
4209
  }
4192
4210
  },
4193
4211
  {
4194
- // 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
4195
- // as well to make it easier to compare against the file directory.
4196
4212
  files: ["src/rules/index.ts", "src/configs/**"],
4197
4213
  rules: {
4198
4214
  "perfectionist/sort-objects": ["error", sortObjects_default]
@@ -4298,7 +4314,7 @@ var neurosongsFrontEndConfig = [
4298
4314
  var neurosongsFrontEnd_default = neurosongsFrontEndConfig;
4299
4315
 
4300
4316
  // src/configs/personal/typeScriptBase.ts
4301
- import tseslint2 from "typescript-eslint";
4317
+ import tseslint3 from "typescript-eslint";
4302
4318
  function createPersonalTypeScriptBaseConfig(plugin) {
4303
4319
  return [
4304
4320
  {
@@ -4307,7 +4323,7 @@ function createPersonalTypeScriptBaseConfig(plugin) {
4307
4323
  name: "@alextheman/personal/typescript",
4308
4324
  plugins: {
4309
4325
  "@alextheman": plugin,
4310
- "@typescript-eslint": tseslint2.plugin
4326
+ "@typescript-eslint": tseslint3.plugin
4311
4327
  },
4312
4328
  rules: {
4313
4329
  "@alextheman/standardise-error-messages": "error",
@@ -4325,12 +4341,12 @@ function createPersonalTypeScriptBaseConfig(plugin) {
4325
4341
  var typeScriptBase_default2 = createPersonalTypeScriptBaseConfig;
4326
4342
 
4327
4343
  // src/configs/personal/utility.ts
4328
- import tseslint3 from "typescript-eslint";
4344
+ import tseslint4 from "typescript-eslint";
4329
4345
  var utilityConfig = [
4330
4346
  {
4331
4347
  name: "@alextheman/personal/utility",
4332
4348
  plugins: {
4333
- "@typescript-eslint": tseslint3.plugin
4349
+ "@typescript-eslint": tseslint4.plugin
4334
4350
  },
4335
4351
  rules: {
4336
4352
  "@typescript-eslint/explicit-module-boundary-types": "error"
@@ -4458,10 +4474,10 @@ var createRule = ESLintUtils.RuleCreator((ruleName) => {
4458
4474
  var createRule_default = createRule;
4459
4475
 
4460
4476
  // src/utility/createRuleSchema.ts
4461
- import { omitProperties } from "@alextheman/utility";
4477
+ import { omitProperties as omitProperties2 } from "@alextheman/utility";
4462
4478
  import z from "zod";
4463
4479
  function createRuleSchema(schema6) {
4464
- return [omitProperties(z.toJSONSchema(schema6), "$schema")];
4480
+ return [omitProperties2(z.toJSONSchema(schema6), "$schema")];
4465
4481
  }
4466
4482
  var createRuleSchema_default = createRuleSchema;
4467
4483
 
@@ -4919,7 +4935,7 @@ import z6 from "zod";
4919
4935
  var useNormalizedImportsOptionsSchema = z6.object({
4920
4936
  fixable: z6.boolean()
4921
4937
  }).partial();
4922
- function parseUseNormalizedImportsOptionsSchema(data) {
4938
+ function parseUseNormalizedImportsOptions(data) {
4923
4939
  return useNormalizedImportsOptionsSchema.parse(data);
4924
4940
  }
4925
4941
  var schema5 = createRuleSchema_default(useNormalizedImportsOptionsSchema);
@@ -4939,7 +4955,7 @@ var useNormalizedImports = createRule_default({
4939
4955
  defaultOptions: [{ fixable: true }],
4940
4956
  create(context) {
4941
4957
  var _a;
4942
- const { fixable: isFixable } = parseUseNormalizedImportsOptionsSchema(
4958
+ const { fixable: isFixable } = parseUseNormalizedImportsOptions(
4943
4959
  (_a = context.options[0]) != null ? _a : { fixable: true }
4944
4960
  );
4945
4961
  return {
@@ -5033,7 +5049,12 @@ var alexPlugin_default = alexPlugin;
5033
5049
  var index_default = alexPlugin_default;
5034
5050
  export {
5035
5051
  index_default as default,
5052
+ parseConsistentTestFunctionOptions,
5053
+ parseNoNamespaceImportsOptions,
5054
+ parseNoRelativeImportsOptions,
5055
+ parseStandardiseErrorMessagesOptions,
5036
5056
  parseTestFunction,
5057
+ parseUseNormalizedImportsOptions,
5037
5058
  prettierRules_default as prettierRules,
5038
5059
  sortObjects_default as sortObjects
5039
5060
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/eslint-plugin",
3
- "version": "2.9.0",
3
+ "version": "3.0.1",
4
4
  "description": "A package to provide custom ESLint rules and configs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,34 +45,32 @@
45
45
  "@types/common-tags": "^1.8.4",
46
46
  "@types/eslint": "^9.6.1",
47
47
  "@types/eslint-plugin-jsx-a11y": "^6.10.1",
48
- "@types/node": "^24.10.0",
49
- "@typescript-eslint/rule-tester": "^8.46.3",
50
- "@typescript-eslint/utils": "^8.46.3",
48
+ "@types/node": "^24.10.1",
49
+ "@typescript-eslint/rule-tester": "^8.46.4",
50
+ "@typescript-eslint/utils": "^8.46.4",
51
51
  "eslint-plugin-eslint-plugin": "^7.2.0",
52
52
  "globals": "^16.5.0",
53
53
  "husky": "^9.1.7",
54
54
  "jiti": "^2.6.1",
55
55
  "prettier": "^3.6.2",
56
- "tsup": "^8.5.0",
56
+ "tsup": "^8.5.1",
57
57
  "tsx": "^4.20.6",
58
58
  "typescript": "^5.9.3",
59
59
  "vite-tsconfig-paths": "^5.1.4",
60
- "vitest": "^4.0.8"
60
+ "vitest": "^4.0.9"
61
61
  },
62
62
  "peerDependencies": {
63
- "@typescript-eslint/eslint-plugin": "^8.37.0",
64
- "@typescript-eslint/parser": "^8.37.0",
65
- "eslint": "^9.31.0",
63
+ "eslint": "^9.39.1",
66
64
  "eslint-config-prettier": "^10.1.8",
67
65
  "eslint-import-resolver-typescript": "^4.4.4",
68
66
  "eslint-plugin-import": "^2.32.0",
69
67
  "eslint-plugin-jsx-a11y": "^6.10.2",
70
68
  "eslint-plugin-package-json": "^0.74.0",
71
- "eslint-plugin-perfectionist": "^4.15.0",
72
- "eslint-plugin-prettier": "^5.5.3",
69
+ "eslint-plugin-perfectionist": "^4.15.1",
70
+ "eslint-plugin-prettier": "^5.5.4",
73
71
  "eslint-plugin-react": "^7.37.5",
74
- "eslint-plugin-react-hooks": "^5.2.0",
75
- "eslint-plugin-react-refresh": "^0.4.20",
76
- "typescript-eslint": "^8.43.0"
72
+ "eslint-plugin-react-hooks": "^7.0.1",
73
+ "eslint-plugin-react-refresh": "^0.4.24",
74
+ "typescript-eslint": "^8.46.4"
77
75
  }
78
76
  }