@alextheman/eslint-plugin 1.9.0 → 1.11.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
@@ -3706,7 +3706,7 @@ module.exports = __toCommonJS(index_exports);
3706
3706
 
3707
3707
  // package.json
3708
3708
  var name = "@alextheman/eslint-plugin";
3709
- var version = "1.9.0";
3709
+ var version = "1.11.0";
3710
3710
 
3711
3711
  // src/configs/alexPluginBase.ts
3712
3712
  function createAlexPluginBaseConfig(plugin2) {
@@ -3717,7 +3717,15 @@ function createAlexPluginBaseConfig(plugin2) {
3717
3717
  },
3718
3718
  rules: {
3719
3719
  "@alextheman/no-namespace-imports": "error",
3720
- "@alextheman/no-relative-imports": "error"
3720
+ "@alextheman/no-relative-imports": "error",
3721
+ "@alextheman/use-object-shorthand": "error"
3722
+ }
3723
+ },
3724
+ {
3725
+ files: ["**/*.test.ts"],
3726
+ rules: {
3727
+ "@alextheman/no-isolated-tests": "error",
3728
+ "@alextheman/no-skipped-tests": "warn"
3721
3729
  }
3722
3730
  }
3723
3731
  ];
@@ -3893,6 +3901,45 @@ var createRule = import_utils.ESLintUtils.RuleCreator((ruleName) => {
3893
3901
  });
3894
3902
  var create_rule_default = createRule;
3895
3903
 
3904
+ // src/utility/checkCallExpression.ts
3905
+ var import_utils2 = require("@typescript-eslint/utils");
3906
+ function checkCallExpression(node, objectName, propertyName) {
3907
+ return node.callee.type === import_utils2.AST_NODE_TYPES.MemberExpression && node.callee.object.type === import_utils2.AST_NODE_TYPES.Identifier && node.callee.object.name === objectName && node.callee.property.type === import_utils2.AST_NODE_TYPES.Identifier && node.callee.property.name === propertyName;
3908
+ }
3909
+ var checkCallExpression_default = checkCallExpression;
3910
+
3911
+ // src/rules/no-isolated-tests.ts
3912
+ var noIsolatedTests = create_rule_default({
3913
+ name: "no-isolated-tests",
3914
+ meta: {
3915
+ docs: {
3916
+ description: "Forbid the use of describe.only() and test.only()"
3917
+ },
3918
+ messages: {
3919
+ message: "Unexpected isolated {{source}}."
3920
+ },
3921
+ type: "suggestion",
3922
+ schema: []
3923
+ },
3924
+ defaultOptions: [],
3925
+ create(context) {
3926
+ return {
3927
+ CallExpression(node) {
3928
+ if (checkCallExpression_default(node, "describe", "only") || checkCallExpression_default(node, "test", "only")) {
3929
+ return context.report({
3930
+ node,
3931
+ messageId: "message",
3932
+ data: {
3933
+ source: node.callee.object.name
3934
+ }
3935
+ });
3936
+ }
3937
+ }
3938
+ };
3939
+ }
3940
+ });
3941
+ var no_isolated_tests_default = noIsolatedTests;
3942
+
3896
3943
  // src/rules/no-namespace-imports.ts
