@alextheman/eslint-plugin 4.3.0 → 4.4.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
@@ -28,6 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
 
29
29
  //#endregion
30
30
  let __alextheman_utility = require("@alextheman/utility");
31
+ let __typescript_eslint_utils = require("@typescript-eslint/utils");
32
+ let zod = require("zod");
33
+ zod = __toESM(zod);
31
34
  let __eslint_js = require("@eslint/js");
32
35
  __eslint_js = __toESM(__eslint_js);
33
36
  let eslint_config_prettier = require("eslint-config-prettier");
@@ -53,13 +56,10 @@ let eslint_plugin_react_hooks = require("eslint-plugin-react-hooks");
53
56
  eslint_plugin_react_hooks = __toESM(eslint_plugin_react_hooks);
54
57
  let eslint_plugin_package_json = require("eslint-plugin-package-json");
55
58
  eslint_plugin_package_json = __toESM(eslint_plugin_package_json);
56
- let __typescript_eslint_utils = require("@typescript-eslint/utils");
57
- let zod = require("zod");
58
- zod = __toESM(zod);
59
59
 
60
60
  //#region package.json
61
61
  var name = "@alextheman/eslint-plugin";
62
- var version = "4.3.0";
62
+ var version = "4.4.0";
63
63
 
64
64
  //#endregion
65
65
  //#region node_modules/.pnpm/globals@16.5.0/node_modules/globals/globals.json
@@ -3416,8 +3416,62 @@ var require_globals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3416
3416
  }));
3417
3417
 
3418
3418
  //#endregion
3419
- //#region src/configs/personal/testsBase.ts
3419
+ //#region src/configs/helpers/restrictedImports/generalRestrictedImports.ts
3420
3420
  var import_globals$2 = /* @__PURE__ */ __toESM(require_globals(), 1);
