@alextheman/eslint-plugin 1.15.0 → 2.0.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 +147 -143
- package/dist/index.d.cts +23 -13
- package/dist/index.d.ts +23 -13
- package/dist/index.js +147 -143
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -3715,34 +3715,9 @@ module.exports = __toCommonJS(index_exports);
|
|
|
3715
3715
|
|
|
3716
3716
|
// package.json
|
|
3717
3717
|
var name = "@alextheman/eslint-plugin";
|
|
3718
|
-
var version = "
|
|
3718
|
+
var version = "2.0.0";
|
|
3719
3719
|
|
|
3720
|
-
// src/configs/
|
|
3721
|
-
function createAlexPluginBaseConfig(plugin) {
|
|
3722
|
-
return [
|
|
3723
|
-
{
|
|
3724
|
-
plugins: {
|
|
3725
|
-
"@alextheman": plugin
|
|
3726
|
-
},
|
|
3727
|
-
rules: {
|
|
3728
|
-
"@alextheman/no-namespace-imports": "error",
|
|
3729
|
-
"@alextheman/no-relative-imports": "error",
|
|
3730
|
-
"@alextheman/use-object-shorthand": "error"
|
|
3731
|
-
}
|
|
3732
|
-
},
|
|
3733
|
-
{
|
|
3734
|
-
files: ["**/*.test.ts"],
|
|
3735
|
-
rules: {
|
|
3736
|
-
"@alextheman/consistent-test-function": ["error", { preference: "test" }],
|
|
3737
|
-
"@alextheman/no-isolated-tests": "error",
|
|
3738
|
-
"@alextheman/no-skipped-tests": "warn"
|
|
3739
|
-
}
|
|
3740
|
-
}
|
|
3741
|
-
];
|
|
3742
|
-
}
|
|
3743
|
-
var alexPluginBase_default = createAlexPluginBaseConfig;
|
|
3744
|
-
|
|
3745
|
-
// src/configs/javaScriptBase.ts
|
|
3720
|
+
// src/configs/general/javaScriptBase.ts
|
|
3746
3721
|
var import_js = __toESM(require_src(), 1);
|
|
3747
3722
|
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
3748
3723
|
var import_eslint_plugin_import = __toESM(require("eslint-plugin-import"), 1);
|
|
@@ -3751,13 +3726,49 @@ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfecti
|
|
|
3751
3726
|
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
3752
3727
|
var import_globals = __toESM(require_globals2(), 1);
|
|
3753
3728
|
|
|
3754
|
-
// src/configs/prettierRules.ts
|
|
3729
|
+
// src/configs/general/prettierRules.ts
|
|
3755
3730
|
var prettierRules = {
|
|
3756
3731
|
printWidth: 100
|
|
3757
3732
|
};
|
|
3758
3733
|
var prettierRules_default = prettierRules;
|
|
3759
3734
|
|
|
3760
|
-
// src/configs/
|
|
3735
|
+
// src/configs/general/testsBase.ts
|
|
3736
|
+
var testsBase = [
|
|
3737
|
+
{
|
|
3738
|
+
files: ["**/*.test.{js,ts}"],
|
|
3739
|
+
rules: {
|
|
3740
|
+
"no-restricted-globals": [
|
|
3741
|
+
"error",
|
|
3742
|
+
{
|
|
3743
|
+
message: "Do not use global describe function. Import test functions from vitest instead.",
|
|
3744
|
+
name: "describe"
|
|
3745
|
+
},
|
|
3746
|
+
{
|
|
3747
|
+
message: "Do not use global test function. Import test functions from vitest instead.",
|
|
3748
|
+
name: "test"
|
|
3749
|
+
},
|
|
3750
|
+
{
|
|
3751
|
+
message: "Do not use global expect function. Import test functions from vitest instead.",
|
|
3752
|
+
name: "expect"
|
|
3753
|
+
}
|
|
3754
|
+
],
|
|
3755
|
+
"no-restricted-imports": [
|
|
3756
|
+
"error",
|
|
3757
|
+
{
|
|
3758
|
+
paths: [
|
|
3759
|
+
{
|
|
3760
|
+
message: "Use test functions from vitest instead.",
|
|
3761
|
+
name: "node:test"
|
|
3762
|
+
}
|
|
3763
|
+
]
|
|
3764
|
+
}
|
|
3765
|
+
]
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
];
|
|
3769
|
+
var testsBase_default = testsBase;
|
|
3770
|
+
|
|
3771
|
+
// src/configs/general/javaScriptBase.ts
|
|
3761
3772
|
var javaScriptBase = [
|
|
3762
3773
|
import_js.default.configs.recommended,
|
|
3763
3774
|
import_eslint_config_prettier.default,
|
|
@@ -3853,47 +3864,11 @@ var javaScriptBase = [
|
|
|
3853
3864
|
}
|
|
3854
3865
|
}
|
|
3855
3866
|
},
|
|
3856
|
-
|
|
3857
|
-
files: ["**/*.test.{js,ts}"],
|
|
3858
|
-
rules: {
|
|
3859
|
-
"no-restricted-globals": [
|
|
3860
|
-
"error",
|
|
3861
|
-
{
|
|
3862
|
-
message: "Do not use global describe function. Import test functions from vitest instead.",
|
|
3863
|
-
name: "describe"
|
|
3864
|
-
},
|
|
3865
|
-
{
|
|
3866
|
-
message: "Do not use global test function. Import test functions from vitest instead.",
|
|
3867
|
-
name: "test"
|
|
3868
|
-
},
|
|
3869
|
-
{
|
|
3870
|
-
message: "Do not use global expect function. Import test functions from vitest instead.",
|
|
3871
|
-
name: "expect"
|
|
3872
|
-
}
|
|
3873
|
-
],
|
|
3874
|
-
"no-restricted-imports": [
|
|
3875
|
-
"error",
|
|
3876
|
-
{
|
|
3877
|
-
paths: [
|
|
3878
|
-
{
|
|
3879
|
-
message: "Use test functions from vitest instead.",
|
|
3880
|
-
name: "node:test"
|
|
3881
|
-
}
|
|
3882
|
-
]
|
|
3883
|
-
}
|
|
3884
|
-
]
|
|
3885
|
-
}
|
|
3886
|
-
}
|
|
3867
|
+
...testsBase_default
|
|
3887
3868
|
];
|
|
3888
3869
|
var javaScriptBase_default = javaScriptBase;
|
|
3889
3870
|
|
|
3890
|
-
// src/configs/
|
|
3891
|
-
function createAlexJavaScriptBaseConfig(plugin) {
|
|
3892
|
-
return [...alexPluginBase_default(plugin), ...javaScriptBase_default];
|
|
3893
|
-
}
|
|
3894
|
-
var alexJavaScriptBase_default = createAlexJavaScriptBaseConfig;
|
|
3895
|
-
|
|
3896
|
-
// src/configs/reactBase.ts
|
|
3871
|
+
// src/configs/general/reactBase.ts
|
|
3897
3872
|
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
3898
3873
|
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
3899
3874
|
var import_eslint_plugin_react_refresh = __toESM(require("eslint-plugin-react-refresh"), 1);
|
|
@@ -3904,13 +3879,13 @@ var reactBase = [
|
|
|
3904
3879
|
ecmaVersion: 2020,
|
|
3905
3880
|
globals: import_globals2.default.browser
|
|
3906
3881
|
},
|
|
3907
|
-
name: "@alextheman/eslint-config-
|
|
3882
|
+
name: "@alextheman/eslint-config-react-base",
|
|
3908
3883
|
plugins: {
|
|
3909
3884
|
react: import_eslint_plugin_react.default,
|
|
3910
3885
|
"react-hooks": import_eslint_plugin_react_hooks.default,
|
|
3911
3886
|
"react-refresh": import_eslint_plugin_react_refresh.default
|
|
3912
3887
|
},
|
|
3913
|
-
rules: __spreadProps(__spreadValues({}, import_eslint_plugin_react_hooks.default.configs.recommended.rules), {
|
|
3888
|
+
rules: __spreadProps(__spreadValues(__spreadValues({}, import_eslint_plugin_react_hooks.default.configs.recommended.rules), import_eslint_plugin_react.default.configs.recommended.rules), {
|
|
3914
3889
|
"no-restricted-imports": [
|
|
3915
3890
|
"error",
|
|
3916
3891
|
{
|
|
@@ -3929,13 +3904,7 @@ var reactBase = [
|
|
|
3929
3904
|
];
|
|
3930
3905
|
var reactBase_default = reactBase;
|
|
3931
3906
|
|
|
3932
|
-
// src/configs/
|
|
3933
|
-
function createAlexReactBaseConfig(plugin) {
|
|
3934
|
-
return [...alexPluginBase_default(plugin), ...reactBase_default];
|
|
3935
|
-
}
|
|
3936
|
-
var alexReactBase_default = createAlexReactBaseConfig;
|
|
3937
|
-
|
|
3938
|
-
// src/configs/typeScriptBase.ts
|
|
3907
|
+
// src/configs/general/typeScriptBase.ts
|
|
3939
3908
|
var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
|
|
3940
3909
|
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
3941
3910
|
var typeScriptBase = [
|
|
@@ -3991,54 +3960,64 @@ var typeScriptBase = [
|
|
|
3991
3960
|
];
|
|
3992
3961
|
var typeScriptBase_default = typeScriptBase;
|
|
3993
3962
|
|
|
3994
|
-
// src/configs/
|
|
3995
|
-
function
|
|
3996
|
-
return [
|
|
3963
|
+
// src/configs/plugin/pluginBase.ts
|
|
3964
|
+
function createPluginBaseConfig(plugin) {
|
|
3965
|
+
return [
|
|
3966
|
+
{
|
|
3967
|
+
plugins: {
|
|
3968
|
+
"@alextheman": plugin
|
|
3969
|
+
},
|
|
3970
|
+
rules: {
|
|
3971
|
+
"@alextheman/no-namespace-imports": "error",
|
|
3972
|
+
"@alextheman/no-relative-imports": "error",
|
|
3973
|
+
"@alextheman/use-object-shorthand": "error"
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3976
|
+
];
|
|
3997
3977
|
}
|
|
3998
|
-
var
|
|
3978
|
+
var pluginBase_default = createPluginBaseConfig;
|
|
3999
3979
|
|
|
4000
|
-
// src/configs/
|
|
4001
|
-
function
|
|
4002
|
-
return [
|
|
3980
|
+
// src/configs/plugin/testsBase.ts
|
|
3981
|
+
function createPluginTestsBaseConfig(plugin) {
|
|
3982
|
+
return [
|
|
3983
|
+
{
|
|
3984
|
+
files: ["**/*.test.ts"],
|
|
3985
|
+
plugins: {
|
|
3986
|
+
"@alextheman": plugin
|
|
3987
|
+
},
|
|
3988
|
+
rules: {
|
|
3989
|
+
"@alextheman/consistent-test-function": ["error", { preference: "test" }],
|
|
3990
|
+
"@alextheman/no-isolated-tests": "error",
|
|
3991
|
+
"@alextheman/no-skipped-tests": "warn"
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
];
|
|
4003
3995
|
}
|
|
4004
|
-
var
|
|
3996
|
+
var testsBase_default2 = createPluginTestsBaseConfig;
|
|
4005
3997
|
|
|
4006
|
-
// src/configs/
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
var
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
{
|
|
4030
|
-
message: 'Please use `import Component from "@mui/[package]/Component"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.',
|
|
4031
|
-
regex: "^@mui/[^/]+$"
|
|
4032
|
-
}
|
|
4033
|
-
]
|
|
4034
|
-
}
|
|
4035
|
-
],
|
|
4036
|
-
"react-hooks/exhaustive-deps": "off",
|
|
4037
|
-
"react-refresh/only-export-components": "off"
|
|
4038
|
-
})
|
|
4039
|
-
}
|
|
4040
|
-
];
|
|
4041
|
-
var typeScriptReactBase_default = typeScriptReactBase;
|
|
3998
|
+
// src/configs/combined/javaScriptBase.ts
|
|
3999
|
+
function createCombinedJavaScriptBaseConfig(plugin) {
|
|
4000
|
+
return [...pluginBase_default(plugin), ...javaScriptBase_default];
|
|
4001
|
+
}
|
|
4002
|
+
var javaScriptBase_default2 = createCombinedJavaScriptBaseConfig;
|
|
4003
|
+
|
|
4004
|
+
// src/configs/combined/reactBase.ts
|
|
4005
|
+
function createCombinedReactBaseConfig(plugin) {
|
|
4006
|
+
return [...pluginBase_default(plugin), ...reactBase_default];
|
|
4007
|
+
}
|
|
4008
|
+
var reactBase_default2 = createCombinedReactBaseConfig;
|
|
4009
|
+
|
|
4010
|
+
// src/configs/combined/testsBase.ts
|
|
4011
|
+
function createCombinedTestsBaseConfig(plugin) {
|
|
4012
|
+
return [...pluginBase_default(plugin), ...testsBase_default];
|
|
4013
|
+
}
|
|
4014
|
+
var testsBase_default3 = createCombinedTestsBaseConfig;
|
|
4015
|
+
|
|
4016
|
+
// src/configs/combined/typeScriptBase.ts
|
|
4017
|
+
function createCombinedTypeScriptBaseConfig(plugin) {
|
|
4018
|
+
return [...pluginBase_default(plugin), ...typeScriptBase_default];
|
|
4019
|
+
}
|
|
4020
|
+
var typeScriptBase_default2 = createCombinedTypeScriptBaseConfig;
|
|
4042
4021
|
|
|
4043
4022
|
// src/rules/consistent-test-function.ts
|
|
4044
4023
|
var import_utils2 = require("@typescript-eslint/utils");
|
|
@@ -4509,6 +4488,35 @@ var rules_default = {
|
|
|
4509
4488
|
"use-object-shorthand": use_object_shorthand_default
|
|
4510
4489
|
};
|
|
4511
4490
|
|
|
4491
|
+
// src/utility/camelToKebab.ts
|
|
4492
|
+
var import_utility = require("@alextheman/utility");
|
|
4493
|
+
function camelToKebab(string) {
|
|
4494
|
+
return (0, import_utility.camelToKebab)(
|
|
4495
|
+
string.replace(/[Tt]ypeScript/, "typescript").replace(/[Jj]avaScript/, "javascript")
|
|
4496
|
+
);
|
|
4497
|
+
}
|
|
4498
|
+
var camelToKebab_default = camelToKebab;
|
|
4499
|
+
|
|
4500
|
+
// src/utility/createConfigGroup.ts
|
|
4501
|
+
function createConfigGroup(group, configs) {
|
|
4502
|
+
const newConfigs = {};
|
|
4503
|
+
for (const key in configs) {
|
|
4504
|
+
newConfigs[`${camelToKebab_default(group)}/${camelToKebab_default(key)}`] = configs[key];
|
|
4505
|
+
}
|
|
4506
|
+
return newConfigs;
|
|
4507
|
+
}
|
|
4508
|
+
var createConfigGroup_default = createConfigGroup;
|
|
4509
|
+
|
|
4510
|
+
// src/utility/createPluginConfigs.ts
|
|
4511
|
+
function createPluginConfigs(config) {
|
|
4512
|
+
const allConfigs = {};
|
|
4513
|
+
for (const group in config) {
|
|
4514
|
+
Object.assign(allConfigs, createConfigGroup_default(group, config[group]));
|
|
4515
|
+
}
|
|
4516
|
+
return allConfigs;
|
|
4517
|
+
}
|
|
4518
|
+
var createPluginConfigs_default = createPluginConfigs;
|
|
4519
|
+
|
|
4512
4520
|
// src/alexPlugin.ts
|
|
4513
4521
|
var alexPlugin = {
|
|
4514
4522
|
meta: {
|
|
@@ -4516,31 +4524,27 @@ var alexPlugin = {
|
|
|
4516
4524
|
version,
|
|
4517
4525
|
namespace: "alextheman"
|
|
4518
4526
|
},
|
|
4519
|
-
configs: {
|
|
4520
|
-
alexPluginBase: [],
|
|
4521
|
-
alexJavaScriptBase: [],
|
|
4522
|
-
alexTypeScriptBase: [],
|
|
4523
|
-
alexTypeScriptReactBase: [],
|
|
4524
|
-
alexReactBase: [],
|
|
4525
|
-
javaScriptBase: [],
|
|
4526
|
-
typeScriptBase: [],
|
|
4527
|
-
typeScriptReactBase: [],
|
|
4528
|
-
reactBase: []
|
|
4529
|
-
},
|
|
4527
|
+
configs: {},
|
|
4530
4528
|
rules: rules_default
|
|
4531
4529
|
};
|
|
4532
|
-
alexPlugin.configs = {
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4530
|
+
alexPlugin.configs = createPluginConfigs_default({
|
|
4531
|
+
general: {
|
|
4532
|
+
javaScript: javaScriptBase_default,
|
|
4533
|
+
typeScript: typeScriptBase_default,
|
|
4534
|
+
react: reactBase_default,
|
|
4535
|
+
tests: testsBase_default
|
|
4536
|
+
},
|
|
4537
|
+
plugin: {
|
|
4538
|
+
base: pluginBase_default(alexPlugin),
|
|
4539
|
+
tests: testsBase_default2(alexPlugin)
|
|
4540
|
+
},
|
|
4541
|
+
combined: {
|
|
4542
|
+
javaScript: javaScriptBase_default2(alexPlugin),
|
|
4543
|
+
typeScript: typeScriptBase_default2(alexPlugin),
|
|
4544
|
+
react: reactBase_default2(alexPlugin),
|
|
4545
|
+
tests: testsBase_default3(alexPlugin)
|
|
4546
|
+
}
|
|
4547
|
+
});
|
|
4544
4548
|
var alexPlugin_default = alexPlugin;
|
|
4545
4549
|
|
|
4546
4550
|
// src/index.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
|
-
import z from 'zod';
|
|
3
2
|
import { Config } from 'prettier';
|
|
3
|
+
import z from 'zod';
|
|
4
4
|
|
|
5
5
|
var name = "@alextheman/eslint-plugin";
|
|
6
|
-
var version = "
|
|
6
|
+
var version = "2.0.0";
|
|
7
|
+
|
|
8
|
+
interface AlexPluginConfigs {
|
|
9
|
+
general: {
|
|
10
|
+
javaScript: Linter.Config[];
|
|
11
|
+
typeScript: Linter.Config[];
|
|
12
|
+
react: Linter.Config[];
|
|
13
|
+
tests: Linter.Config[];
|
|
14
|
+
};
|
|
15
|
+
plugin: {
|
|
16
|
+
base: Linter.Config[];
|
|
17
|
+
tests: Linter.Config[];
|
|
18
|
+
};
|
|
19
|
+
combined: {
|
|
20
|
+
javaScript: Linter.Config[];
|
|
21
|
+
typeScript: Linter.Config[];
|
|
22
|
+
react: Linter.Config[];
|
|
23
|
+
tests: Linter.Config[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
declare function createPluginConfigs(config: AlexPluginConfigs): Record<`${string}/${string}`, Linter.Config[]>;
|
|
7
27
|
|
|
8
28
|
interface AlexPlugin {
|
|
9
29
|
meta: {
|
|
@@ -11,17 +31,7 @@ interface AlexPlugin {
|
|
|
11
31
|
version: typeof version;
|
|
12
32
|
namespace: "alextheman";
|
|
13
33
|
};
|
|
14
|
-
configs:
|
|
15
|
-
alexPluginBase: Linter.Config[];
|
|
16
|
-
alexJavaScriptBase: Linter.Config[];
|
|
17
|
-
alexTypeScriptBase: Linter.Config[];
|
|
18
|
-
alexTypeScriptReactBase: Linter.Config[];
|
|
19
|
-
alexReactBase: Linter.Config[];
|
|
20
|
-
javaScriptBase: Linter.Config[];
|
|
21
|
-
typeScriptBase: Linter.Config[];
|
|
22
|
-
typeScriptReactBase: Linter.Config[];
|
|
23
|
-
reactBase: Linter.Config[];
|
|
24
|
-
};
|
|
34
|
+
configs: ReturnType<typeof createPluginConfigs>;
|
|
25
35
|
rules: Record<string, any>;
|
|
26
36
|
}
|
|
27
37
|
declare const alexPlugin: AlexPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
|
-
import z from 'zod';
|
|
3
2
|
import { Config } from 'prettier';
|
|
3
|
+
import z from 'zod';
|
|
4
4
|
|
|
5
5
|
var name = "@alextheman/eslint-plugin";
|
|
6
|
-
var version = "
|
|
6
|
+
var version = "2.0.0";
|
|
7
|
+
|
|
8
|
+
interface AlexPluginConfigs {
|
|
9
|
+
general: {
|
|
10
|
+
javaScript: Linter.Config[];
|
|
11
|
+
typeScript: Linter.Config[];
|
|
12
|
+
react: Linter.Config[];
|
|
13
|
+
tests: Linter.Config[];
|
|
14
|
+
};
|
|
15
|
+
plugin: {
|
|
16
|
+
base: Linter.Config[];
|
|
17
|
+
tests: Linter.Config[];
|
|
18
|
+
};
|
|
19
|
+
combined: {
|
|
20
|
+
javaScript: Linter.Config[];
|
|
21
|
+
typeScript: Linter.Config[];
|
|
22
|
+
react: Linter.Config[];
|
|
23
|
+
tests: Linter.Config[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
declare function createPluginConfigs(config: AlexPluginConfigs): Record<`${string}/${string}`, Linter.Config[]>;
|
|
7
27
|
|
|
8
28
|
interface AlexPlugin {
|
|
9
29
|
meta: {
|
|
@@ -11,17 +31,7 @@ interface AlexPlugin {
|
|
|
11
31
|
version: typeof version;
|
|
12
32
|
namespace: "alextheman";
|
|
13
33
|
};
|
|
14
|
-
configs:
|
|
15
|
-
alexPluginBase: Linter.Config[];
|
|
16
|
-
alexJavaScriptBase: Linter.Config[];
|
|
17
|
-
alexTypeScriptBase: Linter.Config[];
|
|
18
|
-
alexTypeScriptReactBase: Linter.Config[];
|
|
19
|
-
alexReactBase: Linter.Config[];
|
|
20
|
-
javaScriptBase: Linter.Config[];
|
|
21
|
-
typeScriptBase: Linter.Config[];
|
|
22
|
-
typeScriptReactBase: Linter.Config[];
|
|
23
|
-
reactBase: Linter.Config[];
|
|
24
|
-
};
|
|
34
|
+
configs: ReturnType<typeof createPluginConfigs>;
|
|
25
35
|
rules: Record<string, any>;
|
|
26
36
|
}
|
|
27
37
|
declare const alexPlugin: AlexPlugin;
|
package/dist/index.js
CHANGED
|
@@ -3700,34 +3700,9 @@ var require_globals2 = __commonJS({
|
|
|
3700
3700
|
|
|
3701
3701
|
// package.json
|
|
3702
3702
|
var name = "@alextheman/eslint-plugin";
|
|
3703
|
-
var version = "
|
|
3703
|
+
var version = "2.0.0";
|
|
3704
3704
|
|
|
3705
|
-
// src/configs/
|
|
3706
|
-
function createAlexPluginBaseConfig(plugin) {
|
|
3707
|
-
return [
|
|
3708
|
-
{
|
|
3709
|
-
plugins: {
|
|
3710
|
-
"@alextheman": plugin
|
|
3711
|
-
},
|
|
3712
|
-
rules: {
|
|
3713
|
-
"@alextheman/no-namespace-imports": "error",
|
|
3714
|
-
"@alextheman/no-relative-imports": "error",
|
|
3715
|
-
"@alextheman/use-object-shorthand": "error"
|
|
3716
|
-
}
|
|
3717
|
-
},
|
|
3718
|
-
{
|
|
3719
|
-
files: ["**/*.test.ts"],
|
|
3720
|
-
rules: {
|
|
3721
|
-
"@alextheman/consistent-test-function": ["error", { preference: "test" }],
|
|
3722
|
-
"@alextheman/no-isolated-tests": "error",
|
|
3723
|
-
"@alextheman/no-skipped-tests": "warn"
|
|
3724
|
-
}
|
|
3725
|
-
}
|
|
3726
|
-
];
|
|
3727
|
-
}
|
|
3728
|
-
var alexPluginBase_default = createAlexPluginBaseConfig;
|
|
3729
|
-
|
|
3730
|
-
// src/configs/javaScriptBase.ts
|
|
3705
|
+
// src/configs/general/javaScriptBase.ts
|
|
3731
3706
|
var import_js = __toESM(require_src(), 1);
|
|
3732
3707
|
var import_globals = __toESM(require_globals2(), 1);
|
|
3733
3708
|
import prettierConfig from "eslint-config-prettier";
|
|
@@ -3736,13 +3711,49 @@ import packageJson from "eslint-plugin-package-json";
|
|
|
3736
3711
|
import perfectionist from "eslint-plugin-perfectionist";
|
|
3737
3712
|
import prettierPlugin from "eslint-plugin-prettier";
|
|
3738
3713
|
|
|
3739
|
-
// src/configs/prettierRules.ts
|
|
3714
|
+
// src/configs/general/prettierRules.ts
|
|
3740
3715
|
var prettierRules = {
|
|
3741
3716
|
printWidth: 100
|
|
3742
3717
|
};
|
|
3743
3718
|
var prettierRules_default = prettierRules;
|
|
3744
3719
|
|
|
3745
|
-
// src/configs/
|
|
3720
|
+
// src/configs/general/testsBase.ts
|
|
3721
|
+
var testsBase = [
|
|
3722
|
+
{
|
|
3723
|
+
files: ["**/*.test.{js,ts}"],
|
|
3724
|
+
rules: {
|
|
3725
|
+
"no-restricted-globals": [
|
|
3726
|
+
"error",
|
|
3727
|
+
{
|
|
3728
|
+
message: "Do not use global describe function. Import test functions from vitest instead.",
|
|
3729
|
+
name: "describe"
|
|
3730
|
+
},
|
|
3731
|
+
{
|
|
3732
|
+
message: "Do not use global test function. Import test functions from vitest instead.",
|
|
3733
|
+
name: "test"
|
|
3734
|
+
},
|
|
3735
|
+
{
|
|
3736
|
+
message: "Do not use global expect function. Import test functions from vitest instead.",
|
|
3737
|
+
name: "expect"
|
|
3738
|
+
}
|
|
3739
|
+
],
|
|
3740
|
+
"no-restricted-imports": [
|
|
3741
|
+
"error",
|
|
3742
|
+
{
|
|
3743
|
+
paths: [
|
|
3744
|
+
{
|
|
3745
|
+
message: "Use test functions from vitest instead.",
|
|
3746
|
+
name: "node:test"
|
|
3747
|
+
}
|
|
3748
|
+
]
|
|
3749
|
+
}
|
|
3750
|
+
]
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
];
|
|
3754
|
+
var testsBase_default = testsBase;
|
|
3755
|
+
|
|
3756
|
+
// src/configs/general/javaScriptBase.ts
|
|
3746
3757
|
var javaScriptBase = [
|
|
3747
3758
|
import_js.default.configs.recommended,
|
|
3748
3759
|
prettierConfig,
|
|
@@ -3838,47 +3849,11 @@ var javaScriptBase = [
|
|
|
3838
3849
|
}
|
|
3839
3850
|
}
|
|
3840
3851
|
},
|
|
3841
|
-
|
|
3842
|
-
files: ["**/*.test.{js,ts}"],
|
|
3843
|
-
rules: {
|
|
3844
|
-
"no-restricted-globals": [
|
|
3845
|
-
"error",
|
|
3846
|
-
{
|
|
3847
|
-
message: "Do not use global describe function. Import test functions from vitest instead.",
|
|
3848
|
-
name: "describe"
|
|
3849
|
-
},
|
|
3850
|
-
{
|
|
3851
|
-
message: "Do not use global test function. Import test functions from vitest instead.",
|
|
3852
|
-
name: "test"
|
|
3853
|
-
},
|
|
3854
|
-
{
|
|
3855
|
-
message: "Do not use global expect function. Import test functions from vitest instead.",
|
|
3856
|
-
name: "expect"
|
|
3857
|
-
}
|
|
3858
|
-
],
|
|
3859
|
-
"no-restricted-imports": [
|
|
3860
|
-
"error",
|
|
3861
|
-
{
|
|
3862
|
-
paths: [
|
|
3863
|
-
{
|
|
3864
|
-
message: "Use test functions from vitest instead.",
|
|
3865
|
-
name: "node:test"
|
|
3866
|
-
}
|
|
3867
|
-
]
|
|
3868
|
-
}
|
|
3869
|
-
]
|
|
3870
|
-
}
|
|
3871
|
-
}
|
|
3852
|
+
...testsBase_default
|
|
3872
3853
|
];
|
|
3873
3854
|
var javaScriptBase_default = javaScriptBase;
|
|
3874
3855
|
|
|
3875
|
-
// src/configs/
|
|
3876
|
-
function createAlexJavaScriptBaseConfig(plugin) {
|
|
3877
|
-
return [...alexPluginBase_default(plugin), ...javaScriptBase_default];
|
|
3878
|
-
}
|
|
3879
|
-
var alexJavaScriptBase_default = createAlexJavaScriptBaseConfig;
|
|
3880
|
-
|
|
3881
|
-
// src/configs/reactBase.ts
|
|
3856
|
+
// src/configs/general/reactBase.ts
|
|
3882
3857
|
var import_globals2 = __toESM(require_globals2(), 1);
|
|
3883
3858
|
import reactPlugin from "eslint-plugin-react";
|
|
3884
3859
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
@@ -3889,13 +3864,13 @@ var reactBase = [
|
|
|
3889
3864
|
ecmaVersion: 2020,
|
|
3890
3865
|
globals: import_globals2.default.browser
|
|
3891
3866
|
},
|
|
3892
|
-
name: "@alextheman/eslint-config-
|
|
3867
|
+
name: "@alextheman/eslint-config-react-base",
|
|
3893
3868
|
plugins: {
|
|
3894
3869
|
react: reactPlugin,
|
|
3895
3870
|
"react-hooks": reactHooks,
|
|
3896
3871
|
"react-refresh": reactRefresh
|
|
3897
3872
|
},
|
|
3898
|
-
rules: __spreadProps(__spreadValues({}, reactHooks.configs.recommended.rules), {
|
|
3873
|
+
rules: __spreadProps(__spreadValues(__spreadValues({}, reactHooks.configs.recommended.rules), reactPlugin.configs.recommended.rules), {
|
|
3899
3874
|
"no-restricted-imports": [
|
|
3900
3875
|
"error",
|
|
3901
3876
|
{
|
|
@@ -3914,13 +3889,7 @@ var reactBase = [
|
|
|
3914
3889
|
];
|
|
3915
3890
|
var reactBase_default = reactBase;
|
|
3916
3891
|
|
|
3917
|
-
// src/configs/
|
|
3918
|
-
function createAlexReactBaseConfig(plugin) {
|
|
3919
|
-
return [...alexPluginBase_default(plugin), ...reactBase_default];
|
|
3920
|
-
}
|
|
3921
|
-
var alexReactBase_default = createAlexReactBaseConfig;
|
|
3922
|
-
|
|
3923
|
-
// src/configs/typeScriptBase.ts
|
|
3892
|
+
// src/configs/general/typeScriptBase.ts
|
|
3924
3893
|
import tsparser from "@typescript-eslint/parser";
|
|
3925
3894
|
import tseslint from "typescript-eslint";
|
|
3926
3895
|
var typeScriptBase = [
|
|
@@ -3976,54 +3945,64 @@ var typeScriptBase = [
|
|
|
3976
3945
|
];
|
|
3977
3946
|
var typeScriptBase_default = typeScriptBase;
|
|
3978
3947
|
|
|
3979
|
-
// src/configs/
|
|
3980
|
-
function
|
|
3981
|
-
return [
|
|
3948
|
+
// src/configs/plugin/pluginBase.ts
|
|
3949
|
+
function createPluginBaseConfig(plugin) {
|
|
3950
|
+
return [
|
|
3951
|
+
{
|
|
3952
|
+
plugins: {
|
|
3953
|
+
"@alextheman": plugin
|
|
3954
|
+
},
|
|
3955
|
+
rules: {
|
|
3956
|
+
"@alextheman/no-namespace-imports": "error",
|
|
3957
|
+
"@alextheman/no-relative-imports": "error",
|
|
3958
|
+
"@alextheman/use-object-shorthand": "error"
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
];
|
|
3982
3962
|
}
|
|
3983
|
-
var
|
|
3963
|
+
var pluginBase_default = createPluginBaseConfig;
|
|
3984
3964
|
|
|
3985
|
-
// src/configs/
|
|
3986
|
-
function
|
|
3987
|
-
return [
|
|
3965
|
+
// src/configs/plugin/testsBase.ts
|
|
3966
|
+
function createPluginTestsBaseConfig(plugin) {
|
|
3967
|
+
return [
|
|
3968
|
+
{
|
|
3969
|
+
files: ["**/*.test.ts"],
|
|
3970
|
+
plugins: {
|
|
3971
|
+
"@alextheman": plugin
|
|
3972
|
+
},
|
|
3973
|
+
rules: {
|
|
3974
|
+
"@alextheman/consistent-test-function": ["error", { preference: "test" }],
|
|
3975
|
+
"@alextheman/no-isolated-tests": "error",
|
|
3976
|
+
"@alextheman/no-skipped-tests": "warn"
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
];
|
|
3988
3980
|
}
|
|
3989
|
-
var
|
|
3981
|
+
var testsBase_default2 = createPluginTestsBaseConfig;
|
|
3990
3982
|
|
|
3991
|
-
// src/configs/
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
{
|
|
4015
|
-
message: 'Please use `import Component from "@mui/[package]/Component"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.',
|
|
4016
|
-
regex: "^@mui/[^/]+$"
|
|
4017
|
-
}
|
|
4018
|
-
]
|
|
4019
|
-
}
|
|
4020
|
-
],
|
|
4021
|
-
"react-hooks/exhaustive-deps": "off",
|
|
4022
|
-
"react-refresh/only-export-components": "off"
|
|
4023
|
-
})
|
|
4024
|
-
}
|
|
4025
|
-
];
|
|
4026
|
-
var typeScriptReactBase_default = typeScriptReactBase;
|
|
3983
|
+
// src/configs/combined/javaScriptBase.ts
|
|
3984
|
+
function createCombinedJavaScriptBaseConfig(plugin) {
|
|
3985
|
+
return [...pluginBase_default(plugin), ...javaScriptBase_default];
|
|
3986
|
+
}
|
|
3987
|
+
var javaScriptBase_default2 = createCombinedJavaScriptBaseConfig;
|
|
3988
|
+
|
|
3989
|
+
// src/configs/combined/reactBase.ts
|
|
3990
|
+
function createCombinedReactBaseConfig(plugin) {
|
|
3991
|
+
return [...pluginBase_default(plugin), ...reactBase_default];
|
|
3992
|
+
}
|
|
3993
|
+
var reactBase_default2 = createCombinedReactBaseConfig;
|
|
3994
|
+
|
|
3995
|
+
// src/configs/combined/testsBase.ts
|
|
3996
|
+
function createCombinedTestsBaseConfig(plugin) {
|
|
3997
|
+
return [...pluginBase_default(plugin), ...testsBase_default];
|
|
3998
|
+
}
|
|
3999
|
+
var testsBase_default3 = createCombinedTestsBaseConfig;
|
|
4000
|
+
|
|
4001
|
+
// src/configs/combined/typeScriptBase.ts
|
|
4002
|
+
function createCombinedTypeScriptBaseConfig(plugin) {
|
|
4003
|
+
return [...pluginBase_default(plugin), ...typeScriptBase_default];
|
|
4004
|
+
}
|
|
4005
|
+
var typeScriptBase_default2 = createCombinedTypeScriptBaseConfig;
|
|
4027
4006
|
|
|
4028
4007
|
// src/rules/consistent-test-function.ts
|
|
4029
4008
|
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
@@ -4494,6 +4473,35 @@ var rules_default = {
|
|
|
4494
4473
|
"use-object-shorthand": use_object_shorthand_default
|
|
4495
4474
|
};
|
|
4496
4475
|
|
|
4476
|
+
// src/utility/camelToKebab.ts
|
|
4477
|
+
import { camelToKebab as alexCamelToKebab } from "@alextheman/utility";
|
|
4478
|
+
function camelToKebab(string) {
|
|
4479
|
+
return alexCamelToKebab(
|
|
4480
|
+
string.replace(/[Tt]ypeScript/, "typescript").replace(/[Jj]avaScript/, "javascript")
|
|
4481
|
+
);
|
|
4482
|
+
}
|
|
4483
|
+
var camelToKebab_default = camelToKebab;
|
|
4484
|
+
|
|
4485
|
+
// src/utility/createConfigGroup.ts
|
|
4486
|
+
function createConfigGroup(group, configs) {
|
|
4487
|
+
const newConfigs = {};
|
|
4488
|
+
for (const key in configs) {
|
|
4489
|
+
newConfigs[`${camelToKebab_default(group)}/${camelToKebab_default(key)}`] = configs[key];
|
|
4490
|
+
}
|
|
4491
|
+
return newConfigs;
|
|
4492
|
+
}
|
|
4493
|
+
var createConfigGroup_default = createConfigGroup;
|
|
4494
|
+
|
|
4495
|
+
// src/utility/createPluginConfigs.ts
|
|
4496
|
+
function createPluginConfigs(config) {
|
|
4497
|
+
const allConfigs = {};
|
|
4498
|
+
for (const group in config) {
|
|
4499
|
+
Object.assign(allConfigs, createConfigGroup_default(group, config[group]));
|
|
4500
|
+
}
|
|
4501
|
+
return allConfigs;
|
|
4502
|
+
}
|
|
4503
|
+
var createPluginConfigs_default = createPluginConfigs;
|
|
4504
|
+
|
|
4497
4505
|
// src/alexPlugin.ts
|
|
4498
4506
|
var alexPlugin = {
|
|
4499
4507
|
meta: {
|
|
@@ -4501,31 +4509,27 @@ var alexPlugin = {
|
|
|
4501
4509
|
version,
|
|
4502
4510
|
namespace: "alextheman"
|
|
4503
4511
|
},
|
|
4504
|
-
configs: {
|
|
4505
|
-
alexPluginBase: [],
|
|
4506
|
-
alexJavaScriptBase: [],
|
|
4507
|
-
alexTypeScriptBase: [],
|
|
4508
|
-
alexTypeScriptReactBase: [],
|
|
4509
|
-
alexReactBase: [],
|
|
4510
|
-
javaScriptBase: [],
|
|
4511
|
-
typeScriptBase: [],
|
|
4512
|
-
typeScriptReactBase: [],
|
|
4513
|
-
reactBase: []
|
|
4514
|
-
},
|
|
4512
|
+
configs: {},
|
|
4515
4513
|
rules: rules_default
|
|
4516
4514
|
};
|
|
4517
|
-
alexPlugin.configs = {
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4515
|
+
alexPlugin.configs = createPluginConfigs_default({
|
|
4516
|
+
general: {
|
|
4517
|
+
javaScript: javaScriptBase_default,
|
|
4518
|
+
typeScript: typeScriptBase_default,
|
|
4519
|
+
react: reactBase_default,
|
|
4520
|
+
tests: testsBase_default
|
|
4521
|
+
},
|
|
4522
|
+
plugin: {
|
|
4523
|
+
base: pluginBase_default(alexPlugin),
|
|
4524
|
+
tests: testsBase_default2(alexPlugin)
|
|
4525
|
+
},
|
|
4526
|
+
combined: {
|
|
4527
|
+
javaScript: javaScriptBase_default2(alexPlugin),
|
|
4528
|
+
typeScript: typeScriptBase_default2(alexPlugin),
|
|
4529
|
+
react: reactBase_default2(alexPlugin),
|
|
4530
|
+
tests: testsBase_default3(alexPlugin)
|
|
4531
|
+
}
|
|
4532
|
+
});
|
|
4529
4533
|
var alexPlugin_default = alexPlugin;
|
|
4530
4534
|
|
|
4531
4535
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/eslint-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A package to provide custom ESLint rules and configs",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "alextheman",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"update-dependencies": "bash -c 'npx npm-check-updates -u \"$@\" && npm install' --"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@alextheman/utility": "^2.2.0",
|
|
36
37
|
"common-tags": "^1.8.2",
|
|
37
38
|
"eslint-plugin-package-json": "^0.57.0",
|
|
38
39
|
"zod": "^4.1.12"
|