@alextheman/eslint-plugin 1.16.0 → 2.1.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 +170 -140
- package/dist/index.d.cts +24 -12
- package/dist/index.d.ts +24 -12
- package/dist/index.js +170 -140
- 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 = "1.
|
|
3718
|
+
var version = "2.1.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,56 +3864,50 @@ 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
|
|
3892
|
-
return [
|
|
3871
|
+
// src/configs/plugin/pluginBase.ts
|
|
3872
|
+
function createPluginBaseConfig(plugin) {
|
|
3873
|
+
return [
|
|
3874
|
+
{
|
|
3875
|
+
plugins: {
|
|
3876
|
+
"@alextheman": plugin
|
|
3877
|
+
},
|
|
3878
|
+
rules: {
|
|
3879
|
+
"@alextheman/no-namespace-imports": "error",
|
|
3880
|
+
"@alextheman/no-relative-imports": "error",
|
|
3881
|
+
"@alextheman/use-object-shorthand": "error"
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
];
|
|
3885
|
+
}
|
|
3886
|
+
var pluginBase_default = createPluginBaseConfig;
|
|
3887
|
+
|
|
3888
|
+
// src/configs/combined/javaScriptBase.ts
|
|
3889
|
+
function createCombinedJavaScriptBaseConfig(plugin) {
|
|
3890
|
+
return [...pluginBase_default(plugin), ...javaScriptBase_default];
|
|
3893
3891
|
}
|
|
3894
|
-
var
|
|
3892
|
+
var javaScriptBase_default2 = createCombinedJavaScriptBaseConfig;
|
|
3895
3893
|
|
|
3896
|
-
// src/configs/reactBase.ts
|
|
3894
|
+
// src/configs/general/reactBase.ts
|
|
3897
3895
|
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
3898
3896
|
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
3899
3897
|
var import_eslint_plugin_react_refresh = __toESM(require("eslint-plugin-react-refresh"), 1);
|
|
3900
3898
|
var import_globals2 = __toESM(require_globals2(), 1);
|
|
3901
3899
|
var reactBase = [
|
|
3900
|
+
import_eslint_plugin_react.default.configs.flat.recommended,
|
|
3901
|
+
import_eslint_plugin_react.default.configs.flat["jsx-runtime"],
|
|
3902
3902
|
{
|
|
3903
3903
|
languageOptions: {
|
|
3904
3904
|
ecmaVersion: 2020,
|
|
3905
|
-
globals: import_globals2.default.browser
|
|
3905
|
+
globals: import_globals2.default.browser,
|
|
3906
|
+
parserOptions: {
|
|
3907
|
+
ecmaFeatures: {
|
|
3908
|
+
jsx: true
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3906
3911
|
},
|
|
3907
3912
|
name: "@alextheman/eslint-config-react-base",
|
|
3908
3913
|
plugins: {
|
|
@@ -3910,7 +3915,7 @@ var reactBase = [
|
|
|
3910
3915
|
"react-hooks": import_eslint_plugin_react_hooks.default,
|
|
3911
3916
|
"react-refresh": import_eslint_plugin_react_refresh.default
|
|
3912
3917
|
},
|
|
3913
|
-
rules: __spreadProps(__spreadValues(
|
|
3918
|
+
rules: __spreadProps(__spreadValues({}, import_eslint_plugin_react_hooks.default.configs.recommended.rules), {
|
|
3914
3919
|
"no-restricted-imports": [
|
|
3915
3920
|
"error",
|
|
3916
3921
|
{
|
|
@@ -3924,18 +3929,47 @@ var reactBase = [
|
|
|
3924
3929
|
],
|
|
3925
3930
|
"react-hooks/exhaustive-deps": "off",
|
|
3926
3931
|
"react-refresh/only-export-components": "off"
|
|
3927
|
-
})
|
|
3932
|
+
}),
|
|
3933
|
+
settings: {
|
|
3934
|
+
react: {
|
|
3935
|
+
version: "detect"
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3928
3938
|
}
|
|
3929
3939
|
];
|
|
3930
3940
|
var reactBase_default = reactBase;
|
|
3931
3941
|
|
|
3932
|
-
// src/configs/
|
|
3933
|
-
function
|
|
3934
|
-
return [...
|
|
3942
|
+
// src/configs/combined/reactBase.ts
|
|
3943
|
+
function createCombinedReactBaseConfig(plugin) {
|
|
3944
|
+
return [...pluginBase_default(plugin), ...reactBase_default];
|
|
3935
3945
|
}
|
|
3936
|
-
var
|
|
3946
|
+
var reactBase_default2 = createCombinedReactBaseConfig;
|
|
3937
3947
|
|
|
3938
|
-
// src/configs/
|
|
3948
|
+
// src/configs/plugin/testsBase.ts
|
|
3949
|
+
function createPluginTestsBaseConfig(plugin) {
|
|
3950
|
+
return [
|
|
3951
|
+
{
|
|
3952
|
+
files: ["**/*.test.ts"],
|
|
3953
|
+
plugins: {
|
|
3954
|
+
"@alextheman": plugin
|
|
3955
|
+
},
|
|
3956
|
+
rules: {
|
|
3957
|
+
"@alextheman/consistent-test-function": ["error", { preference: "test" }],
|
|
3958
|
+
"@alextheman/no-isolated-tests": "error",
|
|
3959
|
+
"@alextheman/no-skipped-tests": "warn"
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
];
|
|
3963
|
+
}
|
|
3964
|
+
var testsBase_default2 = createPluginTestsBaseConfig;
|
|
3965
|
+
|
|
3966
|
+
// src/configs/combined/testsBase.ts
|
|
3967
|
+
function createCombinedTestsBaseConfig(plugin) {
|
|
3968
|
+
return [...pluginBase_default(plugin), ...testsBase_default];
|
|
3969
|
+
}
|
|
3970
|
+
var testsBase_default3 = createCombinedTestsBaseConfig;
|
|
3971
|
+
|
|
3972
|
+
// src/configs/general/typeScriptBase.ts
|
|
3939
3973
|
var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
|
|
3940
3974
|
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
3941
3975
|
var typeScriptBase = [
|
|
@@ -3991,54 +4025,23 @@ var typeScriptBase = [
|
|
|
3991
4025
|
];
|
|
3992
4026
|
var typeScriptBase_default = typeScriptBase;
|
|
3993
4027
|
|
|
3994
|
-
// src/configs/
|
|
3995
|
-
function
|
|
3996
|
-
return [...
|
|
4028
|
+
// src/configs/combined/typeScriptBase.ts
|
|
4029
|
+
function createCombinedTypeScriptBaseConfig(plugin) {
|
|
4030
|
+
return [...pluginBase_default(plugin), ...typeScriptBase_default];
|
|
3997
4031
|
}
|
|
3998
|
-
var
|
|
4032
|
+
var typeScriptBase_default2 = createCombinedTypeScriptBaseConfig;
|
|
3999
4033
|
|
|
4000
|
-
// src/configs/
|
|
4001
|
-
function
|
|
4002
|
-
return [...
|
|
4034
|
+
// src/configs/combined/typeScriptReactBase.ts
|
|
4035
|
+
function createCombinedTypeScriptReactBaseConfig(plugin) {
|
|
4036
|
+
return [...pluginBase_default(plugin), ...typeScriptBase_default, ...reactBase_default];
|
|
4003
4037
|
}
|
|
4004
|
-
var
|
|
4038
|
+
var typeScriptReactBase_default = createCombinedTypeScriptReactBaseConfig;
|
|
4005
4039
|
|
|
4006
|
-
// src/configs/
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
var
|
|
4011
|
-
var typeScriptReactBase = [
|
|
4012
|
-
...typeScriptBase_default,
|
|
4013
|
-
{
|
|
4014
|
-
languageOptions: {
|
|
4015
|
-
ecmaVersion: 2020,
|
|
4016
|
-
globals: import_globals3.default.browser
|
|
4017
|
-
},
|
|
4018
|
-
name: "@alextheman/eslint-config-typescript-react-base",
|
|
4019
|
-
plugins: {
|
|
4020
|
-
react: import_eslint_plugin_react2.default,
|
|
4021
|
-
"react-hooks": import_eslint_plugin_react_hooks2.default,
|
|
4022
|
-
"react-refresh": import_eslint_plugin_react_refresh2.default
|
|
4023
|
-
},
|
|
4024
|
-
rules: __spreadProps(__spreadValues({}, import_eslint_plugin_react_hooks2.default.configs.recommended.rules), {
|
|
4025
|
-
"no-restricted-imports": [
|
|
4026
|
-
"error",
|
|
4027
|
-
{
|
|
4028
|
-
patterns: [
|
|
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;
|
|
4040
|
+
// src/configs/combined/javaScriptReactBase.ts
|
|
4041
|
+
function createCombinedJavaScriptReactBaseConfig(plugin) {
|
|
4042
|
+
return [...pluginBase_default(plugin), ...javaScriptBase_default, ...reactBase_default];
|
|
4043
|
+
}
|
|
4044
|
+
var javaScriptReactBase_default = createCombinedJavaScriptReactBaseConfig;
|
|
4042
4045
|
|
|
4043
4046
|
// src/rules/consistent-test-function.ts
|
|
4044
4047
|
var import_utils2 = require("@typescript-eslint/utils");
|
|
@@ -4509,6 +4512,35 @@ var rules_default = {
|
|
|
4509
4512
|
"use-object-shorthand": use_object_shorthand_default
|
|
4510
4513
|
};
|
|
4511
4514
|
|
|
4515
|
+
// src/utility/camelToKebab.ts
|
|
4516
|
+
var import_utility = require("@alextheman/utility");
|
|
4517
|
+
function camelToKebab(string) {
|
|
4518
|
+
return (0, import_utility.camelToKebab)(
|
|
4519
|
+
string.replace(/[Tt]ypeScript/, "typescript").replace(/[Jj]avaScript/, "javascript")
|
|
4520
|
+
);
|
|
4521
|
+
}
|
|
4522
|
+
var camelToKebab_default = camelToKebab;
|
|
4523
|
+
|
|
4524
|
+
// src/utility/createConfigGroup.ts
|
|
4525
|
+
function createConfigGroup(group, configs) {
|
|
4526
|
+
const newConfigs = {};
|
|
4527
|
+
for (const key in configs) {
|
|
4528
|
+
newConfigs[`${camelToKebab_default(group)}/${camelToKebab_default(key)}`] = configs[key];
|
|
4529
|
+
}
|
|
4530
|
+
return newConfigs;
|
|
4531
|
+
}
|
|
4532
|
+
var createConfigGroup_default = createConfigGroup;
|
|
4533
|
+
|
|
4534
|
+
// src/utility/createPluginConfigs.ts
|
|
4535
|
+
function createPluginConfigs(config) {
|
|
4536
|
+
const allConfigs = {};
|
|
4537
|
+
for (const group in config) {
|
|
4538
|
+
Object.assign(allConfigs, createConfigGroup_default(group, config[group]));
|
|
4539
|
+
}
|
|
4540
|
+
return allConfigs;
|
|
4541
|
+
}
|
|
4542
|
+
var createPluginConfigs_default = createPluginConfigs;
|
|
4543
|
+
|
|
4512
4544
|
// src/alexPlugin.ts
|
|
4513
4545
|
var alexPlugin = {
|
|
4514
4546
|
meta: {
|
|
@@ -4516,31 +4548,29 @@ var alexPlugin = {
|
|
|
4516
4548
|
version,
|
|
4517
4549
|
namespace: "alextheman"
|
|
4518
4550
|
},
|
|
4519
|
-
configs: {
|
|
4520
|
-
alexPluginBase: [],
|
|
4521
|
-
alexJavaScriptBase: [],
|
|
4522
|
-
alexTypeScriptBase: [],
|
|
4523
|
-
alexTypeScriptReactBase: [],
|
|
4524
|
-
alexReactBase: [],
|
|
4525
|
-
javaScriptBase: [],
|
|
4526
|
-
typeScriptBase: [],
|
|
4527
|
-
typeScriptReactBase: [],
|
|
4528
|
-
reactBase: []
|
|
4529
|
-
},
|
|
4551
|
+
configs: {},
|
|
4530
4552
|
rules: rules_default
|
|
4531
4553
|
};
|
|
4532
|
-
alexPlugin.configs = {
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4554
|
+
alexPlugin.configs = createPluginConfigs_default({
|
|
4555
|
+
general: {
|
|
4556
|
+
javaScript: javaScriptBase_default,
|
|
4557
|
+
typeScript: typeScriptBase_default,
|
|
4558
|
+
react: reactBase_default,
|
|
4559
|
+
tests: testsBase_default
|
|
4560
|
+
},
|
|
4561
|
+
plugin: {
|
|
4562
|
+
base: pluginBase_default(alexPlugin),
|
|
4563
|
+
tests: testsBase_default2(alexPlugin)
|
|
4564
|
+
},
|
|
4565
|
+
combined: {
|
|
4566
|
+
javaScript: javaScriptBase_default2(alexPlugin),
|
|
4567
|
+
typeScript: typeScriptBase_default2(alexPlugin),
|
|
4568
|
+
react: reactBase_default2(alexPlugin),
|
|
4569
|
+
tests: testsBase_default3(alexPlugin),
|
|
4570
|
+
typeScriptReact: typeScriptReactBase_default(alexPlugin),
|
|
4571
|
+
javaScriptReact: javaScriptReactBase_default(alexPlugin)
|
|
4572
|
+
}
|
|
4573
|
+
});
|
|
4544
4574
|
var alexPlugin_default = alexPlugin;
|
|
4545
4575
|
|
|
4546
4576
|
// src/index.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,29 @@ import z from 'zod';
|
|
|
3
3
|
import { Config } from 'prettier';
|
|
4
4
|
|
|
5
5
|
var name = "@alextheman/eslint-plugin";
|
|
6
|
-
var version = "1.
|
|
6
|
+
var version = "2.1.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
|
+
typeScriptReact: Linter.Config[];
|
|
25
|
+
javaScriptReact: Linter.Config[];
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
declare function createPluginConfigs(config: AlexPluginConfigs): Record<`${string}/${string}`, Linter.Config[]>;
|
|
7
29
|
|
|
8
30
|
interface AlexPlugin {
|
|
9
31
|
meta: {
|
|
@@ -11,17 +33,7 @@ interface AlexPlugin {
|
|
|
11
33
|
version: typeof version;
|
|
12
34
|
namespace: "alextheman";
|
|
13
35
|
};
|
|
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
|
-
};
|
|
36
|
+
configs: ReturnType<typeof createPluginConfigs>;
|
|
25
37
|
rules: Record<string, any>;
|
|
26
38
|
}
|
|
27
39
|
declare const alexPlugin: AlexPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,29 @@ import z from 'zod';
|
|
|
3
3
|
import { Config } from 'prettier';
|
|
4
4
|
|
|
5
5
|
var name = "@alextheman/eslint-plugin";
|
|
6
|
-
var version = "1.
|
|
6
|
+
var version = "2.1.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
|
+
typeScriptReact: Linter.Config[];
|
|
25
|
+
javaScriptReact: Linter.Config[];
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
declare function createPluginConfigs(config: AlexPluginConfigs): Record<`${string}/${string}`, Linter.Config[]>;
|
|
7
29
|
|
|
8
30
|
interface AlexPlugin {
|
|
9
31
|
meta: {
|
|
@@ -11,17 +33,7 @@ interface AlexPlugin {
|
|
|
11
33
|
version: typeof version;
|
|
12
34
|
namespace: "alextheman";
|
|
13
35
|
};
|
|
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
|
-
};
|
|
36
|
+
configs: ReturnType<typeof createPluginConfigs>;
|
|
25
37
|
rules: Record<string, any>;
|
|
26
38
|
}
|
|
27
39
|
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 = "1.
|
|
3703
|
+
var version = "2.1.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,56 +3849,50 @@ 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
|
|
3877
|
-
return [
|
|
3856
|
+
// src/configs/plugin/pluginBase.ts
|
|
3857
|
+
function createPluginBaseConfig(plugin) {
|
|
3858
|
+
return [
|
|
3859
|
+
{
|
|
3860
|
+
plugins: {
|
|
3861
|
+
"@alextheman": plugin
|
|
3862
|
+
},
|
|
3863
|
+
rules: {
|
|
3864
|
+
"@alextheman/no-namespace-imports": "error",
|
|
3865
|
+
"@alextheman/no-relative-imports": "error",
|
|
3866
|
+
"@alextheman/use-object-shorthand": "error"
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
];
|
|
3870
|
+
}
|
|
3871
|
+
var pluginBase_default = createPluginBaseConfig;
|
|
3872
|
+
|
|
3873
|
+
// src/configs/combined/javaScriptBase.ts
|
|
3874
|
+
function createCombinedJavaScriptBaseConfig(plugin) {
|
|
3875
|
+
return [...pluginBase_default(plugin), ...javaScriptBase_default];
|
|
3878
3876
|
}
|
|
3879
|
-
var
|
|
3877
|
+
var javaScriptBase_default2 = createCombinedJavaScriptBaseConfig;
|
|
3880
3878
|
|
|
3881
|
-
// src/configs/reactBase.ts
|
|
3879
|
+
// src/configs/general/reactBase.ts
|
|
3882
3880
|
var import_globals2 = __toESM(require_globals2(), 1);
|
|
3883
3881
|
import reactPlugin from "eslint-plugin-react";
|
|
3884
3882
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
3885
3883
|
import reactRefresh from "eslint-plugin-react-refresh";
|
|
3886
3884
|
var reactBase = [
|
|
3885
|
+
reactPlugin.configs.flat.recommended,
|
|
3886
|
+
reactPlugin.configs.flat["jsx-runtime"],
|
|
3887
3887
|
{
|
|
3888
3888
|
languageOptions: {
|
|
3889
3889
|
ecmaVersion: 2020,
|
|
3890
|
-
globals: import_globals2.default.browser
|
|
3890
|
+
globals: import_globals2.default.browser,
|
|
3891
|
+
parserOptions: {
|
|
3892
|
+
ecmaFeatures: {
|
|
3893
|
+
jsx: true
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3891
3896
|
},
|
|
3892
3897
|
name: "@alextheman/eslint-config-react-base",
|
|
3893
3898
|
plugins: {
|
|
@@ -3895,7 +3900,7 @@ var reactBase = [
|
|
|
3895
3900
|
"react-hooks": reactHooks,
|
|
3896
3901
|
"react-refresh": reactRefresh
|
|
3897
3902
|
},
|
|
3898
|
-
rules: __spreadProps(__spreadValues(
|
|
3903
|
+
rules: __spreadProps(__spreadValues({}, reactHooks.configs.recommended.rules), {
|
|
3899
3904
|
"no-restricted-imports": [
|
|
3900
3905
|
"error",
|
|
3901
3906
|
{
|
|
@@ -3909,18 +3914,47 @@ var reactBase = [
|
|
|
3909
3914
|
],
|
|
3910
3915
|
"react-hooks/exhaustive-deps": "off",
|
|
3911
3916
|
"react-refresh/only-export-components": "off"
|
|
3912
|
-
})
|
|
3917
|
+
}),
|
|
3918
|
+
settings: {
|
|
3919
|
+
react: {
|
|
3920
|
+
version: "detect"
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3913
3923
|
}
|
|
3914
3924
|
];
|
|
3915
3925
|
var reactBase_default = reactBase;
|
|
3916
3926
|
|
|
3917
|
-
// src/configs/
|
|
3918
|
-
function
|
|
3919
|
-
return [...
|
|
3927
|
+
// src/configs/combined/reactBase.ts
|
|
3928
|
+
function createCombinedReactBaseConfig(plugin) {
|
|
3929
|
+
return [...pluginBase_default(plugin), ...reactBase_default];
|
|
3920
3930
|
}
|
|
3921
|
-
var
|
|
3931
|
+
var reactBase_default2 = createCombinedReactBaseConfig;
|
|
3922
3932
|
|
|
3923
|
-
// src/configs/
|
|
3933
|
+
// src/configs/plugin/testsBase.ts
|
|
3934
|
+
function createPluginTestsBaseConfig(plugin) {
|
|
3935
|
+
return [
|
|
3936
|
+
{
|
|
3937
|
+
files: ["**/*.test.ts"],
|
|
3938
|
+
plugins: {
|
|
3939
|
+
"@alextheman": plugin
|
|
3940
|
+
},
|
|
3941
|
+
rules: {
|
|
3942
|
+
"@alextheman/consistent-test-function": ["error", { preference: "test" }],
|
|
3943
|
+
"@alextheman/no-isolated-tests": "error",
|
|
3944
|
+
"@alextheman/no-skipped-tests": "warn"
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
];
|
|
3948
|
+
}
|
|
3949
|
+
var testsBase_default2 = createPluginTestsBaseConfig;
|
|
3950
|
+
|
|
3951
|
+
// src/configs/combined/testsBase.ts
|
|
3952
|
+
function createCombinedTestsBaseConfig(plugin) {
|
|
3953
|
+
return [...pluginBase_default(plugin), ...testsBase_default];
|
|
3954
|
+
}
|
|
3955
|
+
var testsBase_default3 = createCombinedTestsBaseConfig;
|
|
3956
|
+
|
|
3957
|
+
// src/configs/general/typeScriptBase.ts
|
|
3924
3958
|
import tsparser from "@typescript-eslint/parser";
|
|
3925
3959
|
import tseslint from "typescript-eslint";
|
|
3926
3960
|
var typeScriptBase = [
|
|
@@ -3976,54 +4010,23 @@ var typeScriptBase = [
|
|
|
3976
4010
|
];
|
|
3977
4011
|
var typeScriptBase_default = typeScriptBase;
|
|
3978
4012
|
|
|
3979
|
-
// src/configs/
|
|
3980
|
-
function
|
|
3981
|
-
return [...
|
|
4013
|
+
// src/configs/combined/typeScriptBase.ts
|
|
4014
|
+
function createCombinedTypeScriptBaseConfig(plugin) {
|
|
4015
|
+
return [...pluginBase_default(plugin), ...typeScriptBase_default];
|
|
3982
4016
|
}
|
|
3983
|
-
var
|
|
4017
|
+
var typeScriptBase_default2 = createCombinedTypeScriptBaseConfig;
|
|
3984
4018
|
|
|
3985
|
-
// src/configs/
|
|
3986
|
-
function
|
|
3987
|
-
return [...
|
|
4019
|
+
// src/configs/combined/typeScriptReactBase.ts
|
|
4020
|
+
function createCombinedTypeScriptReactBaseConfig(plugin) {
|
|
4021
|
+
return [...pluginBase_default(plugin), ...typeScriptBase_default, ...reactBase_default];
|
|
3988
4022
|
}
|
|
3989
|
-
var
|
|
4023
|
+
var typeScriptReactBase_default = createCombinedTypeScriptReactBaseConfig;
|
|
3990
4024
|
|
|
3991
|
-
// src/configs/
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
var typeScriptReactBase = [
|
|
3997
|
-
...typeScriptBase_default,
|
|
3998
|
-
{
|
|
3999
|
-
languageOptions: {
|
|
4000
|
-
ecmaVersion: 2020,
|
|
4001
|
-
globals: import_globals3.default.browser
|
|
4002
|
-
},
|
|
4003
|
-
name: "@alextheman/eslint-config-typescript-react-base",
|
|
4004
|
-
plugins: {
|
|
4005
|
-
react: reactPlugin2,
|
|
4006
|
-
"react-hooks": reactHooks2,
|
|
4007
|
-
"react-refresh": reactRefresh2
|
|
4008
|
-
},
|
|
4009
|
-
rules: __spreadProps(__spreadValues({}, reactHooks2.configs.recommended.rules), {
|
|
4010
|
-
"no-restricted-imports": [
|
|
4011
|
-
"error",
|
|
4012
|
-
{
|
|
4013
|
-
patterns: [
|
|
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;
|
|
4025
|
+
// src/configs/combined/javaScriptReactBase.ts
|
|
4026
|
+
function createCombinedJavaScriptReactBaseConfig(plugin) {
|
|
4027
|
+
return [...pluginBase_default(plugin), ...javaScriptBase_default, ...reactBase_default];
|
|
4028
|
+
}
|
|
4029
|
+
var javaScriptReactBase_default = createCombinedJavaScriptReactBaseConfig;
|
|
4027
4030
|
|
|
4028
4031
|
// src/rules/consistent-test-function.ts
|
|
4029
4032
|
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
@@ -4494,6 +4497,35 @@ var rules_default = {
|
|
|
4494
4497
|
"use-object-shorthand": use_object_shorthand_default
|
|
4495
4498
|
};
|
|
4496
4499
|
|
|
4500
|
+
// src/utility/camelToKebab.ts
|
|
4501
|
+
import { camelToKebab as alexCamelToKebab } from "@alextheman/utility";
|
|
4502
|
+
function camelToKebab(string) {
|
|
4503
|
+
return alexCamelToKebab(
|
|
4504
|
+
string.replace(/[Tt]ypeScript/, "typescript").replace(/[Jj]avaScript/, "javascript")
|
|
4505
|
+
);
|
|
4506
|
+
}
|
|
4507
|
+
var camelToKebab_default = camelToKebab;
|
|
4508
|
+
|
|
4509
|
+
// src/utility/createConfigGroup.ts
|
|
4510
|
+
function createConfigGroup(group, configs) {
|
|
4511
|
+
const newConfigs = {};
|
|
4512
|
+
for (const key in configs) {
|
|
4513
|
+
newConfigs[`${camelToKebab_default(group)}/${camelToKebab_default(key)}`] = configs[key];
|
|
4514
|
+
}
|
|
4515
|
+
return newConfigs;
|
|
4516
|
+
}
|
|
4517
|
+
var createConfigGroup_default = createConfigGroup;
|
|
4518
|
+
|
|
4519
|
+
// src/utility/createPluginConfigs.ts
|
|
4520
|
+
function createPluginConfigs(config) {
|
|
4521
|
+
const allConfigs = {};
|
|
4522
|
+
for (const group in config) {
|
|
4523
|
+
Object.assign(allConfigs, createConfigGroup_default(group, config[group]));
|
|
4524
|
+
}
|
|
4525
|
+
return allConfigs;
|
|
4526
|
+
}
|
|
4527
|
+
var createPluginConfigs_default = createPluginConfigs;
|
|
4528
|
+
|
|
4497
4529
|
// src/alexPlugin.ts
|
|
4498
4530
|
var alexPlugin = {
|
|
4499
4531
|
meta: {
|
|
@@ -4501,31 +4533,29 @@ var alexPlugin = {
|
|
|
4501
4533
|
version,
|
|
4502
4534
|
namespace: "alextheman"
|
|
4503
4535
|
},
|
|
4504
|
-
configs: {
|
|
4505
|
-
alexPluginBase: [],
|
|
4506
|
-
alexJavaScriptBase: [],
|
|
4507
|
-
alexTypeScriptBase: [],
|
|
4508
|
-
alexTypeScriptReactBase: [],
|
|
4509
|
-
alexReactBase: [],
|
|
4510
|
-
javaScriptBase: [],
|
|
4511
|
-
typeScriptBase: [],
|
|
4512
|
-
typeScriptReactBase: [],
|
|
4513
|
-
reactBase: []
|
|
4514
|
-
},
|
|
4536
|
+
configs: {},
|
|
4515
4537
|
rules: rules_default
|
|
4516
4538
|
};
|
|
4517
|
-
alexPlugin.configs = {
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4539
|
+
alexPlugin.configs = createPluginConfigs_default({
|
|
4540
|
+
general: {
|
|
4541
|
+
javaScript: javaScriptBase_default,
|
|
4542
|
+
typeScript: typeScriptBase_default,
|
|
4543
|
+
react: reactBase_default,
|
|
4544
|
+
tests: testsBase_default
|
|
4545
|
+
},
|
|
4546
|
+
plugin: {
|
|
4547
|
+
base: pluginBase_default(alexPlugin),
|
|
4548
|
+
tests: testsBase_default2(alexPlugin)
|
|
4549
|
+
},
|
|
4550
|
+
combined: {
|
|
4551
|
+
javaScript: javaScriptBase_default2(alexPlugin),
|
|
4552
|
+
typeScript: typeScriptBase_default2(alexPlugin),
|
|
4553
|
+
react: reactBase_default2(alexPlugin),
|
|
4554
|
+
tests: testsBase_default3(alexPlugin),
|
|
4555
|
+
typeScriptReact: typeScriptReactBase_default(alexPlugin),
|
|
4556
|
+
javaScriptReact: javaScriptReactBase_default(alexPlugin)
|
|
4557
|
+
}
|
|
4558
|
+
});
|
|
4529
4559
|
var alexPlugin_default = alexPlugin;
|
|
4530
4560
|
|
|
4531
4561
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/eslint-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.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"
|