@alextheman/eslint-plugin 1.10.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 +84 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +84 -4
- package/package.json +1 -1
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.
|
|
3709
|
+
var version = "1.11.0";
|
|
3710
3710
|
|
|
3711
3711
|
// src/configs/alexPluginBase.ts
|
|
3712
3712
|
function createAlexPluginBaseConfig(plugin2) {
|
|
@@ -3720,6 +3720,13 @@ function createAlexPluginBaseConfig(plugin2) {
|
|
|
3720
3720
|
"@alextheman/no-relative-imports": "error",
|
|
3721
3721
|
"@alextheman/use-object-shorthand": "error"
|
|
3722
3722
|
}
|
|
3723
|
+
},
|
|
3724
|
+
{
|
|
3725
|
+
files: ["**/*.test.ts"],
|
|
3726
|
+
rules: {
|
|
3727
|
+
"@alextheman/no-isolated-tests": "error",
|
|
3728
|
+
"@alextheman/no-skipped-tests": "warn"
|
|
3729
|
+
}
|
|
3723
3730
|
}
|
|
3724
3731
|
];
|
|
3725
3732
|
}
|
|
@@ -3894,6 +3901,45 @@ var createRule = import_utils.ESLintUtils.RuleCreator((ruleName) => {
|
|
|
3894
3901
|
});
|
|
3895
3902
|
var create_rule_default = createRule;
|
|
3896
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
|
+
|
|
3897
3943
|
// src/rules/no-namespace-imports.ts
|
|
3898
3944
|
var noNamespaceImports = create_rule_default({
|
|
3899
3945
|
name: "no-namespace-imports",
|
|
@@ -4073,8 +4119,40 @@ var noRelativeImports = create_rule_default({
|
|
|
4073
4119
|
});
|
|
4074
4120
|
var no_relative_imports_default = noRelativeImports;
|
|
4075
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
|
+
|
|
4076
4154
|
// src/rules/use-object-shorthand.ts
|
|
4077
|
-
var
|
|
4155
|
+
var import_utils3 = require("@typescript-eslint/utils");
|
|
4078
4156
|
var useObjectShorthand = create_rule_default({
|
|
4079
4157
|
name: "use-object-shorthand",
|
|
4080
4158
|
meta: {
|
|
@@ -4092,7 +4170,7 @@ var useObjectShorthand = create_rule_default({
|
|
|
4092
4170
|
create(context) {
|
|
4093
4171
|
return {
|
|
4094
4172
|
Property(node) {
|
|
4095
|
-
if (node.key.type ===
|
|
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) {
|
|
4096
4174
|
context.report({
|
|
4097
4175
|
node,
|
|
4098
4176
|
messageId: "useShorthand",
|
|
@@ -4113,9 +4191,11 @@ var use_object_shorthand_default = useObjectShorthand;
|
|
|
4113
4191
|
|
|
4114
4192
|
// src/rules/index.ts
|
|
4115
4193
|
var rules_default = {
|
|
4194
|
+
"no-isolated-tests": no_isolated_tests_default,
|
|
4116
4195
|
"no-namespace-imports": no_namespace_imports_default,
|
|
4117
|
-
"no-relative-imports": no_relative_imports_default,
|
|
4118
4196
|
"no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default,
|
|
4197
|
+
"no-relative-imports": no_relative_imports_default,
|
|
4198
|
+
"no-skipped-tests": no_skipped_tests_default,
|
|
4119
4199
|
"use-object-shorthand": use_object_shorthand_default
|
|
4120
4200
|
};
|
|
4121
4201
|
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
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.
|
|
3695
|
+
var version = "1.11.0";
|
|
3696
3696
|
|
|
3697
3697
|
// src/configs/alexPluginBase.ts
|
|
3698
3698
|
function createAlexPluginBaseConfig(plugin2) {
|
|
@@ -3706,6 +3706,13 @@ function createAlexPluginBaseConfig(plugin2) {
|
|
|
3706
3706
|
"@alextheman/no-relative-imports": "error",
|
|
3707
3707
|
"@alextheman/use-object-shorthand": "error"
|
|
3708
3708
|
}
|
|
3709
|
+
},
|
|
3710
|
+
{
|
|
3711
|
+
files: ["**/*.test.ts"],
|
|
3712
|
+
rules: {
|
|
3713
|
+
"@alextheman/no-isolated-tests": "error",
|
|
3714
|
+
"@alextheman/no-skipped-tests": "warn"
|
|
3715
|
+
}
|
|
3709
3716
|
}
|
|
3710
3717
|
];
|
|
3711
3718
|
}
|
|
@@ -3880,6 +3887,45 @@ var createRule = ESLintUtils.RuleCreator((ruleName) => {
|
|
|
3880
3887
|
});
|
|
3881
3888
|
var create_rule_default = createRule;
|
|
3882
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
|
+
|
|
3883
3929
|
// src/rules/no-namespace-imports.ts
|
|
3884
3930
|
var noNamespaceImports = create_rule_default({
|
|
3885
3931
|
name: "no-namespace-imports",
|
|
@@ -4059,8 +4105,40 @@ var noRelativeImports = create_rule_default({
|
|
|
4059
4105
|
});
|
|
4060
4106
|
var no_relative_imports_default = noRelativeImports;
|
|
4061
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
|
+
|
|
4062
4140
|
// src/rules/use-object-shorthand.ts
|
|
4063
|
-
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4141
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
|
|
4064
4142
|
var useObjectShorthand = create_rule_default({
|
|
4065
4143
|
name: "use-object-shorthand",
|
|
4066
4144
|
meta: {
|
|
@@ -4078,7 +4156,7 @@ var useObjectShorthand = create_rule_default({
|
|
|
4078
4156
|
create(context) {
|
|
4079
4157
|
return {
|
|
4080
4158
|
Property(node) {
|
|
4081
|
-
if (node.key.type ===
|
|
4159
|
+
if (node.key.type === AST_NODE_TYPES2.Identifier && node.value.type === AST_NODE_TYPES2.Identifier && node.key.name === node.value.name && !node.shorthand) {
|
|
4082
4160
|
context.report({
|
|
4083
4161
|
node,
|
|
4084
4162
|
messageId: "useShorthand",
|
|
@@ -4099,9 +4177,11 @@ var use_object_shorthand_default = useObjectShorthand;
|
|
|
4099
4177
|
|
|
4100
4178
|
// src/rules/index.ts
|
|
4101
4179
|
var rules_default = {
|
|
4180
|
+
"no-isolated-tests": no_isolated_tests_default,
|
|
4102
4181
|
"no-namespace-imports": no_namespace_imports_default,
|
|
4103
|
-
"no-relative-imports": no_relative_imports_default,
|
|
4104
4182
|
"no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default,
|
|
4183
|
+
"no-relative-imports": no_relative_imports_default,
|
|
4184
|
+
"no-skipped-tests": no_skipped_tests_default,
|
|
4105
4185
|
"use-object-shorthand": use_object_shorthand_default
|
|
4106
4186
|
};
|
|
4107
4187
|
|