3421
+ const generalRestrictedImports = { patterns: [{
3422
+ group: ["node_modules"],
3423
+ message: "Do not import directly from node_modules."
3424
+ }] };
3425
+ var generalRestrictedImports_default = generalRestrictedImports;
3426
+
3427
+ //#endregion
3428
+ //#region src/utility/checkCallExpression.ts
3429
+ function checkCallExpression(node, objectName, propertyName) {
3430
+ return node.callee.type === __typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && node.callee.object.type === __typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.object.name === objectName && node.callee.property.type === __typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.property.name === propertyName;
3431
+ }
3432
+ var checkCallExpression_default = checkCallExpression;
3433
+
3434
+ //#endregion
3435
+ //#region src/utility/combineRestrictedImports.ts
3436
+ function combineRestrictedImports(firstGroup, secondGroup) {
3437
+ const combinedGroup = {
3438
+ paths: [...firstGroup.paths ?? [], ...secondGroup.paths ?? []],
3439
+ patterns: [...firstGroup.patterns ?? [], ...secondGroup.patterns ?? []]
3440
+ };
3441
+ if (combinedGroup.paths.length === 0) return (0, __alextheman_utility.omitProperties)(combinedGroup, "paths");
3442
+ if (combinedGroup.patterns.length === 0) return (0, __alextheman_utility.omitProperties)(combinedGroup, "patterns");
3443
+ return combinedGroup;
3444
+ }
3445
+ var combineRestrictedImports_default = combineRestrictedImports;
3446
+
3447
+ //#endregion
3448
+ //#region src/utility/createRuleSchemaFromZodSchema.ts
3449
+ function createRuleSchemaFromZodSchema(schema$1) {
3450
+ return [(0, __alextheman_utility.omitProperties)(zod.default.toJSONSchema(schema$1), "$schema")];
3451
+ }
3452
+ var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
3453
+
3454
+ //#endregion
3455
+ //#region src/utility/getImportSpecifiersAfterRemoving.ts
3456
+ function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
3457
+ return specifiers.filter((specifier) => {
3458
+ return !(specifier.imported.name === importToRemove);
3459
+ }).map((specifier) => {
3460
+ return context.sourceCode.getText(specifier);
3461
+ }).join(", ");
3462
+ }
3463
+ var getImportSpecifiersAfterRemoving_default = getImportSpecifiersAfterRemoving;
3464
+
3465
+ //#endregion
3466
+ //#region src/configs/helpers/restrictedImports/testsRestrictedImports.ts
3467
+ const testsRestrictedImports = combineRestrictedImports_default(generalRestrictedImports_default, { paths: [{
3468
+ message: "Use test functions from vitest instead.",
3469
+ name: "node:test"
3470
+ }] });
3471
+ var testsRestrictedImports_default = testsRestrictedImports;
3472
+
3473
+ //#endregion
3474
+ //#region src/configs/personal/testsBase.ts
3421
3475
  const personalTestsBaseConfig = [{
3422
3476
  files: ["**/*.test.{js,ts}"],
3423
3477
  languageOptions: { globals: {
@@ -3442,10 +3496,7 @@ const personalTestsBaseConfig = [{
3442
3496
  name: "expect"
3443
3497
  }
3444
3498
  ],
3445
- "no-restricted-imports": ["error", { paths: [{
3446
- message: "Use test functions from vitest instead.",
3447
- name: "node:test"
3448
- }] }]
3499
+ "no-restricted-imports": ["error", testsRestrictedImports_default]
3449
3500
  }
3450
3501
  }];
3451
3502
  var testsBase_default$1 = personalTestsBaseConfig;
@@ -3540,10 +3591,7 @@ const javaScriptBase = [
3540
3591
  "no-lonely-if": "error",
3541
3592
  "no-new-wrappers": "error",
3542
3593
  "no-param-reassign": "error",
3543
- "no-restricted-imports": ["error", { patterns: [{
3544
- group: ["node_modules"],
3545
- message: "What on Earth are you doing? Leave poor node_modules alone!"
3546
- }] }],
3594
+ "no-restricted-imports": ["error", generalRestrictedImports_default],
3547
3595
  "no-undef": "error",
3548
3596
  "no-unused-vars": ["error", unusedVarsIgnorePatterns_default],
3549
3597
  "no-useless-rename": "error",
@@ -3760,6 +3808,14 @@ const reactBase = [
3760
3808
  ];
3761
3809
  var reactBase_default$1 = reactBase;
3762
3810
 
3811
+ //#endregion
3812
+ //#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
3813
+ const reactRestrictedImports = combineRestrictedImports_default(generalRestrictedImports_default, { patterns: [{
3814
+ message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
3815
+ regex: "^@mui/[^/]+$"
3816
+ }] });
3817
+ var reactRestrictedImports_default = reactRestrictedImports;
3818
+
3763
3819
  //#endregion
3764
3820
  //#region src/configs/personal/reactBase.ts
3765
3821
  const personalReactBaseConfig = [{
@@ -3771,10 +3827,7 @@ const personalReactBaseConfig = [{
3771
3827
  "react-refresh": eslint_plugin_react_refresh.default
3772
3828
  },
3773
3829
  rules: {
3774
- "no-restricted-imports": ["error", { patterns: [{
3775
- message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
3776
- regex: "^@mui/[^/]+$"
3777
- }] }],
3830
+ "no-restricted-imports": ["error", reactRestrictedImports_default],
3778
3831
  "react-hooks/exhaustive-deps": "off",
3779
3832
  "react-hooks/refs": "off",
3780
3833
  "react-refresh/only-export-components": "off",
@@ -3828,6 +3881,25 @@ const typeScriptBase = [
3828
3881
  ];
3829
3882
  var typeScriptBase_default$1 = typeScriptBase;
3830
3883
 
3884
+ //#endregion
3885
+ //#region src/configs/helpers/restrictedImports/eslintPluginRestrictedImports.ts
3886
+ const eslintPluginRestrictedImports = combineRestrictedImports_default(generalRestrictedImports_default, { paths: [...[
3887
+ "src/alexPlugin",
3888
+ "src/index",
3889
+ "src"
3890
+ ].map((name$1) => {
3891
+ return {
3892
+ importNames: ["default"],
3893
+ 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.",
3894
+ name: name$1
3895
+ };
3896
+ }), {
3897
+ importNames: ["default"],
3898
+ message: "Please import from \"src/configs/helpers/eslint-plugin-react-hooks\" instead.",
3899
+ name: "eslint-plugin-react-hooks"
3900
+ }] });
3901
+ var eslintPluginRestrictedImports_default = eslintPluginRestrictedImports;
3902
+
3831
3903
  //#endregion
3832
3904
  //#region src/configs/personal/eslintPlugin.ts
3833
3905
  function createPersonalEslintPluginConfig(plugin) {
@@ -3839,21 +3911,7 @@ function createPersonalEslintPluginConfig(plugin) {
3839
3911
  },
3840
3912
  rules: {
3841
3913
  "@alextheman/no-plugin-configs-access-from-src-configs": "error",
3842
- "no-restricted-imports": ["error", { paths: [...[
3843
- "src/alexPlugin",
3844
- "src/index",
3845
- "src"
3846
- ].map((name$1) => {
3847
- return {
3848
- importNames: ["default"],
3849
- 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.",
3850
- name: name$1
3851
- };
3852
- }), {
3853
- importNames: ["default"],
3854
- message: "Please import from \"src/configs/helpers/eslint-plugin-react-hooks\" instead so you don't have to deal with eslint-plugin-react-hooks' ridiculous plugin typing.",
3855
- name: "eslint-plugin-react-hooks"
3856
- }] }]
3914
+ "no-restricted-imports": ["error", eslintPluginRestrictedImports_default]
3857
3915
  }
3858
3916
  }, {
3859
3917
  files: ["src/rules/index.ts", "src/configs/**"],
@@ -3862,27 +3920,32 @@ function createPersonalEslintPluginConfig(plugin) {
3862
3920
  }
3863
3921
  var eslintPlugin_default = createPersonalEslintPluginConfig;
3864
3922
 
3923
+ //#endregion
3924
+ //#region src/configs/helpers/restrictedImports/neurosongsBackEndRestrictedImports.ts
3925
+ const neurosongsBackEndRestrictedImports = combineRestrictedImports_default(generalRestrictedImports_default, { paths: [
3926
+ {
3927
+ importNames: ["setPrismaClient"],
3928
+ message: "Do not attempt to reset the Prisma Client outside setup files.",
3929
+ name: "src/database/client"
3930
+ },
3931
+ {
3932
+ message: "Do not use the generated Prisma types. Use the types exported from @neurosongs/types instead.",
3933
+ name: "@neurosongs/prisma-client/types"
3934
+ },
3935
+ {
3936
+ importNames: ["PrismaClient"],
3937
+ message: "Please use the PrismaClient from @neurosongs/types instead.",
3938
+ name: "@neurosongs/prisma-client/prisma"
3939
+ }
3940
+ ] });
3941
+ var neurosongsBackEndRestrictedImports_default = neurosongsBackEndRestrictedImports;
3942
+
3865
3943
  //#endregion
3866
3944
  //#region src/configs/personal/neurosongsBackEnd.ts
3867
3945
  const neurosongsBackEndConfig = [
3868
3946
  {
3869
3947
  name: "@alextheman/personal/neurosongs-back-end",
3870
- rules: { "no-restricted-imports": ["error", { paths: [
3871
- {
3872
- importNames: ["setPrismaClient"],
3873
- message: "Do not attempt to reset the Prisma Client outside setup files.",
3874
- name: "src/database/client"
3875
- },
3876
- {
3877
- message: "Do not use the generated Prisma types. Use the types exported from @neurosongs/types instead.",
3878
- name: "@neurosongs/prisma-client/types"
3879
- },
3880
- {
3881
- importNames: ["PrismaClient"],
3882
- message: "Please use the PrismaClient from @neurosongs/types instead.",
3883
- name: "@neurosongs/prisma-client/prisma"
3884
- }
3885
- ] }] }
3948
+ rules: { "no-restricted-imports": ["error", neurosongsBackEndRestrictedImports_default] }
3886
3949
  },
3887
3950
  {
3888
3951
  files: ["src/database/**/*.ts", "tests/test-utilities/setup.ts"],
@@ -3899,33 +3962,32 @@ const neurosongsBackEndConfig = [
3899
3962
  ];
3900
3963
  var neurosongsBackEnd_default = neurosongsBackEndConfig;
3901
3964
 
3965
+ //#endregion
3966
+ //#region src/configs/helpers/restrictedImports/neurosongsFrontEndRestrictedImports.ts
3967
+ const neurosongsFrontEndRestrictedImports = combineRestrictedImports_default(reactRestrictedImports_default, {
3968
+ paths: [{
3969
+ importNames: ["PrismaClient"],
3970
+ message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead.",
3971
+ name: "@neurosongs/types"
3972
+ }, ...["LoaderProvider", "Loader"].map((importName) => {
3973
+ return {
3974
+ importNames: [importName],
3975
+ message: `Use the internal ${importName} from src/components/${importName} instead.`,
3976
+ name: "@alextheman/components"
3977
+ };
3978
+ })],
3979
+ patterns: [{
3980
+ group: ["@neurosongs/prisma-client"],
3981
+ message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead."
3982
+ }]
3983
+ });
3984
+ var neurosongsFrontEndRestrictedImports_default = neurosongsFrontEndRestrictedImports;
3985
+
3902
3986
  //#endregion
3903
3987
  //#region src/configs/personal/neurosongsFrontEnd.ts
3904
3988
  const neurosongsFrontEndConfig = [{
3905
3989
  name: "@alextheman/personal/neurosongs-front-end",
3906
- rules: { "no-restricted-imports": ["error", {
3907
- paths: [
3908
- {
3909
- importNames: ["PrismaClient"],
3910
- message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead.",
3911
- name: "@neurosongs/types"
3912
- },
3913
- {
3914
- importNames: ["LoaderProvider"],
3915
- message: "Use the internal LoaderProvider from src/components/LoaderProvider instead.",
3916
- name: "@alextheman/components"
3917
- },
3918
- {
3919
- importNames: ["Loader"],
3920
- message: "Use the internal Loader from src/components/Loader instead.",
3921
- name: "@alextheman/components"
3922
- }
3923
- ],
3924
- patterns: [{
3925
- group: ["@neurosongs/prisma-client"],
3926
- message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead."
3927
- }]
3928
- }] }
3990
+ rules: { "no-restricted-imports": ["error", neurosongsFrontEndRestrictedImports_default] }
3929
3991
  }];
3930
3992
  var neurosongsFrontEnd_default = neurosongsFrontEndConfig;
3931
3993
 
@@ -4082,24 +4144,6 @@ function fixOnCondition(fixable, fix) {
4082
4144
  }
4083
4145
  var fixOnCondition_default = fixOnCondition;
4084
4146
 
4085
- //#endregion
4086
- //#region src/utility/createRuleSchemaFromZodSchema.ts
4087
- function createRuleSchemaFromZodSchema(schema$1) {
4088
- return [(0, __alextheman_utility.omitProperties)(zod.default.toJSONSchema(schema$1), "$schema")];
4089
- }
4090
- var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
4091
-
4092
- //#endregion
4093
- //#region src/utility/getImportSpecifiersAfterRemoving.ts
4094
- function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
4095
- return specifiers.filter((specifier) => {
4096
- return !(specifier.imported.name === importToRemove);
4097
- }).map((specifier) => {
4098
- return context.sourceCode.getText(specifier);
4099
- }).join(", ");
4100
- }
4101
- var getImportSpecifiersAfterRemoving_default = getImportSpecifiersAfterRemoving;
4102
-
4103
4147
  //#endregion
4104
4148
  //#region src/rules/consistent-test-function.ts
4105
4149
  const validTestFunctionsSchema = zod.default.enum(["test", "it"]);
@@ -4198,13 +4242,6 @@ const consistentTestFunction = createRule_default({
4198
4242
  });
4199
4243
  var consistent_test_function_default = consistentTestFunction;
4200
4244
 
4201
- //#endregion
4202
- //#region src/utility/checkCallExpression.ts
4203
- function checkCallExpression(node, objectName, propertyName) {
4204
- return node.callee.type === __typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && node.callee.object.type === __typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.object.name === objectName && node.callee.property.type === __typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.property.name === propertyName;
4205
- }
4206
- var checkCallExpression_default = checkCallExpression;
4207
-
4208
4245
  //#endregion
4209
4246
  //#region src/rules/no-isolated-tests.ts
4210
4247
  const noIsolatedTests = createRule_default({
@@ -4525,6 +4562,7 @@ var src_default = alexPlugin_default;
4525
4562
 
4526
4563
  //#endregion
4527
4564
  exports.checkCallExpression = checkCallExpression_default;
4565
+ exports.combineRestrictedImports = combineRestrictedImports_default;
4528
4566
  exports.createRuleSchemaFromZodSchema = createRuleSchemaFromZodSchema_default;
4529
4567
  exports.default = src_default;
4530
4568
  exports.fixOnCondition = fixOnCondition_default;
package/dist/index.d.cts CHANGED
@@ -113,6 +113,73 @@ declare const unusedVarsIgnorePatterns: {
113
113
  //#region src/configs/helpers/vitestConfig.d.ts
114
114
  declare function vitestConfig(environment?: VitestEnvironment): vite0.UserConfig;
115
115
  //#endregion
116
+ //#region src/configs/helpers/restrictedImports/NoRestrictedImportsOptions.d.ts
117
+ interface RestrictedPathImportBase {
118
+ message: string;
119
+ name: string;
120
+ allowTypeImports?: boolean;
121
+ }
122
+ interface RestrictedPathImportImportNames extends RestrictedPathImportBase {
123
+ importNames: string[];
124
+ allowImportNames?: never;
125
+ }
126
+ interface RestrictedPathImportAllowImportNames extends RestrictedPathImportBase {
127
+ allowImportNames: string[];
128
+ importNames?: never;
129
+ }
130
+ type RestrictedPathImport = RestrictedPathImportBase | RestrictedPathImportImportNames | RestrictedPathImportAllowImportNames;
131
+ interface RestrictedPatternImportBase {
132
+ caseSensitive?: boolean;
133
+ message: string;
134
+ allowTypeImports?: boolean;
135
+ }
136
+ interface RestrictedPatternImportGroup extends RestrictedPatternImportBase {
137
+ group: string[];
138
+ regex?: never;
139
+ }
140
+ interface RestrictedPatternImportRegex extends RestrictedPatternImportBase {
141
+ regex: string;
142
+ group?: never;
143
+ }
144
+ interface RestrictedPatternImportImportNames extends RestrictedPatternImportBase {
145
+ importNames: string[];
146
+ allowImportNames?: never;
147
+ importNamePattern?: never;
148
+ allowImportNamePattern?: never;
149
+ }
150
+ interface RestrictedPatternImportAllowImportNames extends RestrictedPatternImportBase {
151
+ importNames?: never;
152
+ allowImportNames: string[];
153
+ importNamePattern?: never;
154
+ allowImportNamePattern?: never;
155
+ }
156
+ interface RestrictedPatternImportImportNamePattern extends RestrictedPatternImportBase {
157
+ importNames?: never;
158
+ allowImportNames?: never;
159
+ importNamePattern: string;
160
+ allowImportNamePattern?: never;
161
+ }
162
+ interface RestrictedPatternImportAllowImportNamePattern extends RestrictedPatternImportBase {
163
+ importNames?: never;
164
+ allowImportNames?: never;
165
+ importNamePattern?: never;
166
+ allowImportNamePattern: string;
167
+ }
168
+ type RestrictedPatternImport = RestrictedPatternImportGroup | RestrictedPatternImportRegex | RestrictedPatternImportImportNames | RestrictedPatternImportAllowImportNames | RestrictedPatternImportImportNamePattern | RestrictedPatternImportAllowImportNamePattern;
169
+ interface NoRestrictedImportsOptionsPathsOnly {
170
+ paths: RestrictedPathImport[];
171
+ patterns?: never;
172
+ }
173
+ interface NoRestrictedImportsOptionsPatternsOnly {
174
+ paths?: never;
175
+ patterns: RestrictedPatternImport[];
176
+ }
177
+ interface NoRestrictedImportsOptionsPathsAndPatterns {
178
+ paths: RestrictedPathImport[];
179
+ patterns: RestrictedPatternImport[];
180
+ }
181
+ type NoRestrictedImportsOptions = NoRestrictedImportsOptionsPathsOnly | NoRestrictedImportsOptionsPatternsOnly | NoRestrictedImportsOptionsPathsAndPatterns;
182
+ //#endregion
116
183
  //#region src/rules/consistent-test-function.d.ts
117
184
  declare const validTestFunctionsSchema: z.ZodEnum<{
118
185
  test: "test";
@@ -167,10 +234,13 @@ declare function parseUseNormalizedImportsOptions(data: unknown): {
167
234
  //#region src/utility/checkCallExpression.d.ts
168
235
  declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
169
236
  //#endregion
237
+ //#region src/utility/combineRestrictedImports.d.ts
238
+ declare function combineRestrictedImports(firstGroup: NoRestrictedImportsOptions, secondGroup: NoRestrictedImportsOptions): NoRestrictedImportsOptions;
239
+ //#endregion
170
240
  //#region src/utility/createRuleSchemaFromZodSchema.d.ts
171
241
  declare function createRuleSchemaFromZodSchema(schema: z.ZodType): JSONSchema4[];
172
242
  //#endregion
173
243
  //#region src/utility/getImportSpecifiersAfterRemoving.d.ts
174
244
  declare function getImportSpecifiersAfterRemoving(context: Readonly<RuleContext<"message", [ConsistentTestFunctionOptions]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
175
245
  //#endregion
176
- export { type AlexPlugin, AlexPluginConfigGroup, CombinedConfig, ConfigGroupName, ConfigKey, ConsistentTestFunctionOptions, GeneralConfig, NoNamespaceImportsOptions, NoRelativeImportsOptions, PersonalConfig, PluginConfig, RuleFixerFunction, StandardiseErrorMessagesOptions, TestFunction, UseNormalizedImportsOptions, checkCallExpression, createRuleSchemaFromZodSchema, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortExports, sortImports, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns, vitestConfig };
246
+ export { type AlexPlugin, AlexPluginConfigGroup, CombinedConfig, ConfigGroupName, ConfigKey, ConsistentTestFunctionOptions, GeneralConfig, NoNamespaceImportsOptions, NoRelativeImportsOptions, type NoRestrictedImportsOptions, PersonalConfig, PluginConfig, type RestrictedPathImport, type RestrictedPatternImport, RuleFixerFunction, StandardiseErrorMessagesOptions, TestFunction, UseNormalizedImportsOptions, checkCallExpression, combineRestrictedImports, createRuleSchemaFromZodSchema, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortExports, sortImports, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns, vitestConfig };
package/dist/index.d.ts CHANGED
@@ -113,6 +113,73 @@ declare const unusedVarsIgnorePatterns: {
113
113
  //#region src/configs/helpers/vitestConfig.d.ts
114
114
  declare function vitestConfig(environment?: VitestEnvironment): vite0.UserConfig;
115
115
  //#endregion
116
+ //#region src/configs/helpers/restrictedImports/NoRestrictedImportsOptions.d.ts
117
+ interface RestrictedPathImportBase {
118
+ message: string;
119
+ name: string;
120
+ allowTypeImports?: boolean;
121
+ }
122
+ interface RestrictedPathImportImportNames extends RestrictedPathImportBase {
123
+ importNames: string[];
124
+ allowImportNames?: never;
125
+ }
126
+ interface RestrictedPathImportAllowImportNames extends RestrictedPathImportBase {
127
+ allowImportNames: string[];
128
+ importNames?: never;
129
+ }
130
+ type RestrictedPathImport = RestrictedPathImportBase | RestrictedPathImportImportNames | RestrictedPathImportAllowImportNames;
131
+ interface RestrictedPatternImportBase {
132
+ caseSensitive?: boolean;
133
+ message: string;
134
+ allowTypeImports?: boolean;
135
+ }
136
+ interface RestrictedPatternImportGroup extends RestrictedPatternImportBase {
137
+ group: string[];
138
+ regex?: never;
139
+ }
140
+ interface RestrictedPatternImportRegex extends RestrictedPatternImportBase {
141
+ regex: string;
142
+ group?: never;
143
+ }
144
+ interface RestrictedPatternImportImportNames extends RestrictedPatternImportBase {
145
+ importNames: string[];
146
+ allowImportNames?: never;
147
+ importNamePattern?: never;
148
+ allowImportNamePattern?: never;
149
+ }
150
+ interface RestrictedPatternImportAllowImportNames extends RestrictedPatternImportBase {
151
+ importNames?: never;
152
+ allowImportNames: string[];
153
+ importNamePattern?: never;
154
+ allowImportNamePattern?: never;
155
+ }
156
+ interface RestrictedPatternImportImportNamePattern extends RestrictedPatternImportBase {
157
+ importNames?: never;
158
+ allowImportNames?: never;
159
+ importNamePattern: string;
160
+ allowImportNamePattern?: never;
161
+ }
162
+ interface RestrictedPatternImportAllowImportNamePattern extends RestrictedPatternImportBase {
163
+ importNames?: never;
164
+ allowImportNames?: never;
165
+ importNamePattern?: never;
166
+ allowImportNamePattern: string;
167
+ }
168
+ type RestrictedPatternImport = RestrictedPatternImportGroup | RestrictedPatternImportRegex | RestrictedPatternImportImportNames | RestrictedPatternImportAllowImportNames | RestrictedPatternImportImportNamePattern | RestrictedPatternImportAllowImportNamePattern;
169
+ interface NoRestrictedImportsOptionsPathsOnly {
170
+ paths: RestrictedPathImport[];
171
+ patterns?: never;
172
+ }
173
+ interface NoRestrictedImportsOptionsPatternsOnly {
174
+ paths?: never;
175
+ patterns: RestrictedPatternImport[];
176
+ }
177
+ interface NoRestrictedImportsOptionsPathsAndPatterns {
178
+ paths: RestrictedPathImport[];
179
+ patterns: RestrictedPatternImport[];
180
+ }
181
+ type NoRestrictedImportsOptions = NoRestrictedImportsOptionsPathsOnly | NoRestrictedImportsOptionsPatternsOnly | NoRestrictedImportsOptionsPathsAndPatterns;
182
+ //#endregion
116
183
  //#region src/rules/consistent-test-function.d.ts
117
184
  declare const validTestFunctionsSchema: z.ZodEnum<{
118
185
  test: "test";
@@ -167,10 +234,13 @@ declare function parseUseNormalizedImportsOptions(data: unknown): {
167
234
  //#region src/utility/checkCallExpression.d.ts
168
235
  declare function checkCallExpression(node: TSESTree.CallExpression, objectName: string, propertyName: string): boolean;
169
236
  //#endregion
237
+ //#region src/utility/combineRestrictedImports.d.ts
238
+ declare function combineRestrictedImports(firstGroup: NoRestrictedImportsOptions, secondGroup: NoRestrictedImportsOptions): NoRestrictedImportsOptions;
239
+ //#endregion
170
240
  //#region src/utility/createRuleSchemaFromZodSchema.d.ts
171
241
  declare function createRuleSchemaFromZodSchema(schema: z.ZodType): JSONSchema4[];
172
242
  //#endregion
173
243
  //#region src/utility/getImportSpecifiersAfterRemoving.d.ts
174
244
  declare function getImportSpecifiersAfterRemoving(context: Readonly<RuleContext<"message", [ConsistentTestFunctionOptions]>>, specifiers: TSESTree.ImportClause[], importToRemove: string): string;
175
245
  //#endregion
176
- export { type AlexPlugin, AlexPluginConfigGroup, CombinedConfig, ConfigGroupName, ConfigKey, type ConsistentTestFunctionOptions, GeneralConfig, type NoNamespaceImportsOptions, type NoRelativeImportsOptions, PersonalConfig, PluginConfig, type RuleFixerFunction, type StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, checkCallExpression, createRuleSchemaFromZodSchema, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortExports, sortImports, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns, vitestConfig };
246
+ export { type AlexPlugin, AlexPluginConfigGroup, CombinedConfig, ConfigGroupName, ConfigKey, type ConsistentTestFunctionOptions, GeneralConfig, type NoNamespaceImportsOptions, type NoRelativeImportsOptions, type NoRestrictedImportsOptions, PersonalConfig, PluginConfig, type RestrictedPathImport, type RestrictedPatternImport, type RuleFixerFunction, type StandardiseErrorMessagesOptions, type TestFunction, type UseNormalizedImportsOptions, checkCallExpression, combineRestrictedImports, createRuleSchemaFromZodSchema, alexPlugin as default, fixOnCondition, getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules, reactLanguageOptions, sortExports, sortImports, sortObjects, typeScriptLanguageOptions, unusedVarsIgnorePatterns, vitestConfig };
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { camelToKebab, deepCopy, deepFreeze, normalizeImportPath, omitProperties } from "@alextheman/utility";
2
+ import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
3
+ import z from "zod";
2
4
  import js from "@eslint/js";
3
5
  import prettierConfig from "eslint-config-prettier";
4
6
  import importPlugin from "eslint-plugin-import";
@@ -12,8 +14,6 @@ import reactPlugin from "eslint-plugin-react";
12
14
  import reactRefresh from "eslint-plugin-react-refresh";
13
15
  import reactHooksPlugin from "eslint-plugin-react-hooks";
14
16
  import packageJson from "eslint-plugin-package-json";
15
- import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
16
- import z from "zod";
17
17
 
18
18
  //#region rolldown:runtime
19
19
  var __create = Object.create;
@@ -45,7 +45,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
45
45
  //#endregion
46
46
  //#region package.json
47
47
  var name = "@alextheman/eslint-plugin";
48
- var version = "4.3.0";
48
+ var version = "4.4.0";
49
49
 
50
50
  //#endregion
51
51
  //#region node_modules/.pnpm/globals@16.5.0/node_modules/globals/globals.json
@@ -3402,8 +3402,62 @@ var require_globals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3402
3402
  }));
3403
3403
 
3404
3404
  //#endregion
3405
- //#region src/configs/personal/testsBase.ts
3405
+ //#region src/configs/helpers/restrictedImports/generalRestrictedImports.ts
3406
3406
  var import_globals$2 = /* @__PURE__ */ __toESM(require_globals(), 1);
3407
+ const generalRestrictedImports = { patterns: [{
3408
+ group: ["node_modules"],
3409
+ message: "Do not import directly from node_modules."
3410
+ }] };
3411
+ var generalRestrictedImports_default = generalRestrictedImports;
3412
+
3413
+ //#endregion
3414
+ //#region src/utility/checkCallExpression.ts
3415
+ function checkCallExpression(node, objectName, propertyName) {
3416
+ return node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.object.name === objectName && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === propertyName;
3417
+ }
3418
+ var checkCallExpression_default = checkCallExpression;
3419
+
3420
+ //#endregion
3421
+ //#region src/utility/combineRestrictedImports.ts
3422
+ function combineRestrictedImports(firstGroup, secondGroup) {
3423
+ const combinedGroup = {
3424
+ paths: [...firstGroup.paths ?? [], ...secondGroup.paths ?? []],
3425
+ patterns: [...firstGroup.patterns ?? [], ...secondGroup.patterns ?? []]
3426
+ };
3427
+ if (combinedGroup.paths.length === 0) return omitProperties(combinedGroup, "paths");
3428
+ if (combinedGroup.patterns.length === 0) return omitProperties(combinedGroup, "patterns");
3429
+ return combinedGroup;
3430
+ }
3431
+ var combineRestrictedImports_default = combineRestrictedImports;
3432
+
3433
+ //#endregion
3434
+ //#region src/utility/createRuleSchemaFromZodSchema.ts
3435
+ function createRuleSchemaFromZodSchema(schema$1) {
3436
+ return [omitProperties(z.toJSONSchema(schema$1), "$schema")];
3437
+ }
3438
+ var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
3439
+
3440
+ //#endregion
3441
+ //#region src/utility/getImportSpecifiersAfterRemoving.ts
3442
+ function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
3443
+ return specifiers.filter((specifier) => {
3444
+ return !(specifier.imported.name === importToRemove);
3445
+ }).map((specifier) => {
3446
+ return context.sourceCode.getText(specifier);
3447
+ }).join(", ");
3448
+ }
3449
+ var getImportSpecifiersAfterRemoving_default = getImportSpecifiersAfterRemoving;
3450
+
3451
+ //#endregion
3452
+ //#region src/configs/helpers/restrictedImports/testsRestrictedImports.ts
3453
+ const testsRestrictedImports = combineRestrictedImports_default(generalRestrictedImports_default, { paths: [{
3454
+ message: "Use test functions from vitest instead.",
3455
+ name: "node:test"
3456
+ }] });
3457
+ var testsRestrictedImports_default = testsRestrictedImports;
3458
+
3459
+ //#endregion
3460
+ //#region src/configs/personal/testsBase.ts
3407
3461
  const personalTestsBaseConfig = [{
3408
3462
  files: ["**/*.test.{js,ts}"],
3409
3463
  languageOptions: { globals: {
@@ -3428,10 +3482,7 @@ const personalTestsBaseConfig = [{
3428
3482
  name: "expect"
3429
3483
  }
3430
3484
  ],
3431
- "no-restricted-imports": ["error", { paths: [{
3432
- message: "Use test functions from vitest instead.",
3433
- name: "node:test"
3434
- }] }]
3485
+ "no-restricted-imports": ["error", testsRestrictedImports_default]
3435
3486
  }
3436
3487
  }];
3437
3488
  var testsBase_default$1 = personalTestsBaseConfig;
@@ -3526,10 +3577,7 @@ const javaScriptBase = [
3526
3577
  "no-lonely-if": "error",
3527
3578
  "no-new-wrappers": "error",
3528
3579
  "no-param-reassign": "error",
3529
- "no-restricted-imports": ["error", { patterns: [{
3530
- group: ["node_modules"],
3531
- message: "What on Earth are you doing? Leave poor node_modules alone!"
3532
- }] }],
3580
+ "no-restricted-imports": ["error", generalRestrictedImports_default],
3533
3581
  "no-undef": "error",
3534
3582
  "no-unused-vars": ["error", unusedVarsIgnorePatterns_default],
3535
3583
  "no-useless-rename": "error",
@@ -3746,6 +3794,14 @@ const reactBase = [
3746
3794
  ];
3747
3795
  var reactBase_default$1 = reactBase;
3748
3796
 
3797
+ //#endregion
3798
+ //#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
3799
+ const reactRestrictedImports = combineRestrictedImports_default(generalRestrictedImports_default, { patterns: [{
3800
+ message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
3801
+ regex: "^@mui/[^/]+$"
3802
+ }] });
3803
+ var reactRestrictedImports_default = reactRestrictedImports;
3804
+
3749
3805
  //#endregion
3750
3806
  //#region src/configs/personal/reactBase.ts
3751
3807
  const personalReactBaseConfig = [{
@@ -3757,10 +3813,7 @@ const personalReactBaseConfig = [{
3757
3813
  "react-refresh": reactRefresh
3758
3814
  },
3759
3815
  rules: {
3760
- "no-restricted-imports": ["error", { patterns: [{
3761
- message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
3762
- regex: "^@mui/[^/]+$"
3763
- }] }],
3816
+ "no-restricted-imports": ["error", reactRestrictedImports_default],
3764
3817
  "react-hooks/exhaustive-deps": "off",
3765
3818
  "react-hooks/refs": "off",
3766
3819
  "react-refresh/only-export-components": "off",
@@ -3814,6 +3867,25 @@ const typeScriptBase = [
3814
3867
  ];
3815
3868
  var typeScriptBase_default$1 = typeScriptBase;
3816
3869
 
3870
+ //#endregion
3871
+ //#region src/configs/helpers/restrictedImports/eslintPluginRestrictedImports.ts
3872
+ const eslintPluginRestrictedImports = combineRestrictedImports_default(generalRestrictedImports_default, { paths: [...[
3873
+ "src/alexPlugin",
3874
+ "src/index",
3875
+ "src"
3876
+ ].map((name$1) => {
3877
+ return {
3878
+ importNames: ["default"],
3879
+ 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.",
3880
+ name: name$1
3881
+ };
3882
+ }), {
3883
+ importNames: ["default"],
3884
+ message: "Please import from \"src/configs/helpers/eslint-plugin-react-hooks\" instead.",
3885
+ name: "eslint-plugin-react-hooks"
3886
+ }] });
3887
+ var eslintPluginRestrictedImports_default = eslintPluginRestrictedImports;
3888
+
3817
3889
  //#endregion
3818
3890
  //#region src/configs/personal/eslintPlugin.ts
3819
3891
  function createPersonalEslintPluginConfig(plugin) {
@@ -3825,21 +3897,7 @@ function createPersonalEslintPluginConfig(plugin) {
3825
3897
  },
3826
3898
  rules: {
3827
3899
  "@alextheman/no-plugin-configs-access-from-src-configs": "error",
3828
- "no-restricted-imports": ["error", { paths: [...[
3829
- "src/alexPlugin",
3830
- "src/index",
3831
- "src"
3832
- ].map((name$1) => {
3833
- return {
3834
- importNames: ["default"],
3835
- 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.",
3836
- name: name$1
3837
- };
3838
- }), {
3839
- importNames: ["default"],
3840
- message: "Please import from \"src/configs/helpers/eslint-plugin-react-hooks\" instead so you don't have to deal with eslint-plugin-react-hooks' ridiculous plugin typing.",
3841
- name: "eslint-plugin-react-hooks"
3842
- }] }]
3900
+ "no-restricted-imports": ["error", eslintPluginRestrictedImports_default]
3843
3901
  }
3844
3902
  }, {
3845
3903
  files: ["src/rules/index.ts", "src/configs/**"],
@@ -3848,27 +3906,32 @@ function createPersonalEslintPluginConfig(plugin) {
3848
3906
  }
3849
3907
  var eslintPlugin_default = createPersonalEslintPluginConfig;
3850
3908
 
3909
+ //#endregion
3910
+ //#region src/configs/helpers/restrictedImports/neurosongsBackEndRestrictedImports.ts
3911
+ const neurosongsBackEndRestrictedImports = combineRestrictedImports_default(generalRestrictedImports_default, { paths: [
3912
+ {
3913
+ importNames: ["setPrismaClient"],
3914
+ message: "Do not attempt to reset the Prisma Client outside setup files.",
3915
+ name: "src/database/client"
3916
+ },
3917
+ {
3918
+ message: "Do not use the generated Prisma types. Use the types exported from @neurosongs/types instead.",
3919
+ name: "@neurosongs/prisma-client/types"
3920
+ },
3921
+ {
3922
+ importNames: ["PrismaClient"],
3923
+ message: "Please use the PrismaClient from @neurosongs/types instead.",
3924
+ name: "@neurosongs/prisma-client/prisma"
3925
+ }
3926
+ ] });
3927
+ var neurosongsBackEndRestrictedImports_default = neurosongsBackEndRestrictedImports;
3928
+
3851
3929
  //#endregion
3852
3930
  //#region src/configs/personal/neurosongsBackEnd.ts
3853
3931
  const neurosongsBackEndConfig = [
3854
3932
  {
3855
3933
  name: "@alextheman/personal/neurosongs-back-end",
3856
- rules: { "no-restricted-imports": ["error", { paths: [
3857
- {
3858
- importNames: ["setPrismaClient"],
3859
- message: "Do not attempt to reset the Prisma Client outside setup files.",
3860
- name: "src/database/client"
3861
- },
3862
- {
3863
- message: "Do not use the generated Prisma types. Use the types exported from @neurosongs/types instead.",
3864
- name: "@neurosongs/prisma-client/types"
3865
- },
3866
- {
3867
- importNames: ["PrismaClient"],
3868
- message: "Please use the PrismaClient from @neurosongs/types instead.",
3869
- name: "@neurosongs/prisma-client/prisma"
3870
- }
3871
- ] }] }
3934
+ rules: { "no-restricted-imports": ["error", neurosongsBackEndRestrictedImports_default] }
3872
3935
  },
3873
3936
  {
3874
3937
  files: ["src/database/**/*.ts", "tests/test-utilities/setup.ts"],
@@ -3885,33 +3948,32 @@ const neurosongsBackEndConfig = [
3885
3948
  ];
3886
3949
  var neurosongsBackEnd_default = neurosongsBackEndConfig;
3887
3950
 
3951
+ //#endregion
3952
+ //#region src/configs/helpers/restrictedImports/neurosongsFrontEndRestrictedImports.ts
3953
+ const neurosongsFrontEndRestrictedImports = combineRestrictedImports_default(reactRestrictedImports_default, {
3954
+ paths: [{
3955
+ importNames: ["PrismaClient"],
3956
+ message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead.",
3957
+ name: "@neurosongs/types"
3958
+ }, ...["LoaderProvider", "Loader"].map((importName) => {
3959
+ return {
3960
+ importNames: [importName],
3961
+ message: `Use the internal ${importName} from src/components/${importName} instead.`,
3962
+ name: "@alextheman/components"
3963
+ };
3964
+ })],
3965
+ patterns: [{
3966
+ group: ["@neurosongs/prisma-client"],
3967
+ message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead."
3968
+ }]
3969
+ });
3970
+ var neurosongsFrontEndRestrictedImports_default = neurosongsFrontEndRestrictedImports;
3971
+
3888
3972
  //#endregion
3889
3973
  //#region src/configs/personal/neurosongsFrontEnd.ts
3890
3974
  const neurosongsFrontEndConfig = [{
3891
3975
  name: "@alextheman/personal/neurosongs-front-end",
3892
- rules: { "no-restricted-imports": ["error", {
3893
- paths: [
3894
- {
3895
- importNames: ["PrismaClient"],
3896
- message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead.",
3897
- name: "@neurosongs/types"
3898
- },
3899
- {
3900
- importNames: ["LoaderProvider"],
3901
- message: "Use the internal LoaderProvider from src/components/LoaderProvider instead.",
3902
- name: "@alextheman/components"
3903
- },
3904
- {
3905
- importNames: ["Loader"],
3906
- message: "Use the internal Loader from src/components/Loader instead.",
3907
- name: "@alextheman/components"
3908
- }
3909
- ],
3910
- patterns: [{
3911
- group: ["@neurosongs/prisma-client"],
3912
- message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead."
3913
- }]
3914
- }] }
3976
+ rules: { "no-restricted-imports": ["error", neurosongsFrontEndRestrictedImports_default] }
3915
3977
  }];
3916
3978
  var neurosongsFrontEnd_default = neurosongsFrontEndConfig;
3917
3979
 
@@ -4068,24 +4130,6 @@ function fixOnCondition(fixable, fix) {
4068
4130
  }
4069
4131
  var fixOnCondition_default = fixOnCondition;
4070
4132
 
4071
- //#endregion
4072
- //#region src/utility/createRuleSchemaFromZodSchema.ts
4073
- function createRuleSchemaFromZodSchema(schema$1) {
4074
- return [omitProperties(z.toJSONSchema(schema$1), "$schema")];
4075
- }
4076
- var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
4077
-
4078
- //#endregion
4079
- //#region src/utility/getImportSpecifiersAfterRemoving.ts
4080
- function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
4081
- return specifiers.filter((specifier) => {
4082
- return !(specifier.imported.name === importToRemove);
4083
- }).map((specifier) => {
4084
- return context.sourceCode.getText(specifier);
4085
- }).join(", ");
4086
- }
4087
- var getImportSpecifiersAfterRemoving_default = getImportSpecifiersAfterRemoving;
4088
-
4089
4133
  //#endregion
4090
4134
  //#region src/rules/consistent-test-function.ts
4091
4135
  const validTestFunctionsSchema = z.enum(["test", "it"]);
@@ -4184,13 +4228,6 @@ const consistentTestFunction = createRule_default({
4184
4228
  });
4185
4229
  var consistent_test_function_default = consistentTestFunction;
4186
4230
 
4187
- //#endregion
4188
- //#region src/utility/checkCallExpression.ts
4189
- function checkCallExpression(node, objectName, propertyName) {
4190
- return node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.object.name === objectName && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === propertyName;
4191
- }
4192
- var checkCallExpression_default = checkCallExpression;
4193
-
4194
4231
  //#endregion
4195
4232
  //#region src/rules/no-isolated-tests.ts
4196
4233
  const noIsolatedTests = createRule_default({
@@ -4510,4 +4547,4 @@ var alexPlugin_default = alexPlugin;
4510
4547
  var src_default = alexPlugin_default;
4511
4548
 
4512
4549
  //#endregion
4513
- export { checkCallExpression_default as checkCallExpression, createRuleSchemaFromZodSchema_default as createRuleSchemaFromZodSchema, src_default as default, fixOnCondition_default as fixOnCondition, getImportSpecifiersAfterRemoving_default as getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules_default as prettierRules, reactLanguageOptions_default as reactLanguageOptions, sortExports_default as sortExports, sortImports_default as sortImports, sortObjects_default as sortObjects, typeScriptLanguageOptions_default as typeScriptLanguageOptions, unusedVarsIgnorePatterns_default as unusedVarsIgnorePatterns, vitestConfig_default as vitestConfig };
4550
+ export { checkCallExpression_default as checkCallExpression, combineRestrictedImports_default as combineRestrictedImports, createRuleSchemaFromZodSchema_default as createRuleSchemaFromZodSchema, src_default as default, fixOnCondition_default as fixOnCondition, getImportSpecifiersAfterRemoving_default as getImportSpecifiersAfterRemoving, parseConsistentTestFunctionOptions, parseNoNamespaceImportsOptions, parseNoRelativeImportsOptions, parseStandardiseErrorMessagesOptions, parseTestFunction, parseUseNormalizedImportsOptions, prettierRules_default as prettierRules, reactLanguageOptions_default as reactLanguageOptions, sortExports_default as sortExports, sortImports_default as sortImports, sortObjects_default as sortObjects, typeScriptLanguageOptions_default as typeScriptLanguageOptions, unusedVarsIgnorePatterns_default as unusedVarsIgnorePatterns, vitestConfig_default as vitestConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/eslint-plugin",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "A package to provide custom ESLint rules and configs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,34 +14,9 @@
14
14
  "files": [
15
15
  "dist"
16
16
  ],
17
- "scripts": {
18
- "build": "tsdown && tsx src/utility/hashConfigChanges.ts",
19
- "change-major": "pnpm version major -m \"Change version number to v%s\"",
20
- "change-minor": "pnpm version minor -m \"Change version number to v%s\"",
21
- "change-patch": "pnpm version patch -m \"Change version number to v%s\"",
22
- "create-local-package": "pnpm run build && rm -f alextheman-eslint-plugin-*.tgz && pnpm pack",
23
- "format": "pnpm run format-prettier && pnpm run format-eslint",
24
- "format-and-build": "tsx src/utility/checkConfigChanges.ts || pnpm run build && pnpm run format",
25
- "format-eslint": "eslint --fix --suppress-all \"src/**/*.ts\" \"tests/**/*.ts\" \"package.json\" && rm -f eslint-suppressions.json",
26
- "format-prettier": "pnpm run format-prettier-typescript && pnpm run format-prettier-javascript",
27
- "format-prettier-javascript": "prettier --write \"./**/*.js\"",
28
- "format-prettier-typescript": "prettier --write --parser typescript \"./**/*.ts\"",
29
- "lint": "pnpm run lint-tsc && pnpm run lint-eslint && pnpm run lint-prettier",
30
- "lint-and-build": "tsx src/utility/checkConfigChanges.ts || pnpm run build && pnpm run lint",
31
- "lint-eslint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" \"package.json\"",
32
- "lint-prettier": "pnpm run lint-prettier-typescript && pnpm run lint-prettier-javascript",
33
- "lint-prettier-javascript": "prettier --check \"./**/*.js\"",
34
- "lint-prettier-typescript": "prettier --check --parser typescript \"./**/*.ts\"",
35
- "lint-tsc": "tsc --noEmit",
36
- "prepare": "husky",
37
- "test": "vitest run",
38
- "test-watch": "vitest",
39
- "use-live-utility": "pnpm uninstall @alextheman/utility && pnpm install @alextheman/utility",
40
- "use-local-utility": "dotenv -e .env -- sh -c 'UTILITY_PATH=${LOCAL_UTILITY_PATH:-../utility}; pnpm --dir \"$UTILITY_PATH\" run create-local-package && pnpm uninstall @alextheman/utility && pnpm install \"$UTILITY_PATH\"/alextheman-utility-*.tgz'"
41
- },
42
17
  "dependencies": {
43
- "@alextheman/utility": "^3.4.0",
44
- "@typescript-eslint/utils": "^8.48.0",
18
+ "@alextheman/utility": "^3.4.2",
19
+ "@typescript-eslint/utils": "^8.48.1",
45
20
  "common-tags": "^1.8.2",
46
21
  "zod": "^4.1.13"
47
22
  },
@@ -51,7 +26,7 @@
51
26
  "@types/eslint": "^9.6.1",
52
27
  "@types/eslint-plugin-jsx-a11y": "^6.10.1",
53
28
  "@types/node": "^24.10.1",
54
- "@typescript-eslint/rule-tester": "^8.48.0",
29
+ "@typescript-eslint/rule-tester": "^8.48.1",
55
30
  "dotenv-cli": "^11.0.0",
56
31
  "eslint": "^9.39.1",
57
32
  "eslint-config-prettier": "^10.1.8",
@@ -68,13 +43,13 @@
68
43
  "globals": "^16.5.0",
69
44
  "husky": "^9.1.7",
70
45
  "jsdom": "^27.2.0",
71
- "prettier": "^3.7.2",
72
- "tsdown": "^0.16.8",
73
- "tsx": "^4.20.6",
46
+ "prettier": "^3.7.4",
47
+ "tsdown": "^0.17.0",
48
+ "tsx": "^4.21.0",
74
49
  "typescript": "^5.9.3",
75
- "typescript-eslint": "^8.48.0",
50
+ "typescript-eslint": "^8.48.1",
76
51
  "vite-tsconfig-paths": "^5.1.4",
77
- "vitest": "^4.0.14"
52
+ "vitest": "^4.0.15"
78
53
  },
79
54
  "peerDependencies": {
80
55
  "@eslint/js": ">=9.0.0",
@@ -93,5 +68,29 @@
93
68
  "vite-tsconfig-paths": ">=5.1.4",
94
69
  "vitest": ">=4.0.13"
95
70
  },
96
- "packageManager": "pnpm@10.24.0+sha512.01ff8ae71b4419903b65c60fb2dc9d34cf8bb6e06d03bde112ef38f7a34d6904c424ba66bea5cdcf12890230bf39f9580473140ed9c946fef328b6e5238a345a"
97
- }
71
+ "scripts": {
72
+ "build": "tsdown && tsx src/utility/hashConfigChanges.ts",
73
+ "change-major": "pnpm version major -m \"Change version number to v%s\"",
74
+ "change-minor": "pnpm version minor -m \"Change version number to v%s\"",
75
+ "change-patch": "pnpm version patch -m \"Change version number to v%s\"",
76
+ "create-local-package": "pnpm run build && rm -f alextheman-eslint-plugin-*.tgz && pnpm pack",
77
+ "format": "pnpm run format-prettier && pnpm run format-eslint",
78
+ "format-and-build": "tsx src/utility/checkConfigChanges.ts || pnpm run build && pnpm run format",
79
+ "format-eslint": "eslint --fix --suppress-all \"src/**/*.ts\" \"tests/**/*.ts\" \"package.json\" && rm -f eslint-suppressions.json",
80
+ "format-prettier": "pnpm run format-prettier-typescript && pnpm run format-prettier-javascript",
81
+ "format-prettier-javascript": "prettier --write \"./**/*.js\"",
82
+ "format-prettier-typescript": "prettier --write --parser typescript \"./**/*.ts\"",
83
+ "lint": "pnpm run lint-tsc && pnpm run lint-eslint && pnpm run lint-prettier",
84
+ "lint-and-build": "tsx src/utility/checkConfigChanges.ts || pnpm run build && pnpm run lint",
85
+ "lint-eslint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" \"package.json\"",
86
+ "lint-prettier": "pnpm run lint-prettier-typescript && pnpm run lint-prettier-javascript",
87
+ "lint-prettier-javascript": "prettier --check \"./**/*.js\"",
88
+ "lint-prettier-typescript": "prettier --check --parser typescript \"./**/*.ts\"",
89
+ "lint-tsc": "tsc --noEmit",
90
+ "test": "vitest run",
91
+ "test-watch": "vitest",
92
+ "update-dependencies": "pnpm update --latest && pnpm update",
93
+ "use-live-utility": "pnpm uninstall @alextheman/utility && pnpm install @alextheman/utility",
94
+ "use-local-utility": "dotenv -e .env -- sh -c 'UTILITY_PATH=${LOCAL_UTILITY_PATH:-../utility}; pnpm --dir \"$UTILITY_PATH\" run create-local-package && pnpm uninstall @alextheman/utility && pnpm install \"$UTILITY_PATH\"/alextheman-utility-*.tgz'"
95
+ }
96
+ }