@alextheman/eslint-plugin 5.12.0 → 5.13.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/README.md +1 -1
- package/dist/index.cjs +158 -188
- package/dist/index.d.cts +1 -6
- package/dist/index.d.ts +1 -6
- package/dist/index.js +140 -173
- package/dist/internal/index.cjs +84 -35
- package/dist/internal/index.js +82 -33
- package/dist/utility/index.cjs +11 -24
- package/dist/utility/index.js +3 -11
- package/package.json +28 -30
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { camelToKebab, deepCopy, deepFreeze, normaliseIndents, omitProperties, parseZodSchema } from "@alextheman/utility";
|
|
2
2
|
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
3
3
|
import z from "zod";
|
|
4
|
+
import { DataError } from "@alextheman/utility/v6";
|
|
4
5
|
import js from "@eslint/js";
|
|
5
6
|
import prettierConfig$1 from "eslint-config-prettier";
|
|
6
|
-
import
|
|
7
|
+
import * as tsResolver from "eslint-import-resolver-typescript";
|
|
8
|
+
import importPlugin from "eslint-plugin-import-x";
|
|
7
9
|
import nodePlugin from "eslint-plugin-n";
|
|
8
10
|
import perfectionist from "eslint-plugin-perfectionist";
|
|
9
11
|
import prettierPlugin from "eslint-plugin-prettier";
|
|
@@ -15,7 +17,6 @@ import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
|
15
17
|
import packageJson from "eslint-plugin-package-json";
|
|
16
18
|
import jsdoc from "eslint-plugin-jsdoc";
|
|
17
19
|
import { normalizeImportPath } from "@alextheman/utility/node";
|
|
18
|
-
|
|
19
20
|
//#region \0rolldown/runtime.js
|
|
20
21
|
var __create = Object.create;
|
|
21
22
|
var __defProp = Object.defineProperty;
|
|
@@ -23,18 +24,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
23
24
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
24
25
|
var __getProtoOf = Object.getPrototypeOf;
|
|
25
26
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
26
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
27
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
27
28
|
var __copyProps = (to, from, except, desc) => {
|
|
28
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
30
|
+
key = keys[i];
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
32
|
+
get: ((k) => from[k]).bind(null, key),
|
|
33
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
34
|
+
});
|
|
38
35
|
}
|
|
39
36
|
return to;
|
|
40
37
|
};
|
|
@@ -42,9 +39,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
42
39
|
value: mod,
|
|
43
40
|
enumerable: true
|
|
44
41
|
}) : target, mod));
|
|
45
|
-
|
|
46
42
|
//#endregion
|
|
47
|
-
//#region node_modules/.pnpm/globals@17.
|
|
43
|
+
//#region node_modules/.pnpm/globals@17.5.0/node_modules/globals/globals.json
|
|
48
44
|
var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
49
45
|
module.exports = {
|
|
50
46
|
"amd": {
|
|
@@ -150,6 +146,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
150
146
|
"AudioNode": false,
|
|
151
147
|
"AudioParam": false,
|
|
152
148
|
"AudioParamMap": false,
|
|
149
|
+
"AudioPlaybackStats": false,
|
|
153
150
|
"AudioProcessingEvent": false,
|
|
154
151
|
"AudioScheduledSourceNode": false,
|
|
155
152
|
"AudioSinkInfo": false,
|
|
@@ -941,6 +938,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
941
938
|
"RTCSessionDescription": false,
|
|
942
939
|
"RTCStatsReport": false,
|
|
943
940
|
"RTCTrackEvent": false,
|
|
941
|
+
"Sanitizer": false,
|
|
944
942
|
"scheduler": false,
|
|
945
943
|
"Scheduler": false,
|
|
946
944
|
"Scheduling": false,
|
|
@@ -1142,6 +1140,9 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1142
1140
|
"TextTrackList": false,
|
|
1143
1141
|
"TextUpdateEvent": false,
|
|
1144
1142
|
"TimeEvent": false,
|
|
1143
|
+
"TimelineTrigger": false,
|
|
1144
|
+
"TimelineTriggerRange": false,
|
|
1145
|
+
"TimelineTriggerRangeList": false,
|
|
1145
1146
|
"TimeRanges": false,
|
|
1146
1147
|
"ToggleEvent": false,
|
|
1147
1148
|
"toolbar": false,
|
|
@@ -1587,6 +1588,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1587
1588
|
"PromiseRejectionEvent": false,
|
|
1588
1589
|
"prompt": false,
|
|
1589
1590
|
"queueMicrotask": false,
|
|
1591
|
+
"QuotaExceededError": false,
|
|
1590
1592
|
"ReadableByteStreamController": false,
|
|
1591
1593
|
"ReadableStream": false,
|
|
1592
1594
|
"ReadableStreamBYOBReader": false,
|
|
@@ -2377,6 +2379,70 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2377
2379
|
"WeakRef": false,
|
|
2378
2380
|
"WeakSet": false
|
|
2379
2381
|
},
|
|
2382
|
+
"es2027": {
|
|
2383
|
+
"AggregateError": false,
|
|
2384
|
+
"Array": false,
|
|
2385
|
+
"ArrayBuffer": false,
|
|
2386
|
+
"Atomics": false,
|
|
2387
|
+
"BigInt": false,
|
|
2388
|
+
"BigInt64Array": false,
|
|
2389
|
+
"BigUint64Array": false,
|
|
2390
|
+
"Boolean": false,
|
|
2391
|
+
"DataView": false,
|
|
2392
|
+
"Date": false,
|
|
2393
|
+
"decodeURI": false,
|
|
2394
|
+
"decodeURIComponent": false,
|
|
2395
|
+
"encodeURI": false,
|
|
2396
|
+
"encodeURIComponent": false,
|
|
2397
|
+
"Error": false,
|
|
2398
|
+
"escape": false,
|
|
2399
|
+
"eval": false,
|
|
2400
|
+
"EvalError": false,
|
|
2401
|
+
"FinalizationRegistry": false,
|
|
2402
|
+
"Float16Array": false,
|
|
2403
|
+
"Float32Array": false,
|
|
2404
|
+
"Float64Array": false,
|
|
2405
|
+
"Function": false,
|
|
2406
|
+
"globalThis": false,
|
|
2407
|
+
"Infinity": false,
|
|
2408
|
+
"Int16Array": false,
|
|
2409
|
+
"Int32Array": false,
|
|
2410
|
+
"Int8Array": false,
|
|
2411
|
+
"Intl": false,
|
|
2412
|
+
"isFinite": false,
|
|
2413
|
+
"isNaN": false,
|
|
2414
|
+
"Iterator": false,
|
|
2415
|
+
"JSON": false,
|
|
2416
|
+
"Map": false,
|
|
2417
|
+
"Math": false,
|
|
2418
|
+
"NaN": false,
|
|
2419
|
+
"Number": false,
|
|
2420
|
+
"Object": false,
|
|
2421
|
+
"parseFloat": false,
|
|
2422
|
+
"parseInt": false,
|
|
2423
|
+
"Promise": false,
|
|
2424
|
+
"Proxy": false,
|
|
2425
|
+
"RangeError": false,
|
|
2426
|
+
"ReferenceError": false,
|
|
2427
|
+
"Reflect": false,
|
|
2428
|
+
"RegExp": false,
|
|
2429
|
+
"Set": false,
|
|
2430
|
+
"SharedArrayBuffer": false,
|
|
2431
|
+
"String": false,
|
|
2432
|
+
"Symbol": false,
|
|
2433
|
+
"SyntaxError": false,
|
|
2434
|
+
"TypeError": false,
|
|
2435
|
+
"Uint16Array": false,
|
|
2436
|
+
"Uint32Array": false,
|
|
2437
|
+
"Uint8Array": false,
|
|
2438
|
+
"Uint8ClampedArray": false,
|
|
2439
|
+
"undefined": false,
|
|
2440
|
+
"unescape": false,
|
|
2441
|
+
"URIError": false,
|
|
2442
|
+
"WeakMap": false,
|
|
2443
|
+
"WeakRef": false,
|
|
2444
|
+
"WeakSet": false
|
|
2445
|
+
},
|
|
2380
2446
|
"es3": {
|
|
2381
2447
|
"Array": false,
|
|
2382
2448
|
"Boolean": false,
|
|
@@ -4068,20 +4134,17 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4068
4134
|
}
|
|
4069
4135
|
};
|
|
4070
4136
|
}));
|
|
4071
|
-
|
|
4072
4137
|
//#endregion
|
|
4073
|
-
//#region node_modules/.pnpm/globals@17.
|
|
4138
|
+
//#region node_modules/.pnpm/globals@17.5.0/node_modules/globals/index.js
|
|
4074
4139
|
var require_globals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4075
4140
|
module.exports = require_globals$1();
|
|
4076
4141
|
}));
|
|
4077
|
-
|
|
4078
4142
|
//#endregion
|
|
4079
4143
|
//#region src/configs/helpers/restrictedImports/generalRestrictedImports.ts
|
|
4080
4144
|
const generalRestrictedImports = { patterns: [{
|
|
4081
4145
|
group: ["node_modules"],
|
|
4082
4146
|
message: "Do not import directly from node_modules."
|
|
4083
4147
|
}] };
|
|
4084
|
-
|
|
4085
4148
|
//#endregion
|
|
4086
4149
|
//#region src/utility/public/checkCallExpression.ts
|
|
4087
4150
|
/**
|
|
@@ -4098,7 +4161,6 @@ const generalRestrictedImports = { patterns: [{
|
|
|
4098
4161
|
function checkCallExpression(node, objectName, propertyName) {
|
|
4099
4162
|
return node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.object.name === objectName && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === propertyName;
|
|
4100
4163
|
}
|
|
4101
|
-
|
|
4102
4164
|
//#endregion
|
|
4103
4165
|
//#region src/utility/public/combineRestrictedImports.ts
|
|
4104
4166
|
/**
|
|
@@ -4125,7 +4187,6 @@ function combineRestrictedImports(...groups) {
|
|
|
4125
4187
|
if (combinedGroup.patterns.length === 0) return omitProperties(combinedGroup, "patterns");
|
|
4126
4188
|
return combinedGroup;
|
|
4127
4189
|
}
|
|
4128
|
-
|
|
4129
4190
|
//#endregion
|
|
4130
4191
|
//#region src/utility/public/createRuleSchemaFromZodSchema.ts
|
|
4131
4192
|
/**
|
|
@@ -4140,7 +4201,6 @@ function combineRestrictedImports(...groups) {
|
|
|
4140
4201
|
function createRuleSchemaFromZodSchema(schema) {
|
|
4141
4202
|
return [omitProperties(z.toJSONSchema(schema), "$schema")];
|
|
4142
4203
|
}
|
|
4143
|
-
|
|
4144
4204
|
//#endregion
|
|
4145
4205
|
//#region src/utility/public/fixOnCondition.ts
|
|
4146
4206
|
/**
|
|
@@ -4159,14 +4219,12 @@ function fixOnCondition(fixable, fix) {
|
|
|
4159
4219
|
return fix(fixer);
|
|
4160
4220
|
};
|
|
4161
4221
|
}
|
|
4162
|
-
|
|
4163
4222
|
//#endregion
|
|
4164
4223
|
//#region src/utility/private/camelToKebab.ts
|
|
4165
4224
|
function camelToKebab$1(string) {
|
|
4166
4225
|
if (string[0] === string[0].toUpperCase()) throw new DataError({ string }, "CAMEL_TO_KEBAB_CONVERSION_ERROR", "camelCase string must start with a lowercase letter.");
|
|
4167
4226
|
return camelToKebab(string, { preserveConsecutiveCapitals: false });
|
|
4168
4227
|
}
|
|
4169
|
-
|
|
4170
4228
|
//#endregion
|
|
4171
4229
|
//#region src/utility/private/createConfigGroup.ts
|
|
4172
4230
|
function createConfigGroup(group, configs) {
|
|
@@ -4174,7 +4232,6 @@ function createConfigGroup(group, configs) {
|
|
|
4174
4232
|
for (const key in configs) newConfigs[`${camelToKebab$1(group)}/${camelToKebab$1(key)}`] = configs[key];
|
|
4175
4233
|
return newConfigs;
|
|
4176
4234
|
}
|
|
4177
|
-
|
|
4178
4235
|
//#endregion
|
|
4179
4236
|
//#region src/utility/public/flattenConfigs.ts
|
|
4180
4237
|
/**
|
|
@@ -4219,7 +4276,6 @@ function flattenConfigs(config) {
|
|
|
4219
4276
|
for (const configGroupEntries of Object.entries(config)) Object.assign(allConfigs, createConfigGroup(...configGroupEntries));
|
|
4220
4277
|
return allConfigs;
|
|
4221
4278
|
}
|
|
4222
|
-
|
|
4223
4279
|
//#endregion
|
|
4224
4280
|
//#region src/utility/public/getImportSpecifiersAfterRemoving.ts
|
|
4225
4281
|
/**
|
|
@@ -4244,14 +4300,12 @@ function getImportSpecifiersAfterRemoving(context, specifiers, importToRemove) {
|
|
|
4244
4300
|
return context.sourceCode.getText(specifier);
|
|
4245
4301
|
}).join(", ");
|
|
4246
4302
|
}
|
|
4247
|
-
|
|
4248
4303
|
//#endregion
|
|
4249
4304
|
//#region src/configs/helpers/restrictedImports/testsRestrictedImports.ts
|
|
4250
4305
|
const testsRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [{
|
|
4251
4306
|
message: "Use test functions from vitest instead.",
|
|
4252
4307
|
name: "node:test"
|
|
4253
4308
|
}] });
|
|
4254
|
-
|
|
4255
4309
|
//#endregion
|
|
4256
4310
|
//#region src/configs/internal/tests.ts
|
|
4257
4311
|
var import_globals = /* @__PURE__ */ __toESM(require_globals(), 1);
|
|
@@ -4282,7 +4336,6 @@ const internalTests = [{
|
|
|
4282
4336
|
"no-restricted-imports": ["error", testsRestrictedImports]
|
|
4283
4337
|
}
|
|
4284
4338
|
}];
|
|
4285
|
-
|
|
4286
4339
|
//#endregion
|
|
4287
4340
|
//#region src/configs/plugin/base.ts
|
|
4288
4341
|
function pluginBase(plugin) {
|
|
@@ -4296,7 +4349,6 @@ function pluginBase(plugin) {
|
|
|
4296
4349
|
}
|
|
4297
4350
|
}];
|
|
4298
4351
|
}
|
|
4299
|
-
|
|
4300
4352
|
//#endregion
|
|
4301
4353
|
//#region src/configs/plugin/tests.ts
|
|
4302
4354
|
function pluginTests(plugin) {
|
|
@@ -4311,7 +4363,6 @@ function pluginTests(plugin) {
|
|
|
4311
4363
|
}
|
|
4312
4364
|
}];
|
|
4313
4365
|
}
|
|
4314
|
-
|
|
4315
4366
|
//#endregion
|
|
4316
4367
|
//#region src/configs/combined/tests.ts
|
|
4317
4368
|
function combinedTests(plugin) {
|
|
@@ -4321,7 +4372,6 @@ function combinedTests(plugin) {
|
|
|
4321
4372
|
...internalTests
|
|
4322
4373
|
];
|
|
4323
4374
|
}
|
|
4324
|
-
|
|
4325
4375
|
//#endregion
|
|
4326
4376
|
//#region src/configs/helpers/javaScriptLanguageOptions.ts
|
|
4327
4377
|
const javaScriptLanguageOptions = { globals: {
|
|
@@ -4329,7 +4379,6 @@ const javaScriptLanguageOptions = { globals: {
|
|
|
4329
4379
|
...import_globals.default.browser,
|
|
4330
4380
|
...import_globals.default.vitest
|
|
4331
4381
|
} };
|
|
4332
|
-
|
|
4333
4382
|
//#endregion
|
|
4334
4383
|
//#region src/configs/helpers/unusedVarsIgnorePatterns.ts
|
|
4335
4384
|
const unusedVarsIgnorePatterns = {
|
|
@@ -4337,7 +4386,6 @@ const unusedVarsIgnorePatterns = {
|
|
|
4337
4386
|
caughtErrorsIgnorePattern: "^_",
|
|
4338
4387
|
varsIgnorePattern: "^_"
|
|
4339
4388
|
};
|
|
4340
|
-
|
|
4341
4389
|
//#endregion
|
|
4342
4390
|
//#region src/configs/general/javaScript.ts
|
|
4343
4391
|
const generalJavaScript = [
|
|
@@ -4355,13 +4403,13 @@ const generalJavaScript = [
|
|
|
4355
4403
|
languageOptions: javaScriptLanguageOptions,
|
|
4356
4404
|
name: "@alextheman/general/javascript",
|
|
4357
4405
|
plugins: {
|
|
4358
|
-
import: importPlugin,
|
|
4406
|
+
"import-x": importPlugin,
|
|
4359
4407
|
n: nodePlugin
|
|
4360
4408
|
},
|
|
4361
4409
|
rules: {
|
|
4362
4410
|
eqeqeq: "error",
|
|
4363
|
-
"import/no-duplicates": ["error", { "prefer-inline": false }],
|
|
4364
|
-
"import/no-unresolved": "error",
|
|
4411
|
+
"import-x/no-duplicates": ["error", { "prefer-inline": false }],
|
|
4412
|
+
"import-x/no-unresolved": "error",
|
|
4365
4413
|
"n/file-extension-in-import": [
|
|
4366
4414
|
"error",
|
|
4367
4415
|
"always",
|
|
@@ -4393,14 +4441,16 @@ const generalJavaScript = [
|
|
|
4393
4441
|
"no-useless-return": "error",
|
|
4394
4442
|
"prefer-const": "error"
|
|
4395
4443
|
},
|
|
4396
|
-
settings: { "import/resolver": {
|
|
4444
|
+
settings: { "import-x/resolver": {
|
|
4445
|
+
name: "tsResolver",
|
|
4446
|
+
options: { node: true },
|
|
4447
|
+
resolver: tsResolver
|
|
4448
|
+
} }
|
|
4397
4449
|
}
|
|
4398
4450
|
];
|
|
4399
|
-
|
|
4400
4451
|
//#endregion
|
|
4401
4452
|
//#region src/configs/external/prettierConfig.ts
|
|
4402
4453
|
const prettierConfig = { printWidth: 100 };
|
|
4403
|
-
|
|
4404
4454
|
//#endregion
|
|
4405
4455
|
//#region src/configs/helpers/reactLanguageOptions.ts
|
|
4406
4456
|
const reactLanguageOptions = {
|
|
@@ -4408,7 +4458,6 @@ const reactLanguageOptions = {
|
|
|
4408
4458
|
globals: import_globals.default.browser,
|
|
4409
4459
|
parserOptions: { ecmaFeatures: { jsx: true } }
|
|
4410
4460
|
};
|
|
4411
|
-
|
|
4412
4461
|
//#endregion
|
|
4413
4462
|
//#region src/configs/helpers/typeScriptLanguageOptions.ts
|
|
4414
4463
|
const typeScriptLanguageOptions = {
|
|
@@ -4420,7 +4469,6 @@ const typeScriptLanguageOptions = {
|
|
|
4420
4469
|
tsconfigRootDir: process.cwd()
|
|
4421
4470
|
}
|
|
4422
4471
|
};
|
|
4423
|
-
|
|
4424
4472
|
//#endregion
|
|
4425
4473
|
//#region src/configs/helpers/sorting/sortClasses.ts
|
|
4426
4474
|
const sortClasses = {
|
|
@@ -4447,7 +4495,6 @@ const sortClasses = {
|
|
|
4447
4495
|
specialCharacters: "keep",
|
|
4448
4496
|
type: "alphabetical"
|
|
4449
4497
|
};
|
|
4450
|
-
|
|
4451
4498
|
//#endregion
|
|
4452
4499
|
//#region src/configs/helpers/sorting/sortExports.ts
|
|
4453
4500
|
const sortExports = {
|
|
@@ -4467,7 +4514,6 @@ const sortExports = {
|
|
|
4467
4514
|
specialCharacters: "keep",
|
|
4468
4515
|
type: "alphabetical"
|
|
4469
4516
|
};
|
|
4470
|
-
|
|
4471
4517
|
//#endregion
|
|
4472
4518
|
//#region src/configs/helpers/sorting/sortImports.ts
|
|
4473
4519
|
const sortImports = {
|
|
@@ -4506,7 +4552,6 @@ const sortImports = {
|
|
|
4506
4552
|
specialCharacters: "keep",
|
|
4507
4553
|
type: "alphabetical"
|
|
4508
4554
|
};
|
|
4509
|
-
|
|
4510
4555
|
//#endregion
|
|
4511
4556
|
//#region src/configs/helpers/sorting/sortObjects.ts
|
|
4512
4557
|
const sortObjects = {
|
|
@@ -4523,7 +4568,6 @@ const sortObjects = {
|
|
|
4523
4568
|
type: "alphabetical",
|
|
4524
4569
|
useConfigurationIf: {}
|
|
4525
4570
|
};
|
|
4526
|
-
|
|
4527
4571
|
//#endregion
|
|
4528
4572
|
//#region src/configs/helpers/restrictedImports/personalRestrictedImports.ts
|
|
4529
4573
|
const personalRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [...["fs", "node:fs"].map((name) => {
|
|
@@ -4532,7 +4576,6 @@ const personalRestrictedImports = combineRestrictedImports(generalRestrictedImpo
|
|
|
4532
4576
|
name
|
|
4533
4577
|
};
|
|
4534
4578
|
})] });
|
|
4535
|
-
|
|
4536
4579
|
//#endregion
|
|
4537
4580
|
//#region src/configs/helpers/sorting/sortNamedImports.ts
|
|
4538
4581
|
const sortNamedImports = {
|
|
@@ -4547,7 +4590,6 @@ const sortNamedImports = {
|
|
|
4547
4590
|
specialCharacters: "keep",
|
|
4548
4591
|
type: "alphabetical"
|
|
4549
4592
|
};
|
|
4550
|
-
|
|
4551
4593
|
//#endregion
|
|
4552
4594
|
//#region src/configs/internal/javaScript.ts
|
|
4553
4595
|
function internalJavaScript(plugin) {
|
|
@@ -4562,7 +4604,6 @@ function internalJavaScript(plugin) {
|
|
|
4562
4604
|
name: "@alextheman/internal/javascript",
|
|
4563
4605
|
plugins: {
|
|
4564
4606
|
"@alextheman": plugin,
|
|
4565
|
-
import: importPlugin,
|
|
4566
4607
|
n: nodePlugin,
|
|
4567
4608
|
perfectionist,
|
|
4568
4609
|
prettier: prettierPlugin
|
|
@@ -4576,7 +4617,6 @@ function internalJavaScript(plugin) {
|
|
|
4576
4617
|
"declaration",
|
|
4577
4618
|
{ allowArrowFunctions: false }
|
|
4578
4619
|
],
|
|
4579
|
-
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
4580
4620
|
"n/no-extraneous-import": "off",
|
|
4581
4621
|
"no-else-return": "error",
|
|
4582
4622
|
"no-implicit-coercion": ["error", { allow: ["!!"] }],
|
|
@@ -4597,7 +4637,6 @@ function internalJavaScript(plugin) {
|
|
|
4597
4637
|
rules: { "@alextheman/no-relative-imports": ["error", { depth: 0 }] }
|
|
4598
4638
|
}];
|
|
4599
4639
|
}
|
|
4600
|
-
|
|
4601
4640
|
//#endregion
|
|
4602
4641
|
//#region src/configs/combined/javaScript.ts
|
|
4603
4642
|
function combinedJavaScript(plugin) {
|
|
@@ -4609,7 +4648,6 @@ function combinedJavaScript(plugin) {
|
|
|
4609
4648
|
...combinedTests(plugin)
|
|
4610
4649
|
];
|
|
4611
4650
|
}
|
|
4612
|
-
|
|
4613
4651
|
//#endregion
|
|
4614
4652
|
//#region src/configs/helpers/eslint-plugin-react-hooks.ts
|
|
4615
4653
|
const reactHooks = {
|
|
@@ -4620,7 +4658,6 @@ const reactHooks = {
|
|
|
4620
4658
|
"flat/recommended-latest": reactHooksPlugin.configs.flat["recommended-latest"]
|
|
4621
4659
|
}
|
|
4622
4660
|
};
|
|
4623
|
-
|
|
4624
4661
|
//#endregion
|
|
4625
4662
|
//#region src/configs/general/react.ts
|
|
4626
4663
|
const generalReact = [
|
|
@@ -4655,14 +4692,12 @@ const generalReact = [
|
|
|
4655
4692
|
settings: { react: { version: "detect" } }
|
|
4656
4693
|
}
|
|
4657
4694
|
];
|
|
4658
|
-
|
|
4659
4695
|
//#endregion
|
|
4660
4696
|
//#region src/configs/helpers/restrictedImports/reactRestrictedImports.ts
|
|
4661
4697
|
const reactRestrictedImports = combineRestrictedImports(generalRestrictedImports, { patterns: [{
|
|
4662
4698
|
message: "Please use `import Component from \"@mui/[package]/Component\"` instead. See https://mui.com/material-ui/guides/minimizing-bundle-size/ for more information.",
|
|
4663
4699
|
regex: "^@mui/[^/]+$"
|
|
4664
4700
|
}] });
|
|
4665
|
-
|
|
4666
4701
|
//#endregion
|
|
4667
4702
|
//#region src/configs/internal/react.ts
|
|
4668
4703
|
const internalReact = [{
|
|
@@ -4681,7 +4716,6 @@ const internalReact = [{
|
|
|
4681
4716
|
"react/jsx-boolean-value": "error"
|
|
4682
4717
|
}
|
|
4683
4718
|
}];
|
|
4684
|
-
|
|
4685
4719
|
//#endregion
|
|
4686
4720
|
//#region src/configs/combined/react.ts
|
|
4687
4721
|
const combinedReact = [
|
|
@@ -4689,7 +4723,6 @@ const combinedReact = [
|
|
|
4689
4723
|
...generalReact,
|
|
4690
4724
|
...internalReact
|
|
4691
4725
|
];
|
|
4692
|
-
|
|
4693
4726
|
//#endregion
|
|
4694
4727
|
//#region src/configs/combined/javaScriptReact.ts
|
|
4695
4728
|
function combinedJavaScriptReact(plugin) {
|
|
@@ -4699,14 +4732,12 @@ function combinedJavaScriptReact(plugin) {
|
|
|
4699
4732
|
...combinedReact
|
|
4700
4733
|
];
|
|
4701
4734
|
}
|
|
4702
|
-
|
|
4703
4735
|
//#endregion
|
|
4704
4736
|
//#region src/configs/general/packageJson.ts
|
|
4705
4737
|
const generalPackageJson = [packageJson.configs.recommended, {
|
|
4706
4738
|
plugins: { "package-json": packageJson },
|
|
4707
4739
|
rules: { "package-json/scripts-name-casing": "error" }
|
|
4708
4740
|
}];
|
|
4709
|
-
|
|
4710
4741
|
//#endregion
|
|
4711
4742
|
//#region src/configs/general/typeScript.ts
|
|
4712
4743
|
const generalTypeScript = [
|
|
@@ -4730,7 +4761,6 @@ const generalTypeScript = [
|
|
|
4730
4761
|
}
|
|
4731
4762
|
}
|
|
4732
4763
|
];
|
|
4733
|
-
|
|
4734
4764
|
//#endregion
|
|
4735
4765
|
//#region src/configs/internal/alexCLine.ts
|
|
4736
4766
|
function internalAlexCLine(plugin) {
|
|
@@ -4749,7 +4779,6 @@ function internalAlexCLine(plugin) {
|
|
|
4749
4779
|
}
|
|
4750
4780
|
];
|
|
4751
4781
|
}
|
|
4752
|
-
|
|
4753
4782
|
//#endregion
|
|
4754
4783
|
//#region src/configs/helpers/requireJsdocOptions.ts
|
|
4755
4784
|
const requireJsdocOptions = {
|
|
@@ -4760,7 +4789,6 @@ const requireJsdocOptions = {
|
|
|
4760
4789
|
MethodDefinition: true
|
|
4761
4790
|
}
|
|
4762
4791
|
};
|
|
4763
|
-
|
|
4764
4792
|
//#endregion
|
|
4765
4793
|
//#region src/configs/internal/jsdoc.ts
|
|
4766
4794
|
const internalJsdoc = [jsdoc.configs["flat/recommended-typescript-error"], { rules: {
|
|
@@ -4787,7 +4815,6 @@ const internalJsdoc = [jsdoc.configs["flat/recommended-typescript-error"], { rul
|
|
|
4787
4815
|
{ startLines: 1 }
|
|
4788
4816
|
]
|
|
4789
4817
|
} }];
|
|
4790
|
-
|
|
4791
4818
|
//#endregion
|
|
4792
4819
|
//#region src/configs/internal/components.ts
|
|
4793
4820
|
const internalComponents = [...internalJsdoc, { rules: {
|
|
@@ -4796,7 +4823,6 @@ const internalComponents = [...internalJsdoc, { rules: {
|
|
|
4796
4823
|
"jsdoc/require-returns": "off",
|
|
4797
4824
|
"jsdoc/require-tags": "off"
|
|
4798
4825
|
} }];
|
|
4799
|
-
|
|
4800
4826
|
//#endregion
|
|
4801
4827
|
//#region src/configs/helpers/restrictedImports/neurosongsBackEndRestrictedImports.ts
|
|
4802
4828
|
const neurosongsBackEndRestrictedImports = combineRestrictedImports(personalRestrictedImports, { paths: [
|
|
@@ -4815,7 +4841,6 @@ const neurosongsBackEndRestrictedImports = combineRestrictedImports(personalRest
|
|
|
4815
4841
|
name: "@neurosongs/prisma-client/prisma"
|
|
4816
4842
|
}
|
|
4817
4843
|
] });
|
|
4818
|
-
|
|
4819
4844
|
//#endregion
|
|
4820
4845
|
//#region src/configs/internal/neurosongsBackEnd.ts
|
|
4821
4846
|
const internalNeurosongsBackEnd = [
|
|
@@ -4840,7 +4865,6 @@ const internalNeurosongsBackEnd = [
|
|
|
4840
4865
|
] }
|
|
4841
4866
|
}
|
|
4842
4867
|
];
|
|
4843
|
-
|
|
4844
4868
|
//#endregion
|
|
4845
4869
|
//#region src/configs/helpers/restrictedImports/neurosongsFrontEndRestrictedImports.ts
|
|
4846
4870
|
const neurosongsFrontEndRestrictedImports = combineRestrictedImports(personalRestrictedImports, reactRestrictedImports, {
|
|
@@ -4860,7 +4884,6 @@ const neurosongsFrontEndRestrictedImports = combineRestrictedImports(personalRes
|
|
|
4860
4884
|
message: "Do not use the Prisma Client directly in the front-end. Query an endpoint from the back-end instead."
|
|
4861
4885
|
}]
|
|
4862
4886
|
});
|
|
4863
|
-
|
|
4864
4887
|
//#endregion
|
|
4865
4888
|
//#region src/configs/internal/neurosongsFrontEnd.ts
|
|
4866
4889
|
const internalNeurosongsFrontEnd = [{
|
|
@@ -4871,7 +4894,6 @@ const internalNeurosongsFrontEnd = [{
|
|
|
4871
4894
|
"no-restricted-imports": ["error", neurosongsFrontEndRestrictedImports]
|
|
4872
4895
|
}
|
|
4873
4896
|
}];
|
|
4874
|
-
|
|
4875
4897
|
//#endregion
|
|
4876
4898
|
//#region src/configs/internal/typeScript.ts
|
|
4877
4899
|
function internalTypeScript(plugin) {
|
|
@@ -4881,7 +4903,8 @@ function internalTypeScript(plugin) {
|
|
|
4881
4903
|
name: "@alextheman/internal/typescript",
|
|
4882
4904
|
plugins: {
|
|
4883
4905
|
"@alextheman": plugin,
|
|
4884
|
-
"@typescript-eslint": tseslint.plugin
|
|
4906
|
+
"@typescript-eslint": tseslint.plugin,
|
|
4907
|
+
"import-x": importPlugin
|
|
4885
4908
|
},
|
|
4886
4909
|
rules: {
|
|
4887
4910
|
"@alextheman/standardise-error-messages": "off",
|
|
@@ -4891,11 +4914,16 @@ function internalTypeScript(plugin) {
|
|
|
4891
4914
|
"@typescript-eslint/dot-notation": "error",
|
|
4892
4915
|
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
4893
4916
|
"@typescript-eslint/no-explicit-any": "off",
|
|
4894
|
-
"@typescript-eslint/no-redeclare": "off"
|
|
4895
|
-
|
|
4917
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
4918
|
+
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"]
|
|
4919
|
+
},
|
|
4920
|
+
settings: { "import-x/resolver": {
|
|
4921
|
+
name: "tsResolver",
|
|
4922
|
+
options: { node: true },
|
|
4923
|
+
resolver: tsResolver
|
|
4924
|
+
} }
|
|
4896
4925
|
}];
|
|
4897
4926
|
}
|
|
4898
|
-
|
|
4899
4927
|
//#endregion
|
|
4900
4928
|
//#region src/configs/helpers/restrictedImports/eslintPluginRestrictedImports.ts
|
|
4901
4929
|
const eslintPluginRestrictedImports = combineRestrictedImports(generalRestrictedImports, { paths: [
|
|
@@ -4921,7 +4949,6 @@ const eslintPluginRestrictedImports = combineRestrictedImports(generalRestricted
|
|
|
4921
4949
|
name: "eslint-vitest-rule-tester"
|
|
4922
4950
|
}
|
|
4923
4951
|
] });
|
|
4924
|
-
|
|
4925
4952
|
//#endregion
|
|
4926
4953
|
//#region src/configs/internal/eslintPlugin/base.ts
|
|
4927
4954
|
function internalEslintPluginBase(plugin) {
|
|
@@ -4938,7 +4965,6 @@ function internalEslintPluginBase(plugin) {
|
|
|
4938
4965
|
}
|
|
4939
4966
|
}];
|
|
4940
4967
|
}
|
|
4941
|
-
|
|
4942
4968
|
//#endregion
|
|
4943
4969
|
//#region src/configs/internal/eslintPlugin/configs.ts
|
|
4944
4970
|
function internalEslintPluginConfigs(plugin) {
|
|
@@ -4949,7 +4975,6 @@ function internalEslintPluginConfigs(plugin) {
|
|
|
4949
4975
|
rules: { "perfectionist/sort-objects": ["error", sortObjects] }
|
|
4950
4976
|
}];
|
|
4951
4977
|
}
|
|
4952
|
-
|
|
4953
4978
|
//#endregion
|
|
4954
4979
|
//#region src/configs/internal/eslintPlugin/rules.ts
|
|
4955
4980
|
function internalEslintPluginRules(plugin) {
|
|
@@ -4960,7 +4985,6 @@ function internalEslintPluginRules(plugin) {
|
|
|
4960
4985
|
rules: { "perfectionist/sort-objects": ["error", sortObjects] }
|
|
4961
4986
|
}];
|
|
4962
4987
|
}
|
|
4963
|
-
|
|
4964
4988
|
//#endregion
|
|
4965
4989
|
//#region src/configs/internal/eslintPlugin/utility.ts
|
|
4966
4990
|
function internalEslintPluginUtility(plugin) {
|
|
@@ -4970,7 +4994,6 @@ function internalEslintPluginUtility(plugin) {
|
|
|
4970
4994
|
rules: { "jsdoc/require-jsdoc": ["error", requireJsdocOptions] }
|
|
4971
4995
|
}];
|
|
4972
4996
|
}
|
|
4973
|
-
|
|
4974
4997
|
//#endregion
|
|
4975
4998
|
//#region src/configs/internal/utility/base.ts
|
|
4976
4999
|
function internalUtilityBase(plugin) {
|
|
@@ -4986,13 +5009,11 @@ function internalUtilityBase(plugin) {
|
|
|
4986
5009
|
}
|
|
4987
5010
|
}];
|
|
4988
5011
|
}
|
|
4989
|
-
|
|
4990
5012
|
//#endregion
|
|
4991
5013
|
//#region src/configs/internal/utility/internal.ts
|
|
4992
5014
|
function internalUtilityRoot$1(plugin) {
|
|
4993
5015
|
return [...internalUtilityBase(plugin), { rules: { "jsdoc/require-jsdoc": "off" } }];
|
|
4994
5016
|
}
|
|
4995
|
-
|
|
4996
5017
|
//#endregion
|
|
4997
5018
|
//#region src/configs/internal/utility/root.ts
|
|
4998
5019
|
function internalUtilityRoot(plugin) {
|
|
@@ -5001,7 +5022,6 @@ function internalUtilityRoot(plugin) {
|
|
|
5001
5022
|
message: "Do not import node builtins from the root of utility. Please either refactor the usage so that the node builtin is not needed, or move this over to the \"@alextheman/utility/node\" entrypoint."
|
|
5002
5023
|
}] })] } }];
|
|
5003
5024
|
}
|
|
5004
|
-
|
|
5005
5025
|
//#endregion
|
|
5006
5026
|
//#region src/configs/combined/typeScript.ts
|
|
5007
5027
|
function combinedTypeScript(plugin) {
|
|
@@ -5013,7 +5033,6 @@ function combinedTypeScript(plugin) {
|
|
|
5013
5033
|
...internalTypeScript(plugin)
|
|
5014
5034
|
];
|
|
5015
5035
|
}
|
|
5016
|
-
|
|
5017
5036
|
//#endregion
|
|
5018
5037
|
//#region src/configs/combined/typeScriptPackage.ts
|
|
5019
5038
|
function combinedTypeScriptPackage(plugin) {
|
|
@@ -5023,7 +5042,6 @@ function combinedTypeScriptPackage(plugin) {
|
|
|
5023
5042
|
...internalJsdoc
|
|
5024
5043
|
];
|
|
5025
5044
|
}
|
|
5026
|
-
|
|
5027
5045
|
//#endregion
|
|
5028
5046
|
//#region src/configs/combined/typeScriptReact.ts
|
|
5029
5047
|
function combinedTypeScriptReact(plugin) {
|
|
@@ -5033,7 +5051,6 @@ function combinedTypeScriptReact(plugin) {
|
|
|
5033
5051
|
...combinedReact
|
|
5034
5052
|
];
|
|
5035
5053
|
}
|
|
5036
|
-
|
|
5037
5054
|
//#endregion
|
|
5038
5055
|
//#region src/configs/internal/packageJson.ts
|
|
5039
5056
|
const internalPackageJson = [...generalPackageJson, {
|
|
@@ -5043,7 +5060,6 @@ const internalPackageJson = [...generalPackageJson, {
|
|
|
5043
5060
|
rangeType: "pin"
|
|
5044
5061
|
}] }
|
|
5045
5062
|
}];
|
|
5046
|
-
|
|
5047
5063
|
//#endregion
|
|
5048
5064
|
//#region src/configs/index.ts
|
|
5049
5065
|
function createAlexPluginConfigs(plugin) {
|
|
@@ -5088,13 +5104,11 @@ function createAlexPluginConfigs(plugin) {
|
|
|
5088
5104
|
}
|
|
5089
5105
|
});
|
|
5090
5106
|
}
|
|
5091
|
-
|
|
5092
5107
|
//#endregion
|
|
5093
5108
|
//#region src/rules/helpers/createRule.ts
|
|
5094
5109
|
const createRule = ESLintUtils.RuleCreator((ruleName) => {
|
|
5095
5110
|
return ruleName;
|
|
5096
5111
|
});
|
|
5097
|
-
|
|
5098
5112
|
//#endregion
|
|
5099
5113
|
//#region src/rules/consistent-test-function.ts
|
|
5100
5114
|
const validTestFunctionsSchema = z.enum(["test", "it"]);
|
|
@@ -5188,7 +5202,6 @@ const consistentTestFunction = createRule({
|
|
|
5188
5202
|
};
|
|
5189
5203
|
}
|
|
5190
5204
|
});
|
|
5191
|
-
|
|
5192
5205
|
//#endregion
|
|
5193
5206
|
//#region src/rules/has-standards.ts
|
|
5194
5207
|
const hasStandardsOptionsSchema = z.object({ fixable: z.boolean() }).partial();
|
|
@@ -5227,7 +5240,6 @@ const hasStandards = createRule({
|
|
|
5227
5240
|
} };
|
|
5228
5241
|
}
|
|
5229
5242
|
});
|
|
5230
|
-
|
|
5231
5243
|
//#endregion
|
|
5232
5244
|
//#region src/rules/no-isolated-tests.ts
|
|
5233
5245
|
const noIsolatedTests = createRule({
|
|
@@ -5249,7 +5261,6 @@ const noIsolatedTests = createRule({
|
|
|
5249
5261
|
} };
|
|
5250
5262
|
}
|
|
5251
5263
|
});
|
|
5252
|
-
|
|
5253
5264
|
//#endregion
|
|
5254
5265
|
//#region src/rules/no-namespace-imports.ts
|
|
5255
5266
|
const noNamespaceImportsOptionsSchema = z.object({ allow: z.array(z.string()) }).partial();
|
|
@@ -5280,7 +5291,6 @@ const noNamespaceImports = createRule({
|
|
|
5280
5291
|
} };
|
|
5281
5292
|
}
|
|
5282
5293
|
});
|
|
5283
|
-
|
|
5284
5294
|
//#endregion
|
|
5285
5295
|
//#region src/rules/no-plugin-configs-access-from-src-configs.ts
|
|
5286
5296
|
const noPluginConfigAccessFromSrcConfigs = createRule({
|
|
@@ -5304,7 +5314,6 @@ const noPluginConfigAccessFromSrcConfigs = createRule({
|
|
|
5304
5314
|
} };
|
|
5305
5315
|
}
|
|
5306
5316
|
});
|
|
5307
|
-
|
|
5308
5317
|
//#endregion
|
|
5309
5318
|
//#region src/rules/no-relative-imports.ts
|
|
5310
5319
|
const noRelativeImportsOptionsSchema = z.object({ depth: z.int().nonnegative() }).partial();
|
|
@@ -5371,7 +5380,6 @@ const noRelativeImports = createRule({
|
|
|
5371
5380
|
} };
|
|
5372
5381
|
}
|
|
5373
5382
|
});
|
|
5374
|
-
|
|
5375
5383
|
//#endregion
|
|
5376
5384
|
//#region src/rules/no-skipped-tests.ts
|
|
5377
5385
|
const noSkippedTests = createRule({
|
|
@@ -5393,7 +5401,6 @@ const noSkippedTests = createRule({
|
|
|
5393
5401
|
} };
|
|
5394
5402
|
}
|
|
5395
5403
|
});
|
|
5396
|
-
|
|
5397
5404
|
//#endregion
|
|
5398
5405
|
//#region src/rules/standardise-error-messages.ts
|
|
5399
5406
|
const standardiseErrorMessagesOptionsSchema = z.object({ regex: z.string() }).partial();
|
|
@@ -5437,7 +5444,6 @@ const standardiseErrorMessages = createRule({
|
|
|
5437
5444
|
};
|
|
5438
5445
|
}
|
|
5439
5446
|
});
|
|
5440
|
-
|
|
5441
5447
|
//#endregion
|
|
5442
5448
|
//#region src/rules/use-normalized-imports.ts
|
|
5443
5449
|
const useNormalizedImportsOptionsSchema = z.object({ fixable: z.boolean() }).partial();
|
|
@@ -5473,100 +5479,61 @@ const useNormalizedImports = createRule({
|
|
|
5473
5479
|
} };
|
|
5474
5480
|
}
|
|
5475
5481
|
});
|
|
5476
|
-
|
|
5477
5482
|
//#endregion
|
|
5478
5483
|
//#region src/rules/use-object-shorthand.ts
|
|
5479
5484
|
const useObjectShorthandOptionsSchema = z.object({ fixable: z.boolean() }).partial();
|
|
5480
5485
|
function parseUseObjectShorthandOptions(data) {
|
|
5481
5486
|
return useObjectShorthandOptionsSchema.parse(data);
|
|
5482
5487
|
}
|
|
5483
|
-
const useObjectShorthand = createRule({
|
|
5484
|
-
name: "use-object-shorthand",
|
|
5485
|
-
meta: {
|
|
5486
|
-
docs: { description: "Encourage the use of object shorthand (e.g. const property = \"Hello\"; const object = { property });" },
|
|
5487
|
-
messages: { useShorthand: "{ {{source}} } is not allowed. Please use the object shorthand." },
|
|
5488
|
-
type: "suggestion",
|
|
5489
|
-
fixable: "code",
|
|
5490
|
-
schema: createRuleSchemaFromZodSchema(useObjectShorthandOptionsSchema)
|
|
5491
|
-
},
|
|
5492
|
-
defaultOptions: [{ fixable: true }],
|
|
5493
|
-
create(context) {
|
|
5494
|
-
const { fixable = true } = parseUseObjectShorthandOptions(context.options[0] ?? { fixable: true });
|
|
5495
|
-
return { Property(node) {
|
|
5496
|
-
if (node.key.type === AST_NODE_TYPES.Identifier && node.value.type === AST_NODE_TYPES.Identifier && node.key.name === node.value.name && !node.shorthand) context.report({
|
|
5497
|
-
node,
|
|
5498
|
-
messageId: "useShorthand",
|
|
5499
|
-
data: { source: context.sourceCode.getText(node) },
|
|
5500
|
-
fix: fixOnCondition(fixable, (fixer) => {
|
|
5501
|
-
const key = node.key;
|
|
5502
|
-
return fixer.replaceTextRange([node.range[0], node.range[1]], key.name);
|
|
5503
|
-
})
|
|
5504
|
-
});
|
|
5505
|
-
} };
|
|
5506
|
-
}
|
|
5507
|
-
});
|
|
5508
|
-
|
|
5509
|
-
//#endregion
|
|
5510
|
-
//#region src/rules/index.ts
|
|
5511
|
-
var rules_default = {
|
|
5512
|
-
"consistent-test-function": consistentTestFunction,
|
|
5513
|
-
"has-standards": hasStandards,
|
|
5514
|
-
"no-isolated-tests": noIsolatedTests,
|
|
5515
|
-
"no-namespace-imports": noNamespaceImports,
|
|
5516
|
-
"no-plugin-configs-access-from-src-configs": noPluginConfigAccessFromSrcConfigs,
|
|
5517
|
-
"no-relative-imports": noRelativeImports,
|
|
5518
|
-
"no-skipped-tests": noSkippedTests,
|
|
5519
|
-
"standardise-error-messages": standardiseErrorMessages,
|
|
5520
|
-
"use-normalized-imports": useNormalizedImports,
|
|
5521
|
-
"use-object-shorthand": useObjectShorthand
|
|
5522
|
-
};
|
|
5523
|
-
|
|
5524
|
-
//#endregion
|
|
5525
|
-
//#region package.json
|
|
5526
|
-
var name = "@alextheman/eslint-plugin";
|
|
5527
|
-
var version = "5.12.0";
|
|
5528
|
-
|
|
5529
5488
|
//#endregion
|
|
5530
5489
|
//#region src/alexPlugin.ts
|
|
5531
5490
|
const alexPlugin = {
|
|
5532
5491
|
meta: {
|
|
5533
|
-
name,
|
|
5534
|
-
version,
|
|
5492
|
+
name: "@alextheman/eslint-plugin",
|
|
5493
|
+
version: "5.13.1",
|
|
5535
5494
|
namespace: "alextheman"
|
|
5536
5495
|
},
|
|
5537
5496
|
configs: {},
|
|
5538
|
-
rules:
|
|
5497
|
+
rules: {
|
|
5498
|
+
"consistent-test-function": consistentTestFunction,
|
|
5499
|
+
"has-standards": hasStandards,
|
|
5500
|
+
"no-isolated-tests": noIsolatedTests,
|
|
5501
|
+
"no-namespace-imports": noNamespaceImports,
|
|
5502
|
+
"no-plugin-configs-access-from-src-configs": noPluginConfigAccessFromSrcConfigs,
|
|
5503
|
+
"no-relative-imports": noRelativeImports,
|
|
5504
|
+
"no-skipped-tests": noSkippedTests,
|
|
5505
|
+
"standardise-error-messages": standardiseErrorMessages,
|
|
5506
|
+
"use-normalized-imports": useNormalizedImports,
|
|
5507
|
+
"use-object-shorthand": createRule({
|
|
5508
|
+
name: "use-object-shorthand",
|
|
5509
|
+
meta: {
|
|
5510
|
+
docs: { description: "Encourage the use of object shorthand (e.g. const property = \"Hello\"; const object = { property });" },
|
|
5511
|
+
messages: { useShorthand: "{ {{source}} } is not allowed. Please use the object shorthand." },
|
|
5512
|
+
type: "suggestion",
|
|
5513
|
+
fixable: "code",
|
|
5514
|
+
schema: createRuleSchemaFromZodSchema(useObjectShorthandOptionsSchema)
|
|
5515
|
+
},
|
|
5516
|
+
defaultOptions: [{ fixable: true }],
|
|
5517
|
+
create(context) {
|
|
5518
|
+
const { fixable = true } = parseUseObjectShorthandOptions(context.options[0] ?? { fixable: true });
|
|
5519
|
+
return { Property(node) {
|
|
5520
|
+
if (node.key.type === AST_NODE_TYPES.Identifier && node.value.type === AST_NODE_TYPES.Identifier && node.key.name === node.value.name && !node.shorthand) context.report({
|
|
5521
|
+
node,
|
|
5522
|
+
messageId: "useShorthand",
|
|
5523
|
+
data: { source: context.sourceCode.getText(node) },
|
|
5524
|
+
fix: fixOnCondition(fixable, (fixer) => {
|
|
5525
|
+
const key = node.key;
|
|
5526
|
+
return fixer.replaceTextRange([node.range[0], node.range[1]], key.name);
|
|
5527
|
+
})
|
|
5528
|
+
});
|
|
5529
|
+
} };
|
|
5530
|
+
}
|
|
5531
|
+
})
|
|
5532
|
+
}
|
|
5539
5533
|
};
|
|
5540
5534
|
alexPlugin.configs = createAlexPluginConfigs(deepFreeze(deepCopy(alexPlugin)));
|
|
5541
|
-
|
|
5542
|
-
//#endregion
|
|
5543
|
-
//#region src/configs/external/typeDocConfig.ts
|
|
5544
|
-
function typeDocConfig(entryPoints = ["./src/index.ts"]) {
|
|
5545
|
-
return {
|
|
5546
|
-
disableSources: true,
|
|
5547
|
-
entryPoints,
|
|
5548
|
-
excludeNotDocumented: true,
|
|
5549
|
-
includeVersion: true,
|
|
5550
|
-
outputs: [{
|
|
5551
|
-
name: "html",
|
|
5552
|
-
options: { navigation: {
|
|
5553
|
-
excludeReferences: false,
|
|
5554
|
-
includeCategories: true,
|
|
5555
|
-
includeFolders: true,
|
|
5556
|
-
includeGroups: true
|
|
5557
|
-
} },
|
|
5558
|
-
path: "docs/features/html"
|
|
5559
|
-
}, {
|
|
5560
|
-
name: "markdown",
|
|
5561
|
-
path: "docs/features/markdown"
|
|
5562
|
-
}],
|
|
5563
|
-
plugin: ["typedoc-plugin-markdown", "typedoc-rhineai-theme"]
|
|
5564
|
-
};
|
|
5565
|
-
}
|
|
5566
|
-
|
|
5567
5535
|
//#endregion
|
|
5568
5536
|
//#region src/index.ts
|
|
5569
5537
|
var src_default = alexPlugin;
|
|
5570
|
-
|
|
5571
5538
|
//#endregion
|
|
5572
|
-
export { checkCallExpression, combineRestrictedImports, createRuleSchemaFromZodSchema, src_default as default, fixOnCondition, flattenConfigs, getImportSpecifiersAfterRemoving, prettierConfig
|
|
5539
|
+
export { checkCallExpression, combineRestrictedImports, createRuleSchemaFromZodSchema, src_default as default, fixOnCondition, flattenConfigs, getImportSpecifiersAfterRemoving, prettierConfig };
|