@alextheman/eslint-plugin 1.10.0 → 1.11.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 +101 -16
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +101 -16
- 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.1";
|
|
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
|
}
|
|
@@ -3747,7 +3754,7 @@ var typeScriptBase = [
|
|
|
3747
3754
|
import_eslint_config_prettier.default,
|
|
3748
3755
|
{
|
|
3749
3756
|
name: "@alextheman/eslint-config-typescript-base",
|
|
3750
|
-
files: ["**/*.ts", "**/*.tsx"
|
|
3757
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
3751
3758
|
languageOptions: {
|
|
3752
3759
|
parser: import_parser.default,
|
|
3753
3760
|
parserOptions: {
|
|
@@ -3773,17 +3780,6 @@ var typeScriptBase = [
|
|
|
3773
3780
|
"import/no-unresolved": "error",
|
|
3774
3781
|
eqeqeq: "error",
|
|
3775
3782
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
3776
|
-
"no-restricted-imports": [
|
|
3777
|
-
"error",
|
|
3778
|
-
{
|
|
3779
|
-
patterns: [
|
|
3780
|
-
{
|
|
3781
|
-
group: ["node:test"],
|
|
3782
|
-
message: "Use test functions from vitest instead."
|
|
3783
|
-
}
|
|
3784
|
-
]
|
|
3785
|
-
}
|
|
3786
|
-
],
|
|
3787
3783
|
"perfectionist/sort-imports": [
|
|
3788
3784
|
"error",
|
|
3789
3785
|
{
|
|
@@ -3834,6 +3830,22 @@ var typeScriptBase = [
|
|
|
3834
3830
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
3835
3831
|
"prettier/prettier": ["warn", prettierRules_default]
|
|
3836
3832
|
}
|
|
3833
|
+
},
|
|
3834
|
+
{
|
|
3835
|
+
files: ["**/*.test.ts"],
|
|
3836
|
+
rules: {
|
|
3837
|
+
"no-restricted-imports": [
|
|
3838
|
+
"error",
|
|
3839
|
+
{
|
|
3840
|
+
patterns: [
|
|
3841
|
+
{
|
|
3842
|
+
group: ["node:test"],
|
|
3843
|
+
message: "Use test functions from vitest instead."
|
|
3844
|
+
}
|
|
3845
|
+
]
|
|
3846
|
+
}
|
|
3847
|
+
]
|
|
3848
|
+
}
|
|
3837
3849
|
}
|
|
3838
3850
|
];
|
|
3839
3851
|
var typeScriptBase_default = typeScriptBase;
|
|
@@ -3894,6 +3906,45 @@ var createRule = import_utils.ESLintUtils.RuleCreator((ruleName) => {
|
|
|
3894
3906
|
});
|
|
3895
3907
|
var create_rule_default = createRule;
|
|
3896
3908
|
|
|
3909
|
+
// src/utility/checkCallExpression.ts
|
|
3910
|
+
var import_utils2 = require("@typescript-eslint/utils");
|
|
3911
|
+
function checkCallExpression(node, objectName, propertyName) {
|
|
3912
|
+
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;
|
|
3913
|
+
}
|
|
3914
|
+
var checkCallExpression_default = checkCallExpression;
|
|
3915
|
+
|
|
3916
|
+
// src/rules/no-isolated-tests.ts
|
|
3917
|
+
var noIsolatedTests = create_rule_default({
|
|
3918
|
+
name: "no-isolated-tests",
|
|
3919
|
+
meta: {
|
|
3920
|
+
docs: {
|
|
3921
|
+
description: "Forbid the use of describe.only() and test.only()"
|
|
3922
|
+
},
|
|
3923
|
+
messages: {
|
|
3924
|
+
message: "Unexpected isolated {{source}}."
|
|
3925
|
+
},
|
|
3926
|
+
type: "suggestion",
|
|
3927
|
+
schema: []
|
|
3928
|
+
},
|
|
3929
|
+
defaultOptions: [],
|
|
3930
|
+
create(context) {
|
|
3931
|
+
return {
|
|
3932
|
+
CallExpression(node) {
|
|
3933
|
+
if (checkCallExpression_default(node, "describe", "only") || checkCallExpression_default(node, "test", "only")) {
|
|
3934
|
+
return context.report({
|
|
3935
|
+
node,
|
|
3936
|
+
messageId: "message",
|
|
3937
|
+
data: {
|
|
3938
|
+
source: node.callee.object.name
|
|
3939
|
+
}
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
};
|
|
3944
|
+
}
|
|
3945
|
+
});
|
|
3946
|
+
var no_isolated_tests_default = noIsolatedTests;
|
|
3947
|
+
|
|
3897
3948
|
// src/rules/no-namespace-imports.ts
|
|
3898
3949
|
var noNamespaceImports = create_rule_default({
|
|
3899
3950
|
name: "no-namespace-imports",
|
|
@@ -4073,8 +4124,40 @@ var noRelativeImports = create_rule_default({
|
|
|
4073
4124
|
});
|
|
4074
4125
|
var no_relative_imports_default = noRelativeImports;
|
|
4075
4126
|
|
|
4127
|
+
// src/rules/no-skipped-tests.ts
|
|
4128
|
+
var noSkippedTests = create_rule_default({
|
|
4129
|
+
name: "no-skipped-tests",
|
|
4130
|
+
meta: {
|
|
4131
|
+
docs: {
|
|
4132
|
+
description: "Forbid the use of describe.skip() and test.skip()"
|
|
4133
|
+
},
|
|
4134
|
+
messages: {
|
|
4135
|
+
message: "Unexpected skipped {{source}}."
|
|
4136
|
+
},
|
|
4137
|
+
type: "suggestion",
|
|
4138
|
+
schema: []
|
|
4139
|
+
},
|
|
4140
|
+
defaultOptions: [],
|
|
4141
|
+
create(context) {
|
|
4142
|
+
return {
|
|
4143
|
+
CallExpression(node) {
|
|
4144
|
+
if (checkCallExpression_default(node, "describe", "skip") || checkCallExpression_default(node, "test", "skip")) {
|
|
4145
|
+
return context.report({
|
|
4146
|
+
node,
|
|
4147
|
+
messageId: "message",
|
|
4148
|
+
data: {
|
|
4149
|
+
source: node.callee.object.name
|
|
4150
|
+
}
|
|
4151
|
+
});
|
|
4152
|
+
}
|
|
4153
|
+
}
|
|
4154
|
+
};
|
|
4155
|
+
}
|
|
4156
|
+
});
|
|
4157
|
+
var no_skipped_tests_default = noSkippedTests;
|
|
4158
|
+
|
|
4076
4159
|
// src/rules/use-object-shorthand.ts
|
|
4077
|
-
var
|
|
4160
|
+
var import_utils3 = require("@typescript-eslint/utils");
|
|
4078
4161
|
var useObjectShorthand = create_rule_default({
|
|
4079
4162
|
name: "use-object-shorthand",
|
|
4080
4163
|
meta: {
|
|
@@ -4092,7 +4175,7 @@ var useObjectShorthand = create_rule_default({
|
|
|
4092
4175
|
create(context) {
|
|
4093
4176
|
return {
|
|
4094
4177
|
Property(node) {
|
|
4095
|
-
if (node.key.type ===
|
|
4178
|
+
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
4179
|
context.report({
|
|
4097
4180
|
node,
|
|
4098
4181
|
messageId: "useShorthand",
|
|
@@ -4113,9 +4196,11 @@ var use_object_shorthand_default = useObjectShorthand;
|
|
|
4113
4196
|
|
|
4114
4197
|
// src/rules/index.ts
|
|
4115
4198
|
var rules_default = {
|
|
4199
|
+
"no-isolated-tests": no_isolated_tests_default,
|
|
4116
4200
|
"no-namespace-imports": no_namespace_imports_default,
|
|
4117
|
-
"no-relative-imports": no_relative_imports_default,
|
|
4118
4201
|
"no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default,
|
|
4202
|
+
"no-relative-imports": no_relative_imports_default,
|
|
4203
|
+
"no-skipped-tests": no_skipped_tests_default,
|
|
4119
4204
|
"use-object-shorthand": use_object_shorthand_default
|
|
4120
4205
|
};
|
|
4121
4206
|
|
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.1";
|
|
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
|
}
|
|
@@ -3733,7 +3740,7 @@ var typeScriptBase = [
|
|
|
3733
3740
|
prettierConfig,
|
|
3734
3741
|
{
|
|
3735
3742
|
name: "@alextheman/eslint-config-typescript-base",
|
|
3736
|
-
files: ["**/*.ts", "**/*.tsx"
|
|
3743
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
3737
3744
|
languageOptions: {
|
|
3738
3745
|
parser: tsparser,
|
|
3739
3746
|
parserOptions: {
|
|
@@ -3759,17 +3766,6 @@ var typeScriptBase = [
|
|
|
3759
3766
|
"import/no-unresolved": "error",
|
|
3760
3767
|
eqeqeq: "error",
|
|
3761
3768
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
3762
|
-
"no-restricted-imports": [
|
|
3763
|
-
"error",
|
|
3764
|
-
{
|
|
3765
|
-
patterns: [
|
|
3766
|
-
{
|
|
3767
|
-
group: ["node:test"],
|
|
3768
|
-
message: "Use test functions from vitest instead."
|
|
3769
|
-
}
|
|
3770
|
-
]
|
|
3771
|
-
}
|
|
3772
|
-
],
|
|
3773
3769
|
"perfectionist/sort-imports": [
|
|
3774
3770
|
"error",
|
|
3775
3771
|
{
|
|
@@ -3820,6 +3816,22 @@ var typeScriptBase = [
|
|
|
3820
3816
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
3821
3817
|
"prettier/prettier": ["warn", prettierRules_default]
|
|
3822
3818
|
}
|
|
3819
|
+
},
|
|
3820
|
+
{
|
|
3821
|
+
files: ["**/*.test.ts"],
|
|
3822
|
+
rules: {
|
|
3823
|
+
"no-restricted-imports": [
|
|
3824
|
+
"error",
|
|
3825
|
+
{
|
|
3826
|
+
patterns: [
|
|
3827
|
+
{
|
|
3828
|
+
group: ["node:test"],
|
|
3829
|
+
message: "Use test functions from vitest instead."
|
|
3830
|
+
}
|
|
3831
|
+
]
|
|
3832
|
+
}
|
|
3833
|
+
]
|
|
3834
|
+
}
|
|
3823
3835
|
}
|
|
3824
3836
|
];
|
|
3825
3837
|
var typeScriptBase_default = typeScriptBase;
|
|
@@ -3880,6 +3892,45 @@ var createRule = ESLintUtils.RuleCreator((ruleName) => {
|
|
|
3880
3892
|
});
|
|
3881
3893
|
var create_rule_default = createRule;
|
|
3882
3894
|
|
|
3895
|
+
// src/utility/checkCallExpression.ts
|
|
3896
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
3897
|
+
function checkCallExpression(node, objectName, propertyName) {
|
|
3898
|
+
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;
|
|
3899
|
+
}
|
|
3900
|
+
var checkCallExpression_default = checkCallExpression;
|
|
3901
|
+
|
|
3902
|
+
// src/rules/no-isolated-tests.ts
|
|
3903
|
+
var noIsolatedTests = create_rule_default({
|
|
3904
|
+
name: "no-isolated-tests",
|
|
3905
|
+
meta: {
|
|
3906
|
+
docs: {
|
|
3907
|
+
description: "Forbid the use of describe.only() and test.only()"
|
|
3908
|
+
},
|
|
3909
|
+
messages: {
|
|
3910
|
+
message: "Unexpected isolated {{source}}."
|
|
3911
|
+
},
|
|
3912
|
+
type: "suggestion",
|
|
3913
|
+
schema: []
|
|
3914
|
+
},
|
|
3915
|
+
defaultOptions: [],
|
|
3916
|
+
create(context) {
|
|
3917
|
+
return {
|
|
3918
|
+
CallExpression(node) {
|
|
3919
|
+
if (checkCallExpression_default(node, "describe", "only") || checkCallExpression_default(node, "test", "only")) {
|
|
3920
|
+
return context.report({
|
|
3921
|
+
node,
|
|
3922
|
+
messageId: "message",
|
|
3923
|
+
data: {
|
|
3924
|
+
source: node.callee.object.name
|
|
3925
|
+
}
|
|
3926
|
+
});
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
};
|
|
3930
|
+
}
|
|
3931
|
+
});
|
|
3932
|
+
var no_isolated_tests_default = noIsolatedTests;
|
|
3933
|
+
|
|
3883
3934
|
// src/rules/no-namespace-imports.ts
|
|
3884
3935
|
var noNamespaceImports = create_rule_default({
|
|
3885
3936
|
name: "no-namespace-imports",
|
|
@@ -4059,8 +4110,40 @@ var noRelativeImports = create_rule_default({
|
|
|
4059
4110
|
});
|
|
4060
4111
|
var no_relative_imports_default = noRelativeImports;
|
|
4061
4112
|
|
|
4113
|
+
// src/rules/no-skipped-tests.ts
|
|
4114
|
+
var noSkippedTests = create_rule_default({
|
|
4115
|
+
name: "no-skipped-tests",
|
|
4116
|
+
meta: {
|
|
4117
|
+
docs: {
|
|
4118
|
+
description: "Forbid the use of describe.skip() and test.skip()"
|
|
4119
|
+
},
|
|
4120
|
+
messages: {
|
|
4121
|
+
message: "Unexpected skipped {{source}}."
|
|
4122
|
+
},
|
|
4123
|
+
type: "suggestion",
|
|
4124
|
+
schema: []
|
|
4125
|
+
},
|
|
4126
|
+
defaultOptions: [],
|
|
4127
|
+
create(context) {
|
|
4128
|
+
return {
|
|
4129
|
+
CallExpression(node) {
|
|
4130
|
+
if (checkCallExpression_default(node, "describe", "skip") || checkCallExpression_default(node, "test", "skip")) {
|
|
4131
|
+
return context.report({
|
|
4132
|
+
node,
|
|
4133
|
+
messageId: "message",
|
|
4134
|
+
data: {
|
|
4135
|
+
source: node.callee.object.name
|
|
4136
|
+
}
|
|
4137
|
+
});
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
};
|
|
4141
|
+
}
|
|
4142
|
+
});
|
|
4143
|
+
var no_skipped_tests_default = noSkippedTests;
|
|
4144
|
+
|
|
4062
4145
|
// src/rules/use-object-shorthand.ts
|
|
4063
|
-
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4146
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
|
|
4064
4147
|
var useObjectShorthand = create_rule_default({
|
|
4065
4148
|
name: "use-object-shorthand",
|
|
4066
4149
|
meta: {
|
|
@@ -4078,7 +4161,7 @@ var useObjectShorthand = create_rule_default({
|
|
|
4078
4161
|
create(context) {
|
|
4079
4162
|
return {
|
|
4080
4163
|
Property(node) {
|
|
4081
|
-
if (node.key.type ===
|
|
4164
|
+
if (node.key.type === AST_NODE_TYPES2.Identifier && node.value.type === AST_NODE_TYPES2.Identifier && node.key.name === node.value.name && !node.shorthand) {
|
|
4082
4165
|
context.report({
|
|
4083
4166
|
node,
|
|
4084
4167
|
messageId: "useShorthand",
|
|
@@ -4099,9 +4182,11 @@ var use_object_shorthand_default = useObjectShorthand;
|
|
|
4099
4182
|
|
|
4100
4183
|
// src/rules/index.ts
|
|
4101
4184
|
var rules_default = {
|
|
4185
|
+
"no-isolated-tests": no_isolated_tests_default,
|
|
4102
4186
|
"no-namespace-imports": no_namespace_imports_default,
|
|
4103
|
-
"no-relative-imports": no_relative_imports_default,
|
|
4104
4187
|
"no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default,
|
|
4188
|
+
"no-relative-imports": no_relative_imports_default,
|
|
4189
|
+
"no-skipped-tests": no_skipped_tests_default,
|
|
4105
4190
|
"use-object-shorthand": use_object_shorthand_default
|
|
4106
4191
|
};
|
|
4107
4192
|
|