3897
3944
  var noNamespaceImports = create_rule_default({
3898
3945
  name: "no-namespace-imports",
@@ -4072,11 +4119,84 @@ var noRelativeImports = create_rule_default({
4072
4119
  });
4073
4120
  var no_relative_imports_default = noRelativeImports;
4074
4121
 
4122
+ // src/rules/no-skipped-tests.ts
4123
+ var noSkippedTests = create_rule_default({
4124
+ name: "no-skipped-tests",
4125
+ meta: {
4126
+ docs: {
4127
+ description: "Forbid the use of describe.skip() and test.skip()"
4128
+ },
4129
+ messages: {
4130
+ message: "Unexpected skipped {{source}}."
4131
+ },
4132
+ type: "suggestion",
4133
+ schema: []
4134
+ },
4135
+ defaultOptions: [],
4136
+ create(context) {
4137
+ return {
4138
+ CallExpression(node) {
4139
+ if (checkCallExpression_default(node, "describe", "skip") || checkCallExpression_default(node, "test", "skip")) {
4140
+ return context.report({
4141
+ node,
4142
+ messageId: "message",
4143
+ data: {
4144
+ source: node.callee.object.name
4145
+ }
4146
+ });
4147
+ }
4148
+ }
4149
+ };
4150
+ }
4151
+ });
4152
+ var no_skipped_tests_default = noSkippedTests;
4153
+
4154
+ // src/rules/use-object-shorthand.ts
4155
+ var import_utils3 = require("@typescript-eslint/utils");
4156
+ var useObjectShorthand = create_rule_default({
4157
+ name: "use-object-shorthand",
4158
+ meta: {
4159
+ docs: {
4160
+ description: 'Encourage the use of object shorthand (e.g. const property = "Hello"; const object = { property });'
4161
+ },
4162
+ messages: {
4163
+ useShorthand: "{ {{source}} } is not allowed. Please use the object shorthand."
4164
+ },
4165
+ type: "suggestion",
4166
+ fixable: "code",
4167
+ schema: []
4168
+ },
4169
+ defaultOptions: [],
4170
+ create(context) {
4171
+ return {
4172
+ Property(node) {
4173
+ if (node.key.type === import_utils3.AST_NODE_TYPES.Identifier && node.value.type === import_utils3.AST_NODE_TYPES.Identifier && node.key.name === node.value.name && !node.shorthand) {
4174
+ context.report({
4175
+ node,
4176
+ messageId: "useShorthand",
4177
+ data: {
4178
+ source: context.sourceCode.getText(node)
4179
+ },
4180
+ fix(fixer) {
4181
+ const key = node.key;
4182
+ return fixer.replaceTextRange([node.range[0], node.range[1]], key.name);
4183
+ }
4184
+ });
4185
+ }
4186
+ }
4187
+ };
4188
+ }
4189
+ });
4190
+ var use_object_shorthand_default = useObjectShorthand;
4191
+
4075
4192
  // src/rules/index.ts
4076
4193
  var rules_default = {
4194
+ "no-isolated-tests": no_isolated_tests_default,
4077
4195
  "no-namespace-imports": no_namespace_imports_default,
4196
+ "no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default,
4078
4197
  "no-relative-imports": no_relative_imports_default,
4079
- "no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default
4198
+ "no-skipped-tests": no_skipped_tests_default,
4199
+ "use-object-shorthand": use_object_shorthand_default
4080
4200
  };
4081
4201
 
4082
4202
  // src/index.ts
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import { Linter } from 'eslint';
2
2
  import { Config } from 'prettier';
3
3
 
4
4
  var name = "@alextheman/eslint-plugin";
5
- var version = "1.9.0";
5
+ var version = "1.11.0";
6
6
 
7
7
  declare const prettierRules: Config;
8
8
 
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Linter } from 'eslint';
2
2
  import { Config } from 'prettier';
3
3
 
4
4
  var name = "@alextheman/eslint-plugin";
5
- var version = "1.9.0";
5
+ var version = "1.11.0";
6
6
 
7
7
  declare const prettierRules: Config;
8
8
 
package/dist/index.js CHANGED
@@ -3692,7 +3692,7 @@ var require_globals2 = __commonJS({
3692
3692
 
3693
3693
  // package.json
3694
3694
  var name = "@alextheman/eslint-plugin";
3695
- var version = "1.9.0";
3695
+ var version = "1.11.0";
3696
3696
 
3697
3697
  // src/configs/alexPluginBase.ts
3698
3698
  function createAlexPluginBaseConfig(plugin2) {
@@ -3703,7 +3703,15 @@ function createAlexPluginBaseConfig(plugin2) {
3703
3703
  },
3704
3704
  rules: {
3705
3705
  "@alextheman/no-namespace-imports": "error",
3706
- "@alextheman/no-relative-imports": "error"
3706
+ "@alextheman/no-relative-imports": "error",
3707
+ "@alextheman/use-object-shorthand": "error"
3708
+ }
3709
+ },
3710
+ {
3711
+ files: ["**/*.test.ts"],
3712
+ rules: {
3713
+ "@alextheman/no-isolated-tests": "error",
3714
+ "@alextheman/no-skipped-tests": "warn"
3707
3715
  }
3708
3716
  }
3709
3717
  ];
@@ -3879,6 +3887,45 @@ var createRule = ESLintUtils.RuleCreator((ruleName) => {
3879
3887
  });
3880
3888
  var create_rule_default = createRule;
3881
3889
 
3890
+ // src/utility/checkCallExpression.ts
3891
+ import { AST_NODE_TYPES } from "@typescript-eslint/utils";
3892
+ function checkCallExpression(node, objectName, propertyName) {
3893
+ 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;
3894
+ }
3895
+ var checkCallExpression_default = checkCallExpression;
3896
+
3897
+ // src/rules/no-isolated-tests.ts
3898
+ var noIsolatedTests = create_rule_default({
3899
+ name: "no-isolated-tests",
3900
+ meta: {
3901
+ docs: {
3902
+ description: "Forbid the use of describe.only() and test.only()"
3903
+ },
3904
+ messages: {
3905
+ message: "Unexpected isolated {{source}}."
3906
+ },
3907
+ type: "suggestion",
3908
+ schema: []
3909
+ },
3910
+ defaultOptions: [],
3911
+ create(context) {
3912
+ return {
3913
+ CallExpression(node) {
3914
+ if (checkCallExpression_default(node, "describe", "only") || checkCallExpression_default(node, "test", "only")) {
3915
+ return context.report({
3916
+ node,
3917
+ messageId: "message",
3918
+ data: {
3919
+ source: node.callee.object.name
3920
+ }
3921
+ });
3922
+ }
3923
+ }
3924
+ };
3925
+ }
3926
+ });
3927
+ var no_isolated_tests_default = noIsolatedTests;
3928
+
3882
3929
  // src/rules/no-namespace-imports.ts
3883
3930
  var noNamespaceImports = create_rule_default({
3884
3931
  name: "no-namespace-imports",
@@ -4058,11 +4105,84 @@ var noRelativeImports = create_rule_default({
4058
4105
  });
4059
4106
  var no_relative_imports_default = noRelativeImports;
4060
4107
 
4108
+ // src/rules/no-skipped-tests.ts
4109
+ var noSkippedTests = create_rule_default({
4110
+ name: "no-skipped-tests",
4111
+ meta: {
4112
+ docs: {
4113
+ description: "Forbid the use of describe.skip() and test.skip()"
4114
+ },
4115
+ messages: {
4116
+ message: "Unexpected skipped {{source}}."
4117
+ },
4118
+ type: "suggestion",
4119
+ schema: []
4120
+ },
4121
+ defaultOptions: [],
4122
+ create(context) {
4123
+ return {
4124
+ CallExpression(node) {
4125
+ if (checkCallExpression_default(node, "describe", "skip") || checkCallExpression_default(node, "test", "skip")) {
4126
+ return context.report({
4127
+ node,
4128
+ messageId: "message",
4129
+ data: {
4130
+ source: node.callee.object.name
4131
+ }
4132
+ });
4133
+ }
4134
+ }
4135
+ };
4136
+ }
4137
+ });
4138
+ var no_skipped_tests_default = noSkippedTests;
4139
+
4140
+ // src/rules/use-object-shorthand.ts
4141
+ import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
4142
+ var useObjectShorthand = create_rule_default({
4143
+ name: "use-object-shorthand",
4144
+ meta: {
4145
+ docs: {
4146
+ description: 'Encourage the use of object shorthand (e.g. const property = "Hello"; const object = { property });'
4147
+ },
4148
+ messages: {
4149
+ useShorthand: "{ {{source}} } is not allowed. Please use the object shorthand."
4150
+ },
4151
+ type: "suggestion",
4152
+ fixable: "code",
4153
+ schema: []
4154
+ },
4155
+ defaultOptions: [],
4156
+ create(context) {
4157
+ return {
4158
+ Property(node) {
4159
+ if (node.key.type === AST_NODE_TYPES2.Identifier && node.value.type === AST_NODE_TYPES2.Identifier && node.key.name === node.value.name && !node.shorthand) {
4160
+ context.report({
4161
+ node,
4162
+ messageId: "useShorthand",
4163
+ data: {
4164
+ source: context.sourceCode.getText(node)
4165
+ },
4166
+ fix(fixer) {
4167
+ const key = node.key;
4168
+ return fixer.replaceTextRange([node.range[0], node.range[1]], key.name);
4169
+ }
4170
+ });
4171
+ }
4172
+ }
4173
+ };
4174
+ }
4175
+ });
4176
+ var use_object_shorthand_default = useObjectShorthand;
4177
+
4061
4178
  // src/rules/index.ts
4062
4179
  var rules_default = {
4180
+ "no-isolated-tests": no_isolated_tests_default,
4063
4181
  "no-namespace-imports": no_namespace_imports_default,
4182
+ "no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default,
4064
4183
  "no-relative-imports": no_relative_imports_default,
4065
- "no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default
4184
+ "no-skipped-tests": no_skipped_tests_default,
4185
+ "use-object-shorthand": use_object_shorthand_default
4066
4186
  };
4067
4187
 
4068
4188
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/eslint-plugin",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",