@alextheman/eslint-plugin 4.9.0 → 4.9.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 +72 -56
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +49 -33
- package/package.json +16 -15
package/dist/index.cjs
CHANGED
|
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
}) : target, mod));
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
|
-
let
|
|
31
|
-
let
|
|
30
|
+
let _alextheman_utility = require("@alextheman/utility");
|
|
31
|
+
let _typescript_eslint_utils = require("@typescript-eslint/utils");
|
|
32
32
|
let zod = require("zod");
|
|
33
33
|
zod = __toESM(zod);
|
|
34
|
-
let
|
|
35
|
-
|
|
34
|
+
let _eslint_js = require("@eslint/js");
|
|
35
|
+
_eslint_js = __toESM(_eslint_js);
|
|
36
36
|
let eslint_config_prettier = require("eslint-config-prettier");
|
|
37
37
|
eslint_config_prettier = __toESM(eslint_config_prettier);
|
|
38
38
|
let eslint_plugin_import = require("eslint-plugin-import");
|
|
@@ -59,11 +59,6 @@ eslint_plugin_package_json = __toESM(eslint_plugin_package_json);
|
|
|
59
59
|
let eslint_plugin_jsdoc = require("eslint-plugin-jsdoc");
|
|
60
60
|
eslint_plugin_jsdoc = __toESM(eslint_plugin_jsdoc);
|
|
61
61
|
|
|
62
|
-
//#region package.json
|
|
63
|
-
var name = "@alextheman/eslint-plugin";
|
|
64
|
-
var version = "4.9.0";
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
62
|
//#region node_modules/.pnpm/globals@16.5.0/node_modules/globals/globals.json
|
|
68
63
|
var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
69
64
|
module.exports = {
|
|
@@ -3419,7 +3414,7 @@ var require_globals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3419
3414
|
|
|
3420
3415
|
//#endregion
|
|
3421
3416
|
//#region src/configs/helpers/restrictedImports/generalRestrictedImports.ts
|
|
3422
|
-
var import_globals
|
|
3417
|
+
var import_globals = /* @__PURE__ */ __toESM(require_globals(), 1);
|
|
3423
3418
|
const generalRestrictedImports = { patterns: [{
|
|
3424
3419
|
group: ["node_modules"],
|
|
3425
3420
|
message: "Do not import directly from node_modules."
|
|
@@ -3438,7 +3433,7 @@ var generalRestrictedImports_default = generalRestrictedImports;
|
|
|
3438
3433
|
* @returns A value of `true` if the given `objectName` and `propertyName` matches those of the node, and `false` otherwise.
|
|
3439
3434
|
*/
|
|
3440
3435
|
function checkCallExpression(node, objectName, propertyName) {
|
|
3441
|
-
return node.callee.type ===
|
|
3436
|
+
return node.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && node.callee.object.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.object.name === objectName && node.callee.property.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.property.name === propertyName;
|
|
3442
3437
|
}
|
|
3443
3438
|
var checkCallExpression_default = checkCallExpression;
|
|
3444
3439
|
|
|
@@ -3462,8 +3457,8 @@ function combineRestrictedImports(...groups) {
|
|
|
3462
3457
|
paths,
|
|
3463
3458
|
patterns
|
|
3464
3459
|
};
|
|
3465
|
-
if (combinedGroup.paths.length === 0) return (0,
|
|
3466
|
-
if (combinedGroup.patterns.length === 0) return (0,
|
|
3460
|
+
if (combinedGroup.paths.length === 0) return (0, _alextheman_utility.omitProperties)(combinedGroup, "paths");
|
|
3461
|
+
if (combinedGroup.patterns.length === 0) return (0, _alextheman_utility.omitProperties)(combinedGroup, "patterns");
|
|
3467
3462
|
return combinedGroup;
|
|
3468
3463
|
}
|
|
3469
3464
|
var combineRestrictedImports_default = combineRestrictedImports;
|
|
@@ -3478,7 +3473,7 @@ var combineRestrictedImports_default = combineRestrictedImports;
|
|
|
3478
3473
|
* @returns An array containing the resulting JSON Schema, formatted for ESLint rule schema compatibility.
|
|
3479
3474
|
*/
|
|
3480
3475
|
function createRuleSchemaFromZodSchema(schema$1) {
|
|
3481
|
-
return [(0,
|
|
3476
|
+
return [(0, _alextheman_utility.omitProperties)(zod.default.toJSONSchema(schema$1), "$schema")];
|
|
3482
3477
|
}
|
|
3483
3478
|
var createRuleSchemaFromZodSchema_default = createRuleSchemaFromZodSchema;
|
|
3484
3479
|
|
|
@@ -3519,9 +3514,9 @@ var testsRestrictedImports_default = testsRestrictedImports;
|
|
|
3519
3514
|
const personalTests = [{
|
|
3520
3515
|
files: ["**/*.test.{js,ts}"],
|
|
3521
3516
|
languageOptions: { globals: {
|
|
3522
|
-
...import_globals
|
|
3523
|
-
...import_globals
|
|
3524
|
-
...import_globals
|
|
3517
|
+
...import_globals.default.node,
|
|
3518
|
+
...import_globals.default.browser,
|
|
3519
|
+
...import_globals.default.vitest
|
|
3525
3520
|
} },
|
|
3526
3521
|
name: "@alextheman/personal/tests",
|
|
3527
3522
|
rules: {
|
|
@@ -3543,7 +3538,7 @@ const personalTests = [{
|
|
|
3543
3538
|
"no-restricted-imports": ["error", testsRestrictedImports_default]
|
|
3544
3539
|
}
|
|
3545
3540
|
}];
|
|
3546
|
-
var tests_default$
|
|
3541
|
+
var tests_default$2 = personalTests;
|
|
3547
3542
|
|
|
3548
3543
|
//#endregion
|
|
3549
3544
|
//#region src/configs/plugin/base.ts
|
|
@@ -3574,26 +3569,25 @@ function pluginTests(plugin) {
|
|
|
3574
3569
|
}
|
|
3575
3570
|
}];
|
|
3576
3571
|
}
|
|
3577
|
-
var tests_default$
|
|
3572
|
+
var tests_default$1 = pluginTests;
|
|
3578
3573
|
|
|
3579
3574
|
//#endregion
|
|
3580
3575
|
//#region src/configs/combined/tests.ts
|
|
3581
3576
|
function combinedTests(plugin) {
|
|
3582
3577
|
return [
|
|
3583
3578
|
{ name: "@alextheman/combined/tests" },
|
|
3584
|
-
...tests_default$
|
|
3585
|
-
...tests_default$
|
|
3579
|
+
...tests_default$1(plugin),
|
|
3580
|
+
...tests_default$2
|
|
3586
3581
|
];
|
|
3587
3582
|
}
|
|
3588
3583
|
var tests_default = combinedTests;
|
|
3589
3584
|
|
|
3590
3585
|
//#endregion
|
|
3591
3586
|
//#region src/configs/helpers/javaScriptLanguageOptions.ts
|
|
3592
|
-
var import_globals$1 = /* @__PURE__ */ __toESM(require_globals(), 1);
|
|
3593
3587
|
const javaScriptLanguageOptions = { globals: {
|
|
3594
|
-
...import_globals
|
|
3595
|
-
...import_globals
|
|
3596
|
-
...import_globals
|
|
3588
|
+
...import_globals.default.node,
|
|
3589
|
+
...import_globals.default.browser,
|
|
3590
|
+
...import_globals.default.vitest
|
|
3597
3591
|
} };
|
|
3598
3592
|
var javaScriptLanguageOptions_default = javaScriptLanguageOptions;
|
|
3599
3593
|
|
|
@@ -3609,7 +3603,7 @@ var unusedVarsIgnorePatterns_default = unusedVarsIgnorePatterns;
|
|
|
3609
3603
|
//#endregion
|
|
3610
3604
|
//#region src/configs/general/javaScript.ts
|
|
3611
3605
|
const generalJavaScript = [
|
|
3612
|
-
|
|
3606
|
+
_eslint_js.default.configs.recommended,
|
|
3613
3607
|
eslint_config_prettier.default,
|
|
3614
3608
|
{
|
|
3615
3609
|
files: [
|
|
@@ -3654,7 +3648,6 @@ var prettierRules_default = prettierRules;
|
|
|
3654
3648
|
|
|
3655
3649
|
//#endregion
|
|
3656
3650
|
//#region src/configs/helpers/reactLanguageOptions.ts
|
|
3657
|
-
var import_globals = /* @__PURE__ */ __toESM(require_globals(), 1);
|
|
3658
3651
|
const reactLanguageOptions = {
|
|
3659
3652
|
ecmaVersion: 2020,
|
|
3660
3653
|
globals: import_globals.default.browser,
|
|
@@ -3713,13 +3706,31 @@ var sortExports_default = sortExports;
|
|
|
3713
3706
|
//#endregion
|
|
3714
3707
|
//#region src/configs/helpers/sorting/sortImports.ts
|
|
3715
3708
|
const sortImports = {
|
|
3709
|
+
customGroups: [
|
|
3710
|
+
{
|
|
3711
|
+
elementNamePattern: ["package.json"],
|
|
3712
|
+
groupName: "package-json"
|
|
3713
|
+
},
|
|
3714
|
+
{
|
|
3715
|
+
elementNamePattern: ["^tests/.*"],
|
|
3716
|
+
groupName: "type-tests",
|
|
3717
|
+
selector: "type"
|
|
3718
|
+
},
|
|
3719
|
+
{
|
|
3720
|
+
elementNamePattern: ["^tests/.*"],
|
|
3721
|
+
groupName: "value-tests"
|
|
3722
|
+
}
|
|
3723
|
+
],
|
|
3716
3724
|
groups: [
|
|
3717
3725
|
"type-builtin",
|
|
3718
3726
|
"type-external",
|
|
3727
|
+
"type-tests",
|
|
3719
3728
|
"type-internal",
|
|
3720
3729
|
"value-external",
|
|
3721
3730
|
"value-builtin",
|
|
3722
|
-
"value-
|
|
3731
|
+
"value-tests",
|
|
3732
|
+
"value-internal",
|
|
3733
|
+
"package-json"
|
|
3723
3734
|
],
|
|
3724
3735
|
ignoreCase: true,
|
|
3725
3736
|
internalPattern: ["^src/.*"],
|
|
@@ -3812,7 +3823,7 @@ var javaScript_default = combinedJavaScript;
|
|
|
3812
3823
|
const reactHooks = {
|
|
3813
3824
|
...eslint_plugin_react_hooks.default,
|
|
3814
3825
|
configs: {
|
|
3815
|
-
...(0,
|
|
3826
|
+
...(0, _alextheman_utility.omitProperties)(eslint_plugin_react_hooks.default.configs, "flat"),
|
|
3816
3827
|
"flat/recommended": eslint_plugin_react_hooks.default.configs.flat.recommended,
|
|
3817
3828
|
"flat/recommended-latest": eslint_plugin_react_hooks.default.configs.flat["recommended-latest"]
|
|
3818
3829
|
}
|
|
@@ -3853,7 +3864,7 @@ const generalReact = [
|
|
|
3853
3864
|
settings: { react: { version: "detect" } }
|
|
3854
3865
|
}
|
|
3855
3866
|
];
|
|
3856
|
-
var react_default$
|
|
3867
|
+
var react_default$2 = generalReact;
|
|
3857
3868
|
|
|
3858
3869
|
//#endregion
|
|
3859
3870
|
//#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
|
|
@@ -3881,14 +3892,14 @@ const personalReact = [{
|
|
|
3881
3892
|
"react/jsx-boolean-value": "error"
|
|
3882
3893
|
}
|
|
3883
3894
|
}];
|
|
3884
|
-
var react_default$
|
|
3895
|
+
var react_default$1 = personalReact;
|
|
3885
3896
|
|
|
3886
3897
|
//#endregion
|
|
3887
3898
|
//#region src/configs/combined/react.ts
|
|
3888
3899
|
const combinedReact = [
|
|
3889
3900
|
{ name: "@alextheman/combined/react" },
|
|
3890
|
-
...react_default$
|
|
3891
|
-
...react_default$
|
|
3901
|
+
...react_default$2,
|
|
3902
|
+
...react_default$1
|
|
3892
3903
|
];
|
|
3893
3904
|
var react_default = combinedReact;
|
|
3894
3905
|
|
|
@@ -3934,7 +3945,7 @@ const generalTypeScript = [
|
|
|
3934
3945
|
}
|
|
3935
3946
|
}
|
|
3936
3947
|
];
|
|
3937
|
-
var typeScript_default$
|
|
3948
|
+
var typeScript_default$2 = generalTypeScript;
|
|
3938
3949
|
|
|
3939
3950
|
//#endregion
|
|
3940
3951
|
//#region src/configs/personal/alexCLine.ts
|
|
@@ -4135,7 +4146,7 @@ function personalTypeScript(plugin) {
|
|
|
4135
4146
|
}
|
|
4136
4147
|
}];
|
|
4137
4148
|
}
|
|
4138
|
-
var typeScript_default$
|
|
4149
|
+
var typeScript_default$1 = personalTypeScript;
|
|
4139
4150
|
|
|
4140
4151
|
//#endregion
|
|
4141
4152
|
//#region src/configs/personal/utility.ts
|
|
@@ -4158,8 +4169,8 @@ function combinedTypeScript(plugin) {
|
|
|
4158
4169
|
return [
|
|
4159
4170
|
{ name: "@alextheman/combined/typescript" },
|
|
4160
4171
|
...javaScript_default(plugin),
|
|
4161
|
-
...typeScript_default$
|
|
4162
|
-
...typeScript_default$
|
|
4172
|
+
...typeScript_default$2,
|
|
4173
|
+
...typeScript_default$1(plugin)
|
|
4163
4174
|
];
|
|
4164
4175
|
}
|
|
4165
4176
|
var typeScript_default = combinedTypeScript;
|
|
@@ -4189,7 +4200,7 @@ var typeScriptReact_default = combinedTypeScriptReact;
|
|
|
4189
4200
|
//#endregion
|
|
4190
4201
|
//#region src/utility/private/camelToKebab.ts
|
|
4191
4202
|
function camelToKebab(string) {
|
|
4192
|
-
return (0,
|
|
4203
|
+
return (0, _alextheman_utility.camelToKebab)(string.replace(/[Tt]ypeScript/, "typescript").replace(/[Jj]avaScript/, "javascript"));
|
|
4193
4204
|
}
|
|
4194
4205
|
var camelToKebab_default = camelToKebab;
|
|
4195
4206
|
|
|
@@ -4227,8 +4238,8 @@ function createAlexPluginConfigs(plugin) {
|
|
|
4227
4238
|
general: {
|
|
4228
4239
|
javaScript: javaScript_default$1,
|
|
4229
4240
|
packageJson: packageJson_default,
|
|
4230
|
-
react: react_default$
|
|
4231
|
-
typeScript: typeScript_default$
|
|
4241
|
+
react: react_default$2,
|
|
4242
|
+
typeScript: typeScript_default$2
|
|
4232
4243
|
},
|
|
4233
4244
|
personal: {
|
|
4234
4245
|
alexCLine: alexCLine_default,
|
|
@@ -4237,15 +4248,15 @@ function createAlexPluginConfigs(plugin) {
|
|
|
4237
4248
|
javaScript: javaScriptBase_default(plugin),
|
|
4238
4249
|
neurosongsBackEnd: neurosongsBackEnd_default,
|
|
4239
4250
|
neurosongsFrontEnd: neurosongsFrontEnd_default,
|
|
4240
|
-
react: react_default$
|
|
4241
|
-
tests: tests_default$
|
|
4242
|
-
typeScript: typeScript_default$
|
|
4251
|
+
react: react_default$1,
|
|
4252
|
+
tests: tests_default$2,
|
|
4253
|
+
typeScript: typeScript_default$1(plugin),
|
|
4243
4254
|
typeScriptPackage: typeScriptPackage_default$1,
|
|
4244
4255
|
utility: utility_default
|
|
4245
4256
|
},
|
|
4246
4257
|
plugin: {
|
|
4247
4258
|
base: base_default(plugin),
|
|
4248
|
-
tests: tests_default$
|
|
4259
|
+
tests: tests_default$1(plugin)
|
|
4249
4260
|
}
|
|
4250
4261
|
});
|
|
4251
4262
|
}
|
|
@@ -4253,7 +4264,7 @@ var configs_default = createAlexPluginConfigs;
|
|
|
4253
4264
|
|
|
4254
4265
|
//#endregion
|
|
4255
4266
|
//#region src/rules/helpers/createRule.ts
|
|
4256
|
-
const createRule =
|
|
4267
|
+
const createRule = _typescript_eslint_utils.ESLintUtils.RuleCreator((ruleName) => {
|
|
4257
4268
|
return ruleName;
|
|
4258
4269
|
});
|
|
4259
4270
|
var createRule_default = createRule;
|
|
@@ -4298,7 +4309,7 @@ const consistentTestFunction = createRule_default({
|
|
|
4298
4309
|
const { preference = "test", fixable = true } = parseConsistentTestFunctionOptions(context.options[0] ?? {});
|
|
4299
4310
|
return {
|
|
4300
4311
|
CallExpression(node) {
|
|
4301
|
-
if (node.callee.type ===
|
|
4312
|
+
if (node.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.name === "it" && preference === "test") return context.report({
|
|
4302
4313
|
node,
|
|
4303
4314
|
messageId: "message",
|
|
4304
4315
|
data: {
|
|
@@ -4309,7 +4320,7 @@ const consistentTestFunction = createRule_default({
|
|
|
4309
4320
|
return fixer.replaceText(node.callee, "test");
|
|
4310
4321
|
})
|
|
4311
4322
|
});
|
|
4312
|
-
if (node.callee.type ===
|
|
4323
|
+
if (node.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.name === "test" && preference === "it") return context.report({
|
|
4313
4324
|
node,
|
|
4314
4325
|
messageId: "message",
|
|
4315
4326
|
data: {
|
|
@@ -4323,7 +4334,7 @@ const consistentTestFunction = createRule_default({
|
|
|
4323
4334
|
},
|
|
4324
4335
|
ImportDeclaration(node) {
|
|
4325
4336
|
for (const specifier of node.specifiers) {
|
|
4326
|
-
if (specifier.type ===
|
|
4337
|
+
if (specifier.type === _typescript_eslint_utils.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && specifier.imported.name === "it" && preference === "test") return context.report({
|
|
4327
4338
|
node,
|
|
4328
4339
|
messageId: "message",
|
|
4329
4340
|
data: {
|
|
@@ -4332,7 +4343,7 @@ const consistentTestFunction = createRule_default({
|
|
|
4332
4343
|
},
|
|
4333
4344
|
fix: fixOnCondition_default(fixable, (fixer) => {
|
|
4334
4345
|
const importedNames = node.specifiers.map((specifier$1) => {
|
|
4335
|
-
return specifier$1.type ===
|
|
4346
|
+
return specifier$1.type === _typescript_eslint_utils.AST_NODE_TYPES.ImportSpecifier && specifier$1.imported.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier ? specifier$1.imported.name : "";
|
|
4336
4347
|
});
|
|
4337
4348
|
if (importedNames.includes("it") && importedNames.includes("test")) {
|
|
4338
4349
|
const newSpecifiers = getImportSpecifiersAfterRemoving_default(context, node.specifiers, "it");
|
|
@@ -4341,7 +4352,7 @@ const consistentTestFunction = createRule_default({
|
|
|
4341
4352
|
return fixer.replaceTextRange([specifier.imported.range[0], specifier.imported.range[1]], preference);
|
|
4342
4353
|
})
|
|
4343
4354
|
});
|
|
4344
|
-
if (specifier.type ===
|
|
4355
|
+
if (specifier.type === _typescript_eslint_utils.AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && specifier.imported.name === "test" && preference === "it") return context.report({
|
|
4345
4356
|
node,
|
|
4346
4357
|
messageId: "message",
|
|
4347
4358
|
data: {
|
|
@@ -4350,7 +4361,7 @@ const consistentTestFunction = createRule_default({
|
|
|
4350
4361
|
},
|
|
4351
4362
|
fix: fixOnCondition_default(fixable, (fixer) => {
|
|
4352
4363
|
const importedNames = node.specifiers.map((specifier$1) => {
|
|
4353
|
-
return specifier$1.type ===
|
|
4364
|
+
return specifier$1.type === _typescript_eslint_utils.AST_NODE_TYPES.ImportSpecifier && specifier$1.imported.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier ? specifier$1.imported.name : "";
|
|
4354
4365
|
});
|
|
4355
4366
|
if (importedNames.includes("it") && importedNames.includes("test")) {
|
|
4356
4367
|
const newSpecifiers = getImportSpecifiersAfterRemoving_default(context, node.specifiers, "test");
|
|
@@ -4547,9 +4558,9 @@ const schema = createRuleSchemaFromZodSchema_default(standardiseErrorMessagesOpt
|
|
|
4547
4558
|
const defaultErrorRegex = "^[A-Z]+(?:_[A-Z]+)*$";
|
|
4548
4559
|
function checkCurrentNode(context, node) {
|
|
4549
4560
|
const { regex: errorRegex = defaultErrorRegex } = parseStandardiseErrorMessagesOptions(context.options[0] ?? { regex: defaultErrorRegex });
|
|
4550
|
-
if (node.callee.type ===
|
|
4561
|
+
if (node.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.callee.name === "Error") {
|
|
4551
4562
|
const [errorArgument] = node.arguments;
|
|
4552
|
-
const errorMessage = errorArgument.type ===
|
|
4563
|
+
const errorMessage = errorArgument.type === _typescript_eslint_utils.AST_NODE_TYPES.Literal ? errorArgument.value : "";
|
|
4553
4564
|
if (!RegExp(errorRegex).test(typeof errorMessage === "string" ? errorMessage : "")) return context.report({
|
|
4554
4565
|
node,
|
|
4555
4566
|
messageId: "message",
|
|
@@ -4601,7 +4612,7 @@ const useNormalizedImports = createRule_default({
|
|
|
4601
4612
|
create(context) {
|
|
4602
4613
|
const { fixable = true } = parseUseNormalizedImportsOptions(context.options[0] ?? { fixable: true });
|
|
4603
4614
|
return { ImportDeclaration(node) {
|
|
4604
|
-
const normalizedPath = (0,
|
|
4615
|
+
const normalizedPath = (0, _alextheman_utility.normalizeImportPath)(node.source.value);
|
|
4605
4616
|
if (node.source.value !== normalizedPath) return context.report({
|
|
4606
4617
|
node,
|
|
4607
4618
|
messageId: "pathNotNormalized",
|
|
@@ -4638,7 +4649,7 @@ const useObjectShorthand = createRule_default({
|
|
|
4638
4649
|
create(context) {
|
|
4639
4650
|
const { fixable = true } = parseUseObjectShorthandOptions(context.options[0] ?? { fixable: true });
|
|
4640
4651
|
return { Property(node) {
|
|
4641
|
-
if (node.key.type ===
|
|
4652
|
+
if (node.key.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.value.type === _typescript_eslint_utils.AST_NODE_TYPES.Identifier && node.key.name === node.value.name && !node.shorthand) context.report({
|
|
4642
4653
|
node,
|
|
4643
4654
|
messageId: "useShorthand",
|
|
4644
4655
|
data: { source: context.sourceCode.getText(node) },
|
|
@@ -4666,6 +4677,11 @@ var rules_default = {
|
|
|
4666
4677
|
"use-object-shorthand": use_object_shorthand_default
|
|
4667
4678
|
};
|
|
4668
4679
|
|
|
4680
|
+
//#endregion
|
|
4681
|
+
//#region package.json
|
|
4682
|
+
var name = "@alextheman/eslint-plugin";
|
|
4683
|
+
var version = "4.9.1";
|
|
4684
|
+
|
|
4669
4685
|
//#endregion
|
|
4670
4686
|
//#region src/alexPlugin.ts
|
|
4671
4687
|
const alexPlugin = {
|
|
@@ -4677,7 +4693,7 @@ const alexPlugin = {
|
|
|
4677
4693
|
configs: {},
|
|
4678
4694
|
rules: rules_default
|
|
4679
4695
|
};
|
|
4680
|
-
alexPlugin.configs = configs_default((0,
|
|
4696
|
+
alexPlugin.configs = configs_default((0, _alextheman_utility.deepFreeze)((0, _alextheman_utility.deepCopy)(alexPlugin)));
|
|
4681
4697
|
var alexPlugin_default = alexPlugin;
|
|
4682
4698
|
|
|
4683
4699
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -8,10 +8,6 @@ import z from "zod";
|
|
|
8
8
|
import { TSESTree } from "@typescript-eslint/utils";
|
|
9
9
|
import { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
|
|
10
10
|
|
|
11
|
-
//#region package.d.ts
|
|
12
|
-
declare let name: string;
|
|
13
|
-
declare let version: string;
|
|
14
|
-
//#endregion
|
|
15
11
|
//#region src/utility/private/camelToKebab.d.ts
|
|
16
12
|
type CamelToKebab<S extends string> = S extends `${IgnoreCase<"J">}avaScript${infer Rest}` ? Rest extends "" ? "javascript" : `javascript${CamelToKebab<Rest>}` : S extends `${IgnoreCase<"T">}ypeScript${infer Rest}` ? Rest extends "" ? "typescript" : `typescript${CamelToKebab<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
|
|
17
13
|
//#endregion
|
|
@@ -32,6 +28,10 @@ type ConfigKey = { [Group in ConfigGroupName & string]: `${CamelToKebab<Group>}/
|
|
|
32
28
|
//#region src/configs/index.d.ts
|
|
33
29
|
declare function createAlexPluginConfigs(plugin: Readonly<AlexPlugin>): Record<ConfigKey, Linter.Config[]>;
|
|
34
30
|
//#endregion
|
|
31
|
+
//#region package.d.ts
|
|
32
|
+
declare let name: string;
|
|
33
|
+
declare let version: string;
|
|
34
|
+
//#endregion
|
|
35
35
|
//#region src/alexPlugin.d.ts
|
|
36
36
|
interface AlexPlugin {
|
|
37
37
|
meta: {
|
|
@@ -81,6 +81,15 @@ declare const sortExports: {
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/configs/helpers/sorting/sortImports.d.ts
|
|
83
83
|
declare const sortImports: {
|
|
84
|
+
customGroups: ({
|
|
85
|
+
elementNamePattern: string[];
|
|
86
|
+
groupName: string;
|
|
87
|
+
selector?: undefined;
|
|
88
|
+
} | {
|
|
89
|
+
elementNamePattern: string[];
|
|
90
|
+
groupName: string;
|
|
91
|
+
selector: string;
|
|
92
|
+
})[];
|
|
84
93
|
groups: string[];
|
|
85
94
|
ignoreCase: boolean;
|
|
86
95
|
internalPattern: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -8,10 +8,6 @@ import { VitestEnvironment } from "vitest/node";
|
|
|
8
8
|
import { RuleContext, RuleFix, RuleFixer } from "@typescript-eslint/utils/ts-eslint";
|
|
9
9
|
import { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
|
|
10
10
|
|
|
11
|
-
//#region package.d.ts
|
|
12
|
-
declare let name: string;
|
|
13
|
-
declare let version: string;
|
|
14
|
-
//#endregion
|
|
15
11
|
//#region src/utility/private/camelToKebab.d.ts
|
|
16
12
|
type CamelToKebab<S extends string> = S extends `${IgnoreCase<"J">}avaScript${infer Rest}` ? Rest extends "" ? "javascript" : `javascript${CamelToKebab<Rest>}` : S extends `${IgnoreCase<"T">}ypeScript${infer Rest}` ? Rest extends "" ? "typescript" : `typescript${CamelToKebab<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
|
|
17
13
|
//#endregion
|
|
@@ -32,6 +28,10 @@ type ConfigKey = { [Group in ConfigGroupName & string]: `${CamelToKebab<Group>}/
|
|
|
32
28
|
//#region src/configs/index.d.ts
|
|
33
29
|
declare function createAlexPluginConfigs(plugin: Readonly<AlexPlugin>): Record<ConfigKey, Linter.Config[]>;
|
|
34
30
|
//#endregion
|
|
31
|
+
//#region package.d.ts
|
|
32
|
+
declare let name: string;
|
|
33
|
+
declare let version: string;
|
|
34
|
+
//#endregion
|
|
35
35
|
//#region src/alexPlugin.d.ts
|
|
36
36
|
interface AlexPlugin {
|
|
37
37
|
meta: {
|
|
@@ -81,6 +81,15 @@ declare const sortExports: {
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/configs/helpers/sorting/sortImports.d.ts
|
|
83
83
|
declare const sortImports: {
|
|
84
|
+
customGroups: ({
|
|
85
|
+
elementNamePattern: string[];
|
|
86
|
+
groupName: string;
|
|
87
|
+
selector?: undefined;
|
|
88
|
+
} | {
|
|
89
|
+
elementNamePattern: string[];
|
|
90
|
+
groupName: string;
|
|
91
|
+
selector: string;
|
|
92
|
+
})[];
|
|
84
93
|
groups: string[];
|
|
85
94
|
ignoreCase: boolean;
|
|
86
95
|
internalPattern: string[];
|
package/dist/index.js
CHANGED
|
@@ -43,11 +43,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
43
43
|
enumerable: true
|
|
44
44
|
}) : target, mod));
|
|
45
45
|
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region package.json
|
|
48
|
-
var name = "@alextheman/eslint-plugin";
|
|
49
|
-
var version = "4.9.0";
|
|
50
|
-
|
|
51
46
|
//#endregion
|
|
52
47
|
//#region node_modules/.pnpm/globals@16.5.0/node_modules/globals/globals.json
|
|
53
48
|
var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -3404,7 +3399,7 @@ var require_globals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3404
3399
|
|
|
3405
3400
|
//#endregion
|
|
3406
3401
|
//#region src/configs/helpers/restrictedImports/generalRestrictedImports.ts
|
|
3407
|
-
var import_globals
|
|
3402
|
+
var import_globals = /* @__PURE__ */ __toESM(require_globals(), 1);
|
|
3408
3403
|
const generalRestrictedImports = { patterns: [{
|
|
3409
3404
|
group: ["node_modules"],
|
|
3410
3405
|
message: "Do not import directly from node_modules."
|
|
@@ -3504,9 +3499,9 @@ var testsRestrictedImports_default = testsRestrictedImports;
|
|
|
3504
3499
|
const personalTests = [{
|
|
3505
3500
|
files: ["**/*.test.{js,ts}"],
|
|
3506
3501
|
languageOptions: { globals: {
|
|
3507
|
-
...import_globals
|
|
3508
|
-
...import_globals
|
|
3509
|
-
...import_globals
|
|
3502
|
+
...import_globals.default.node,
|
|
3503
|
+
...import_globals.default.browser,
|
|
3504
|
+
...import_globals.default.vitest
|
|
3510
3505
|
} },
|
|
3511
3506
|
name: "@alextheman/personal/tests",
|
|
3512
3507
|
rules: {
|
|
@@ -3528,7 +3523,7 @@ const personalTests = [{
|
|
|
3528
3523
|
"no-restricted-imports": ["error", testsRestrictedImports_default]
|
|
3529
3524
|
}
|
|
3530
3525
|
}];
|
|
3531
|
-
var tests_default$
|
|
3526
|
+
var tests_default$2 = personalTests;
|
|
3532
3527
|
|
|
3533
3528
|
//#endregion
|
|
3534
3529
|
//#region src/configs/plugin/base.ts
|
|
@@ -3559,26 +3554,25 @@ function pluginTests(plugin) {
|
|
|
3559
3554
|
}
|
|
3560
3555
|
}];
|
|
3561
3556
|
}
|
|
3562
|
-
var tests_default$
|
|
3557
|
+
var tests_default$1 = pluginTests;
|
|
3563
3558
|
|
|
3564
3559
|
//#endregion
|
|
3565
3560
|
//#region src/configs/combined/tests.ts
|
|
3566
3561
|
function combinedTests(plugin) {
|
|
3567
3562
|
return [
|
|
3568
3563
|
{ name: "@alextheman/combined/tests" },
|
|
3569
|
-
...tests_default$
|
|
3570
|
-
...tests_default$
|
|
3564
|
+
...tests_default$1(plugin),
|
|
3565
|
+
...tests_default$2
|
|
3571
3566
|
];
|
|
3572
3567
|
}
|
|
3573
3568
|
var tests_default = combinedTests;
|
|
3574
3569
|
|
|
3575
3570
|
//#endregion
|
|
3576
3571
|
//#region src/configs/helpers/javaScriptLanguageOptions.ts
|
|
3577
|
-
var import_globals$1 = /* @__PURE__ */ __toESM(require_globals(), 1);
|
|
3578
3572
|
const javaScriptLanguageOptions = { globals: {
|
|
3579
|
-
...import_globals
|
|
3580
|
-
...import_globals
|
|
3581
|
-
...import_globals
|
|
3573
|
+
...import_globals.default.node,
|
|
3574
|
+
...import_globals.default.browser,
|
|
3575
|
+
...import_globals.default.vitest
|
|
3582
3576
|
} };
|
|
3583
3577
|
var javaScriptLanguageOptions_default = javaScriptLanguageOptions;
|
|
3584
3578
|
|
|
@@ -3639,7 +3633,6 @@ var prettierRules_default = prettierRules;
|
|
|
3639
3633
|
|
|
3640
3634
|
//#endregion
|
|
3641
3635
|
//#region src/configs/helpers/reactLanguageOptions.ts
|
|
3642
|
-
var import_globals = /* @__PURE__ */ __toESM(require_globals(), 1);
|
|
3643
3636
|
const reactLanguageOptions = {
|
|
3644
3637
|
ecmaVersion: 2020,
|
|
3645
3638
|
globals: import_globals.default.browser,
|
|
@@ -3698,13 +3691,31 @@ var sortExports_default = sortExports;
|
|
|
3698
3691
|
//#endregion
|
|
3699
3692
|
//#region src/configs/helpers/sorting/sortImports.ts
|
|
3700
3693
|
const sortImports = {
|
|
3694
|
+
customGroups: [
|
|
3695
|
+
{
|
|
3696
|
+
elementNamePattern: ["package.json"],
|
|
3697
|
+
groupName: "package-json"
|
|
3698
|
+
},
|
|
3699
|
+
{
|
|
3700
|
+
elementNamePattern: ["^tests/.*"],
|
|
3701
|
+
groupName: "type-tests",
|
|
3702
|
+
selector: "type"
|
|
3703
|
+
},
|
|
3704
|
+
{
|
|
3705
|
+
elementNamePattern: ["^tests/.*"],
|
|
3706
|
+
groupName: "value-tests"
|
|
3707
|
+
}
|
|
3708
|
+
],
|
|
3701
3709
|
groups: [
|
|
3702
3710
|
"type-builtin",
|
|
3703
3711
|
"type-external",
|
|
3712
|
+
"type-tests",
|
|
3704
3713
|
"type-internal",
|
|
3705
3714
|
"value-external",
|
|
3706
3715
|
"value-builtin",
|
|
3707
|
-
"value-
|
|
3716
|
+
"value-tests",
|
|
3717
|
+
"value-internal",
|
|
3718
|
+
"package-json"
|
|
3708
3719
|
],
|
|
3709
3720
|
ignoreCase: true,
|
|
3710
3721
|
internalPattern: ["^src/.*"],
|
|
@@ -3838,7 +3849,7 @@ const generalReact = [
|
|
|
3838
3849
|
settings: { react: { version: "detect" } }
|
|
3839
3850
|
}
|
|
3840
3851
|
];
|
|
3841
|
-
var react_default$
|
|
3852
|
+
var react_default$2 = generalReact;
|
|
3842
3853
|
|
|
3843
3854
|
//#endregion
|
|
3844
3855
|
//#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
|
|
@@ -3866,14 +3877,14 @@ const personalReact = [{
|
|
|
3866
3877
|
"react/jsx-boolean-value": "error"
|
|
3867
3878
|
}
|
|
3868
3879
|
}];
|
|
3869
|
-
var react_default$
|
|
3880
|
+
var react_default$1 = personalReact;
|
|
3870
3881
|
|
|
3871
3882
|
//#endregion
|
|
3872
3883
|
//#region src/configs/combined/react.ts
|
|
3873
3884
|
const combinedReact = [
|
|
3874
3885
|
{ name: "@alextheman/combined/react" },
|
|
3875
|
-
...react_default$
|
|
3876
|
-
...react_default$
|
|
3886
|
+
...react_default$2,
|
|
3887
|
+
...react_default$1
|
|
3877
3888
|
];
|
|
3878
3889
|
var react_default = combinedReact;
|
|
3879
3890
|
|
|
@@ -3919,7 +3930,7 @@ const generalTypeScript = [
|
|
|
3919
3930
|
}
|
|
3920
3931
|
}
|
|
3921
3932
|
];
|
|
3922
|
-
var typeScript_default$
|
|
3933
|
+
var typeScript_default$2 = generalTypeScript;
|
|
3923
3934
|
|
|
3924
3935
|
//#endregion
|
|
3925
3936
|
//#region src/configs/personal/alexCLine.ts
|
|
@@ -4120,7 +4131,7 @@ function personalTypeScript(plugin) {
|
|
|
4120
4131
|
}
|
|
4121
4132
|
}];
|
|
4122
4133
|
}
|
|
4123
|
-
var typeScript_default$
|
|
4134
|
+
var typeScript_default$1 = personalTypeScript;
|
|
4124
4135
|
|
|
4125
4136
|
//#endregion
|
|
4126
4137
|
//#region src/configs/personal/utility.ts
|
|
@@ -4143,8 +4154,8 @@ function combinedTypeScript(plugin) {
|
|
|
4143
4154
|
return [
|
|
4144
4155
|
{ name: "@alextheman/combined/typescript" },
|
|
4145
4156
|
...javaScript_default(plugin),
|
|
4146
|
-
...typeScript_default$
|
|
4147
|
-
...typeScript_default$
|
|
4157
|
+
...typeScript_default$2,
|
|
4158
|
+
...typeScript_default$1(plugin)
|
|
4148
4159
|
];
|
|
4149
4160
|
}
|
|
4150
4161
|
var typeScript_default = combinedTypeScript;
|
|
@@ -4212,8 +4223,8 @@ function createAlexPluginConfigs(plugin) {
|
|
|
4212
4223
|
general: {
|
|
4213
4224
|
javaScript: javaScript_default$1,
|
|
4214
4225
|
packageJson: packageJson_default,
|
|
4215
|
-
react: react_default$
|
|
4216
|
-
typeScript: typeScript_default$
|
|
4226
|
+
react: react_default$2,
|
|
4227
|
+
typeScript: typeScript_default$2
|
|
4217
4228
|
},
|
|
4218
4229
|
personal: {
|
|
4219
4230
|
alexCLine: alexCLine_default,
|
|
@@ -4222,15 +4233,15 @@ function createAlexPluginConfigs(plugin) {
|
|
|
4222
4233
|
javaScript: javaScriptBase_default(plugin),
|
|
4223
4234
|
neurosongsBackEnd: neurosongsBackEnd_default,
|
|
4224
4235
|
neurosongsFrontEnd: neurosongsFrontEnd_default,
|
|
4225
|
-
react: react_default$
|
|
4226
|
-
tests: tests_default$
|
|
4227
|
-
typeScript: typeScript_default$
|
|
4236
|
+
react: react_default$1,
|
|
4237
|
+
tests: tests_default$2,
|
|
4238
|
+
typeScript: typeScript_default$1(plugin),
|
|
4228
4239
|
typeScriptPackage: typeScriptPackage_default$1,
|
|
4229
4240
|
utility: utility_default
|
|
4230
4241
|
},
|
|
4231
4242
|
plugin: {
|
|
4232
4243
|
base: base_default(plugin),
|
|
4233
|
-
tests: tests_default$
|
|
4244
|
+
tests: tests_default$1(plugin)
|
|
4234
4245
|
}
|
|
4235
4246
|
});
|
|
4236
4247
|
}
|
|
@@ -4651,6 +4662,11 @@ var rules_default = {
|
|
|
4651
4662
|
"use-object-shorthand": use_object_shorthand_default
|
|
4652
4663
|
};
|
|
4653
4664
|
|
|
4665
|
+
//#endregion
|
|
4666
|
+
//#region package.json
|
|
4667
|
+
var name = "@alextheman/eslint-plugin";
|
|
4668
|
+
var version = "4.9.1";
|
|
4669
|
+
|
|
4654
4670
|
//#endregion
|
|
4655
4671
|
//#region src/alexPlugin.ts
|
|
4656
4672
|
const alexPlugin = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/eslint-plugin",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.1",
|
|
4
4
|
"description": "A package to provide custom ESLint rules and configs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,21 +15,22 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alextheman/utility": "^3.
|
|
19
|
-
"@typescript-eslint/utils": "^8.
|
|
18
|
+
"@alextheman/utility": "^3.10.1",
|
|
19
|
+
"@typescript-eslint/utils": "^8.50.0",
|
|
20
20
|
"common-tags": "^1.8.2",
|
|
21
|
-
"zod": "^4.1
|
|
21
|
+
"zod": "^4.2.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@eslint/js": "^9.39.
|
|
24
|
+
"@eslint/js": "^9.39.2",
|
|
25
25
|
"@types/common-tags": "^1.8.4",
|
|
26
26
|
"@types/eslint": "^9.6.1",
|
|
27
27
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
28
|
-
"@types/node": "^25.0.
|
|
29
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
30
|
-
"
|
|
28
|
+
"@types/node": "^25.0.3",
|
|
29
|
+
"@typescript-eslint/rule-tester": "^8.50.0",
|
|
30
|
+
"@typescript-eslint/types": "^8.50.0",
|
|
31
|
+
"alex-c-line": "^1.9.0",
|
|
31
32
|
"dotenv-cli": "^11.0.0",
|
|
32
|
-
"eslint": "^9.39.
|
|
33
|
+
"eslint": "^9.39.2",
|
|
33
34
|
"eslint-config-prettier": "^10.1.8",
|
|
34
35
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
35
36
|
"eslint-plugin-import": "^2.32.0",
|
|
@@ -40,18 +41,18 @@
|
|
|
40
41
|
"eslint-plugin-prettier": "^5.5.4",
|
|
41
42
|
"eslint-plugin-react": "^7.37.5",
|
|
42
43
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
43
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
44
|
-
"eslint-vitest-rule-tester": "^3.0.
|
|
44
|
+
"eslint-plugin-react-refresh": "^0.4.26",
|
|
45
|
+
"eslint-vitest-rule-tester": "^3.0.1",
|
|
45
46
|
"globals": "^16.5.0",
|
|
46
47
|
"husky": "^9.1.7",
|
|
47
48
|
"jsdom": "^27.3.0",
|
|
48
49
|
"prettier": "^3.7.4",
|
|
49
|
-
"tsdown": "^0.
|
|
50
|
+
"tsdown": "^0.18.1",
|
|
50
51
|
"tsx": "^4.21.0",
|
|
51
52
|
"typescript": "^5.9.3",
|
|
52
|
-
"typescript-eslint": "^8.
|
|
53
|
-
"vite-tsconfig-paths": "^
|
|
54
|
-
"vitest": "^4.0.
|
|
53
|
+
"typescript-eslint": "^8.50.0",
|
|
54
|
+
"vite-tsconfig-paths": "^6.0.3",
|
|
55
|
+
"vitest": "^4.0.16"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
58
|
"@eslint/js": ">=9.0.0",
|