@fedify/lint 2.2.0-dev.613 → 2.2.0-dev.622
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/deno.json +1 -1
- package/dist/index.cjs +101 -189
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +75 -166
- package/package.json +4 -4
package/deno.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
3
6
|
var __create = Object.create;
|
|
4
7
|
var __defProp = Object.defineProperty;
|
|
5
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -7,8 +10,8 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
12
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys
|
|
11
|
-
key = keys
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
12
15
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
16
|
get: ((k) => from[k]).bind(null, key),
|
|
14
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -20,32 +23,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
23
|
value: mod,
|
|
21
24
|
enumerable: true
|
|
22
25
|
}) : target, mod));
|
|
23
|
-
|
|
24
26
|
//#endregion
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
let _fxts_core = require("@fxts/core");
|
|
28
|
+
let _typescript_eslint_parser = require("@typescript-eslint/parser");
|
|
29
|
+
_typescript_eslint_parser = __toESM(_typescript_eslint_parser);
|
|
28
30
|
//#region deno.json
|
|
29
31
|
var name = "@fedify/lint";
|
|
30
|
-
var version = "2.2.0-dev.
|
|
31
|
-
var license = "MIT";
|
|
32
|
-
var exports$1 = { ".": "./src/mod.ts" };
|
|
33
|
-
var imports = {
|
|
34
|
-
"eslint": "npm:eslint@^9.0.0",
|
|
35
|
-
"estree": "npm:@types/estree@^1.0.8"
|
|
36
|
-
};
|
|
37
|
-
var publish = { "exclude": ["**/*.test.ts", "tsdown.config.ts"] };
|
|
38
|
-
var tasks = { "test": "deno test --allow-env" };
|
|
39
|
-
var deno_default = {
|
|
40
|
-
name,
|
|
41
|
-
version,
|
|
42
|
-
license,
|
|
43
|
-
exports: exports$1,
|
|
44
|
-
imports,
|
|
45
|
-
publish,
|
|
46
|
-
tasks
|
|
47
|
-
};
|
|
48
|
-
|
|
32
|
+
var version = "2.2.0-dev.622+e54cb037";
|
|
49
33
|
//#endregion
|
|
50
34
|
//#region src/lib/const.ts
|
|
51
35
|
/**
|
|
@@ -164,7 +148,6 @@ const RULE_IDS = {
|
|
|
164
148
|
actorSharedInboxPropertyMismatch: "actor-shared-inbox-property-mismatch",
|
|
165
149
|
collectionFilteringNotImplemented: "collection-filtering-not-implemented"
|
|
166
150
|
};
|
|
167
|
-
|
|
168
151
|
//#endregion
|
|
169
152
|
//#region src/lib/messages.ts
|
|
170
153
|
/**
|
|
@@ -196,14 +179,12 @@ const getExpectedCall = ({ ctxName, methodName, requiresIdentifier, idName }) =>
|
|
|
196
179
|
* Error message for collection filtering not implemented.
|
|
197
180
|
*/
|
|
198
181
|
const COLLECTION_FILTERING_NOT_IMPLEMENTED_ERROR = "Collection dispatcher should implement filtering to avoid large response payloads. Add a fourth parameter (filter) to handle filtering. See: https://fedify.dev/manual/collections#filtering-by-server";
|
|
199
|
-
|
|
200
182
|
//#endregion
|
|
201
183
|
//#region src/lib/utils.ts
|
|
202
184
|
const eq = (value) => (other) => value === other;
|
|
203
185
|
function cases(pred, ifTrue, ifFalse) {
|
|
204
186
|
return (value) => pred(value) ? ifTrue(value) : ifFalse(value);
|
|
205
187
|
}
|
|
206
|
-
|
|
207
188
|
//#endregion
|
|
208
189
|
//#region src/lib/pred.ts
|
|
209
190
|
function allOf(...predicates) {
|
|
@@ -213,11 +194,11 @@ const anyOf = (...predicates) => (value) => predicates.some((predicate) => predi
|
|
|
213
194
|
/**
|
|
214
195
|
* Checks if a node is of a specific type.
|
|
215
196
|
*/
|
|
216
|
-
const isNodeType = (type) => (node) => (0,
|
|
197
|
+
const isNodeType = (type) => (node) => (0, _fxts_core.pipe)(node, (0, _fxts_core.prop)("type"), eq(type));
|
|
217
198
|
/**
|
|
218
199
|
* Checks if a node is of a specific name.
|
|
219
200
|
*/
|
|
220
|
-
const isNodeName = (name
|
|
201
|
+
const isNodeName = (name) => (node) => (0, _fxts_core.pipe)(node, (0, _fxts_core.prop)("name"), eq(name));
|
|
221
202
|
/**
|
|
222
203
|
* Checks if a node's callee is a MemberExpression.
|
|
223
204
|
*/
|
|
@@ -247,13 +228,12 @@ const isSetActorDispatcherCall = (node) => allOf(hasMemberExpressionCallee, hasI
|
|
|
247
228
|
* Checks if a function has at least n parameters.
|
|
248
229
|
*/
|
|
249
230
|
const hasMinParams = (min) => (fn) => fn.params.length >= min;
|
|
250
|
-
|
|
251
231
|
//#endregion
|
|
252
232
|
//#region src/lib/property-checker.ts
|
|
253
233
|
/**
|
|
254
234
|
* Checks if a node has a key with a specific name.
|
|
255
235
|
*/
|
|
256
|
-
const hasKeyName = (propertyName) => (node) => (0,
|
|
236
|
+
const hasKeyName = (propertyName) => (node) => (0, _fxts_core.pipe)(node, (0, _fxts_core.prop)("key"), allOf(isNodeType("Identifier"), (0, _fxts_core.pipeLazy)((0, _fxts_core.prop)("name"), eq(propertyName))));
|
|
257
237
|
/**
|
|
258
238
|
* Checks if a node is a Property with an Identifier key of a specific name.
|
|
259
239
|
*/
|
|
@@ -267,7 +247,7 @@ const isPropertyWithName = (propertyName) => (node) => allOf(isNodeType("Propert
|
|
|
267
247
|
function createPropertyChecker(checker) {
|
|
268
248
|
const inner = ([first, ...rest]) => (node) => {
|
|
269
249
|
if (!isPropertyWithName(first)(node)) return false;
|
|
270
|
-
if ((0,
|
|
250
|
+
if ((0, _fxts_core.isEmpty)(rest)) return checker(node.value);
|
|
271
251
|
if (isNodeType("NewExpression")(node.value)) {
|
|
272
252
|
if (node.value.arguments.length === 0) return false;
|
|
273
253
|
const firstArg = node.value.arguments[0];
|
|
@@ -291,21 +271,21 @@ const checkObjectExpression = (propertyChecker) => (obj) => obj.properties.some(
|
|
|
291
271
|
* @returns A function that checks the ConditionalExpression
|
|
292
272
|
*/
|
|
293
273
|
const checkConditionalExpression = (propertyChecker) => (node) => [node.consequent, node.alternate].every(checkBranchWith(propertyChecker));
|
|
294
|
-
const checkBranchWith = (propertyChecker) => (branch) => (0,
|
|
274
|
+
const checkBranchWith = (propertyChecker) => (branch) => (0, _fxts_core.pipe)(branch, cases(isNodeType("ConditionalExpression"), checkConditionalExpression(propertyChecker), (0, _fxts_core.pipeLazy)(extractObjectExpression, cases(_fxts_core.isObject, checkObjectExpression(propertyChecker), (0, _fxts_core.always)(false)))));
|
|
295
275
|
/**
|
|
296
276
|
* Extracts the first argument if it's an ObjectExpression.
|
|
297
277
|
*/
|
|
298
|
-
const extractFirstObjectExpression = (node) => (0,
|
|
278
|
+
const extractFirstObjectExpression = (node) => (0, _fxts_core.pipe)(node, (0, _fxts_core.prop)("arguments"), _fxts_core.head, (0, _fxts_core.unless)(isNodeType("ObjectExpression"), (0, _fxts_core.always)(null)));
|
|
299
279
|
/**
|
|
300
280
|
* Extracts ObjectExpression from NewExpression.
|
|
301
281
|
*/
|
|
302
|
-
const extractObjectExpression = cases(isNodeType("NewExpression"), extractFirstObjectExpression, (0,
|
|
282
|
+
const extractObjectExpression = cases(isNodeType("NewExpression"), extractFirstObjectExpression, (0, _fxts_core.always)(null));
|
|
303
283
|
/**
|
|
304
284
|
* Checks if a ReturnStatement node contains a property.
|
|
305
285
|
* @param propertyChecker The predicate function to check properties
|
|
306
286
|
* @returns A function that checks the ReturnStatement
|
|
307
287
|
*/
|
|
308
|
-
const checkReturnStatement = (propertyChecker) => (node) => (0,
|
|
288
|
+
const checkReturnStatement = (propertyChecker) => (node) => (0, _fxts_core.pipe)(node, (0, _fxts_core.prop)("argument"), cases(_fxts_core.isObject, checkBranchWith(propertyChecker), (0, _fxts_core.always)(false)));
|
|
309
289
|
/**
|
|
310
290
|
* Creates a function that recursively checks for a property in an AST node.
|
|
311
291
|
* @param propertyChecker The predicate function to check properties
|
|
@@ -316,17 +296,17 @@ const createPropertySearcher = (propertyChecker) => {
|
|
|
316
296
|
switch (node.type) {
|
|
317
297
|
case "ReturnStatement": return checkReturnStatement(propertyChecker)(node);
|
|
318
298
|
case "BlockStatement": return checkAllReturnPaths(propertyChecker)(node);
|
|
319
|
-
case "NewExpression": return (0,
|
|
299
|
+
case "NewExpression": return (0, _fxts_core.pipe)(node, extractFirstObjectExpression, (0, _fxts_core.when)(_fxts_core.isObject, checkObjectExpression(propertyChecker)), Boolean);
|
|
320
300
|
default: return false;
|
|
321
301
|
}
|
|
322
302
|
};
|
|
323
303
|
};
|
|
324
|
-
const checkAllReturnPaths = (propertyChecker) => (node) => (0,
|
|
304
|
+
const checkAllReturnPaths = (propertyChecker) => (node) => (0, _fxts_core.pipe)(node, collectReturnPaths, cases(_fxts_core.isEmpty, (0, _fxts_core.always)(false), (0, _fxts_core.every)(checkReturnStatement(propertyChecker))));
|
|
325
305
|
/**
|
|
326
306
|
* Collects all return statements from a node, traversing control flow.
|
|
327
307
|
* This handles if/else branches, loops, etc.
|
|
328
308
|
*/
|
|
329
|
-
const collectReturnPaths = (node) => (0,
|
|
309
|
+
const collectReturnPaths = (node) => (0, _fxts_core.pipe)(node, flatten, _fxts_core.toArray);
|
|
330
310
|
function* flatten(node) {
|
|
331
311
|
switch (node.type) {
|
|
332
312
|
case "ReturnStatement":
|
|
@@ -363,7 +343,6 @@ function* flatten(node) {
|
|
|
363
343
|
default: return;
|
|
364
344
|
}
|
|
365
345
|
}
|
|
366
|
-
|
|
367
346
|
//#endregion
|
|
368
347
|
//#region src/lib/tracker.ts
|
|
369
348
|
/**
|
|
@@ -390,14 +369,13 @@ function trackFederationVariables() {
|
|
|
390
369
|
if (isCreateFederation(init) && id.type === "Identifier") federationVariables.add(id.name);
|
|
391
370
|
}
|
|
392
371
|
},
|
|
393
|
-
isFederationVariable(name
|
|
394
|
-
return federationVariables.has(name
|
|
372
|
+
isFederationVariable(name) {
|
|
373
|
+
return federationVariables.has(name);
|
|
395
374
|
},
|
|
396
375
|
isFederationObject
|
|
397
376
|
};
|
|
398
377
|
}
|
|
399
378
|
const isCreateFederation = (node) => node.callee.type === "Identifier" && /^create(Federation|FederationBuilder)$/i.test(node.callee.name);
|
|
400
|
-
|
|
401
379
|
//#endregion
|
|
402
380
|
//#region src/lib/required.ts
|
|
403
381
|
/**
|
|
@@ -421,8 +399,7 @@ function createRequiredRule(config, description) {
|
|
|
421
399
|
const federationTracker = trackFederationVariables();
|
|
422
400
|
const dispatcherTracker = createDispatcherTracker(config.setter, federationTracker);
|
|
423
401
|
const actorDispatchers = [];
|
|
424
|
-
const
|
|
425
|
-
const propertySearcher = createPropertySearcher(propertyChecker);
|
|
402
|
+
const propertySearcher = createPropertySearcher(createPropertyChecker(Boolean)(config.path));
|
|
426
403
|
return {
|
|
427
404
|
VariableDeclarator: federationTracker.VariableDeclarator,
|
|
428
405
|
CallExpression(node) {
|
|
@@ -465,22 +442,18 @@ function createRequiredRuleEslint(config) {
|
|
|
465
442
|
})
|
|
466
443
|
};
|
|
467
444
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
//#region src/rules/actor-assertion-method-required.ts
|
|
471
|
-
const deno$19 = createRequiredRuleDeno(properties.assertionMethod);
|
|
472
|
-
const eslint = createRequiredRuleEslint(properties.assertionMethod);
|
|
473
|
-
|
|
445
|
+
createRequiredRuleDeno(properties.assertionMethod);
|
|
446
|
+
const eslint$20 = createRequiredRuleEslint(properties.assertionMethod);
|
|
474
447
|
//#endregion
|
|
475
448
|
//#region src/lib/mismatch.ts
|
|
476
|
-
const isIdentifierWithName = (name
|
|
449
|
+
const isIdentifierWithName = (name) => (node) => allOf(isNodeType("Identifier"), isNodeName(name))(node);
|
|
477
450
|
/**
|
|
478
451
|
* Checks if a node is a CallExpression calling the expected context method.
|
|
479
452
|
*/
|
|
480
453
|
const isExpectedMethodCall = ({ ctxName, idName, methodName, requiresIdentifier }) => (node) => {
|
|
481
454
|
if (!isNodeType("CallExpression")(node) || !hasMemberExpressionCallee(node) || !isIdentifierWithName(ctxName)(node.callee.object) || !isIdentifierWithName(methodName)(node.callee.property)) return false;
|
|
482
|
-
if (!requiresIdentifier) return (0,
|
|
483
|
-
return allOf((0,
|
|
455
|
+
if (!requiresIdentifier) return (0, _fxts_core.isEmpty)(node.arguments);
|
|
456
|
+
return allOf((0, _fxts_core.negate)(_fxts_core.isEmpty), (0, _fxts_core.some)(isIdentifierWithName(idName)))(node.arguments);
|
|
484
457
|
};
|
|
485
458
|
/**
|
|
486
459
|
* Extracts parameter names from a function.
|
|
@@ -509,12 +482,8 @@ function createMismatchRule(config, describe) {
|
|
|
509
482
|
methodName: config.getter,
|
|
510
483
|
requiresIdentifier: config.requiresIdentifier
|
|
511
484
|
};
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
if (!hasProperty) return;
|
|
515
|
-
const propertyChecker = createPropertyChecker(isExpectedMethodCall(methodCallContext))(config.path);
|
|
516
|
-
const propertySearcher = createPropertySearcher(propertyChecker);
|
|
517
|
-
if (!propertySearcher(dispatcherArg.body)) context.report({
|
|
485
|
+
if (!createPropertySearcher(createPropertyChecker(Boolean)(config.path))(dispatcherArg.body)) return;
|
|
486
|
+
if (!createPropertySearcher(createPropertyChecker(isExpectedMethodCall(methodCallContext))(config.path))(dispatcherArg.body)) context.report({
|
|
518
487
|
node: dispatcherArg,
|
|
519
488
|
...describe(methodCallContext)
|
|
520
489
|
});
|
|
@@ -543,102 +512,44 @@ const createMismatchRuleEslint = (config) => ({
|
|
|
543
512
|
data: { message: actorPropertyMismatch(context) }
|
|
544
513
|
}))
|
|
545
514
|
});
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
const eslint$
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
const eslint$4 = createRequiredRuleEslint(properties.featuredTags);
|
|
566
|
-
|
|
567
|
-
//#endregion
|
|
568
|
-
//#region src/rules/actor-followers-property-mismatch.ts
|
|
569
|
-
const deno$14 = createMismatchRuleDeno(properties.followers);
|
|
570
|
-
const eslint$5 = createMismatchRuleEslint(properties.followers);
|
|
571
|
-
|
|
572
|
-
//#endregion
|
|
573
|
-
//#region src/rules/actor-followers-property-required.ts
|
|
574
|
-
const deno$13 = createRequiredRuleDeno(properties.followers);
|
|
575
|
-
const eslint$6 = createRequiredRuleEslint(properties.followers);
|
|
576
|
-
|
|
577
|
-
//#endregion
|
|
578
|
-
//#region src/rules/actor-following-property-mismatch.ts
|
|
579
|
-
const deno$12 = createMismatchRuleDeno(properties.following);
|
|
580
|
-
const eslint$7 = createMismatchRuleEslint(properties.following);
|
|
581
|
-
|
|
582
|
-
//#endregion
|
|
583
|
-
//#region src/rules/actor-following-property-required.ts
|
|
584
|
-
const deno$11 = createRequiredRuleDeno(properties.following);
|
|
585
|
-
const eslint$8 = createRequiredRuleEslint(properties.following);
|
|
586
|
-
|
|
587
|
-
//#endregion
|
|
588
|
-
//#region src/rules/actor-id-mismatch.ts
|
|
589
|
-
const deno$10 = createMismatchRuleDeno(properties.id);
|
|
590
|
-
const eslint$9 = createMismatchRuleEslint(properties.id);
|
|
591
|
-
|
|
592
|
-
//#endregion
|
|
593
|
-
//#region src/rules/actor-id-required.ts
|
|
594
|
-
const deno$9 = createRequiredRuleDeno(properties.id);
|
|
515
|
+
createMismatchRuleDeno(properties.featured);
|
|
516
|
+
const eslint$19 = createMismatchRuleEslint(properties.featured);
|
|
517
|
+
createRequiredRuleDeno(properties.featured);
|
|
518
|
+
const eslint$18 = createRequiredRuleEslint(properties.featured);
|
|
519
|
+
createMismatchRuleDeno(properties.featuredTags);
|
|
520
|
+
const eslint$17 = createMismatchRuleEslint(properties.featuredTags);
|
|
521
|
+
createRequiredRuleDeno(properties.featuredTags);
|
|
522
|
+
const eslint$16 = createRequiredRuleEslint(properties.featuredTags);
|
|
523
|
+
createMismatchRuleDeno(properties.followers);
|
|
524
|
+
const eslint$15 = createMismatchRuleEslint(properties.followers);
|
|
525
|
+
createRequiredRuleDeno(properties.followers);
|
|
526
|
+
const eslint$14 = createRequiredRuleEslint(properties.followers);
|
|
527
|
+
createMismatchRuleDeno(properties.following);
|
|
528
|
+
const eslint$13 = createMismatchRuleEslint(properties.following);
|
|
529
|
+
createRequiredRuleDeno(properties.following);
|
|
530
|
+
const eslint$12 = createRequiredRuleEslint(properties.following);
|
|
531
|
+
createMismatchRuleDeno(properties.id);
|
|
532
|
+
const eslint$11 = createMismatchRuleEslint(properties.id);
|
|
533
|
+
createRequiredRuleDeno(properties.id);
|
|
595
534
|
const eslint$10 = createRequiredRuleEslint(properties.id);
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
const eslint$
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
const deno$5 = createRequiredRuleDeno(properties.liked);
|
|
615
|
-
const eslint$14 = createRequiredRuleEslint(properties.liked);
|
|
616
|
-
|
|
617
|
-
//#endregion
|
|
618
|
-
//#region src/rules/actor-outbox-property-mismatch.ts
|
|
619
|
-
const deno$4 = createMismatchRuleDeno(properties.outbox);
|
|
620
|
-
const eslint$15 = createMismatchRuleEslint(properties.outbox);
|
|
621
|
-
|
|
622
|
-
//#endregion
|
|
623
|
-
//#region src/rules/actor-outbox-property-required.ts
|
|
624
|
-
const deno$3 = createRequiredRuleDeno(properties.outbox);
|
|
625
|
-
const eslint$16 = createRequiredRuleEslint(properties.outbox);
|
|
626
|
-
|
|
627
|
-
//#endregion
|
|
628
|
-
//#region src/rules/actor-public-key-required.ts
|
|
629
|
-
const deno$2 = createRequiredRuleDeno(properties.publicKey);
|
|
630
|
-
const eslint$17 = createRequiredRuleEslint(properties.publicKey);
|
|
631
|
-
|
|
632
|
-
//#endregion
|
|
633
|
-
//#region src/rules/actor-shared-inbox-property-mismatch.ts
|
|
634
|
-
const deno$1 = createMismatchRuleDeno(properties.sharedInbox);
|
|
635
|
-
const eslint$18 = createMismatchRuleEslint(properties.sharedInbox);
|
|
636
|
-
|
|
637
|
-
//#endregion
|
|
638
|
-
//#region src/rules/actor-shared-inbox-property-required.ts
|
|
639
|
-
const deno = createRequiredRuleDeno(properties.sharedInbox);
|
|
640
|
-
const eslint$19 = createRequiredRuleEslint(properties.sharedInbox);
|
|
641
|
-
|
|
535
|
+
createMismatchRuleDeno(properties.inbox);
|
|
536
|
+
const eslint$9 = createMismatchRuleEslint(properties.inbox);
|
|
537
|
+
createRequiredRuleDeno(properties.inbox);
|
|
538
|
+
const eslint$8 = createRequiredRuleEslint(properties.inbox);
|
|
539
|
+
createMismatchRuleDeno(properties.liked);
|
|
540
|
+
const eslint$7 = createMismatchRuleEslint(properties.liked);
|
|
541
|
+
createRequiredRuleDeno(properties.liked);
|
|
542
|
+
const eslint$6 = createRequiredRuleEslint(properties.liked);
|
|
543
|
+
createMismatchRuleDeno(properties.outbox);
|
|
544
|
+
const eslint$5 = createMismatchRuleEslint(properties.outbox);
|
|
545
|
+
createRequiredRuleDeno(properties.outbox);
|
|
546
|
+
const eslint$4 = createRequiredRuleEslint(properties.outbox);
|
|
547
|
+
createRequiredRuleDeno(properties.publicKey);
|
|
548
|
+
const eslint$3 = createRequiredRuleEslint(properties.publicKey);
|
|
549
|
+
createMismatchRuleDeno(properties.sharedInbox);
|
|
550
|
+
const eslint$2 = createMismatchRuleEslint(properties.sharedInbox);
|
|
551
|
+
createRequiredRuleDeno(properties.sharedInbox);
|
|
552
|
+
const eslint$1 = createRequiredRuleEslint(properties.sharedInbox);
|
|
642
553
|
//#endregion
|
|
643
554
|
//#region src/rules/collection-filtering-not-implemented.ts
|
|
644
555
|
/**
|
|
@@ -657,7 +568,7 @@ const isFollowersDispatcherCall = (node) => "callee" in node && node.callee && n
|
|
|
657
568
|
* CollectionDispatcher signature: (context, identifier, cursor, filter?) => ...
|
|
658
569
|
*/
|
|
659
570
|
const hasFilterParameter = hasMinParams(4);
|
|
660
|
-
const eslint
|
|
571
|
+
const eslint = {
|
|
661
572
|
meta: {
|
|
662
573
|
type: "suggestion",
|
|
663
574
|
docs: { description: "Ensure followers dispatcher implements filtering" },
|
|
@@ -681,43 +592,46 @@ const eslint$20 = {
|
|
|
681
592
|
};
|
|
682
593
|
}
|
|
683
594
|
};
|
|
684
|
-
|
|
685
595
|
//#endregion
|
|
686
596
|
//#region src/index.ts
|
|
597
|
+
/**
|
|
598
|
+
* ESLint plugin for Fedify.
|
|
599
|
+
* Provides lint rules for validating Fedify federation code.
|
|
600
|
+
*/
|
|
687
601
|
const rules = {
|
|
688
|
-
[RULE_IDS.actorIdMismatch]: eslint$
|
|
602
|
+
[RULE_IDS.actorIdMismatch]: eslint$11,
|
|
689
603
|
[RULE_IDS.actorIdRequired]: eslint$10,
|
|
690
|
-
[RULE_IDS.actorFollowingPropertyRequired]: eslint$
|
|
691
|
-
[RULE_IDS.actorFollowingPropertyMismatch]: eslint$
|
|
692
|
-
[RULE_IDS.actorFollowersPropertyRequired]: eslint$
|
|
693
|
-
[RULE_IDS.actorFollowersPropertyMismatch]: eslint$
|
|
694
|
-
[RULE_IDS.actorOutboxPropertyRequired]: eslint$
|
|
695
|
-
[RULE_IDS.actorOutboxPropertyMismatch]: eslint$
|
|
696
|
-
[RULE_IDS.actorLikedPropertyRequired]: eslint$
|
|
697
|
-
[RULE_IDS.actorLikedPropertyMismatch]: eslint$
|
|
698
|
-
[RULE_IDS.actorFeaturedPropertyRequired]: eslint$
|
|
699
|
-
[RULE_IDS.actorFeaturedPropertyMismatch]: eslint$
|
|
700
|
-
[RULE_IDS.actorFeaturedTagsPropertyRequired]: eslint$
|
|
701
|
-
[RULE_IDS.actorFeaturedTagsPropertyMismatch]: eslint$
|
|
702
|
-
[RULE_IDS.actorInboxPropertyRequired]: eslint$
|
|
703
|
-
[RULE_IDS.actorInboxPropertyMismatch]: eslint$
|
|
704
|
-
[RULE_IDS.actorSharedInboxPropertyRequired]: eslint$
|
|
705
|
-
[RULE_IDS.actorSharedInboxPropertyMismatch]: eslint$
|
|
706
|
-
[RULE_IDS.actorPublicKeyRequired]: eslint$
|
|
707
|
-
[RULE_IDS.actorAssertionMethodRequired]: eslint,
|
|
708
|
-
[RULE_IDS.collectionFilteringNotImplemented]: eslint
|
|
604
|
+
[RULE_IDS.actorFollowingPropertyRequired]: eslint$12,
|
|
605
|
+
[RULE_IDS.actorFollowingPropertyMismatch]: eslint$13,
|
|
606
|
+
[RULE_IDS.actorFollowersPropertyRequired]: eslint$14,
|
|
607
|
+
[RULE_IDS.actorFollowersPropertyMismatch]: eslint$15,
|
|
608
|
+
[RULE_IDS.actorOutboxPropertyRequired]: eslint$4,
|
|
609
|
+
[RULE_IDS.actorOutboxPropertyMismatch]: eslint$5,
|
|
610
|
+
[RULE_IDS.actorLikedPropertyRequired]: eslint$6,
|
|
611
|
+
[RULE_IDS.actorLikedPropertyMismatch]: eslint$7,
|
|
612
|
+
[RULE_IDS.actorFeaturedPropertyRequired]: eslint$18,
|
|
613
|
+
[RULE_IDS.actorFeaturedPropertyMismatch]: eslint$19,
|
|
614
|
+
[RULE_IDS.actorFeaturedTagsPropertyRequired]: eslint$16,
|
|
615
|
+
[RULE_IDS.actorFeaturedTagsPropertyMismatch]: eslint$17,
|
|
616
|
+
[RULE_IDS.actorInboxPropertyRequired]: eslint$8,
|
|
617
|
+
[RULE_IDS.actorInboxPropertyMismatch]: eslint$9,
|
|
618
|
+
[RULE_IDS.actorSharedInboxPropertyRequired]: eslint$1,
|
|
619
|
+
[RULE_IDS.actorSharedInboxPropertyMismatch]: eslint$2,
|
|
620
|
+
[RULE_IDS.actorPublicKeyRequired]: eslint$3,
|
|
621
|
+
[RULE_IDS.actorAssertionMethodRequired]: eslint$20,
|
|
622
|
+
[RULE_IDS.collectionFilteringNotImplemented]: eslint
|
|
709
623
|
};
|
|
710
624
|
const recommendedRuleIds = [RULE_IDS.actorIdMismatch, RULE_IDS.actorIdRequired];
|
|
711
625
|
/**
|
|
712
626
|
* Recommended configuration - enables all rules as warnings
|
|
713
627
|
*/
|
|
714
|
-
const recommendedRules = (0,
|
|
715
|
-
const pluginName =
|
|
716
|
-
const pluginVersion =
|
|
628
|
+
const recommendedRules = (0, _fxts_core.pipe)(rules, _fxts_core.keys, (0, _fxts_core.map)((key) => [`@fedify/lint/${key}`, recommendedRuleIds.includes(key) ? "error" : "warn"]), _fxts_core.fromEntries);
|
|
629
|
+
const pluginName = name;
|
|
630
|
+
const pluginVersion = version;
|
|
717
631
|
/**
|
|
718
632
|
* Strict configuration - enables all rules as errors
|
|
719
633
|
*/
|
|
720
|
-
const strictRules = (0,
|
|
634
|
+
const strictRules = (0, _fxts_core.pipe)(rules, _fxts_core.keys, (0, _fxts_core.map)((key) => [`${pluginName}/${key}`, "error"]), _fxts_core.fromEntries);
|
|
721
635
|
const plugin = {
|
|
722
636
|
meta: {
|
|
723
637
|
name: pluginName,
|
|
@@ -738,12 +652,10 @@ const recommendedConfig = {
|
|
|
738
652
|
filename + ".mjs",
|
|
739
653
|
filename + ".cjs"
|
|
740
654
|
]).flat(),
|
|
741
|
-
languageOptions: { parser:
|
|
655
|
+
languageOptions: { parser: _typescript_eslint_parser.default },
|
|
742
656
|
plugins: { [pluginName]: plugin },
|
|
743
657
|
rules: recommendedRules
|
|
744
658
|
};
|
|
745
|
-
var src_default = recommendedConfig;
|
|
746
|
-
|
|
747
659
|
//#endregion
|
|
748
|
-
exports.default =
|
|
749
|
-
exports.plugin = plugin;
|
|
660
|
+
exports.default = recommendedConfig;
|
|
661
|
+
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
import { always, every, fromEntries, head, isEmpty, isObject, keys, map, negate, pipe, pipeLazy, prop, some, toArray, unless, when } from "@fxts/core";
|
|
2
2
|
import parser from "@typescript-eslint/parser";
|
|
3
|
-
|
|
4
3
|
//#region deno.json
|
|
5
4
|
var name = "@fedify/lint";
|
|
6
|
-
var version = "2.2.0-dev.
|
|
7
|
-
var license = "MIT";
|
|
8
|
-
var exports = { ".": "./src/mod.ts" };
|
|
9
|
-
var imports = {
|
|
10
|
-
"eslint": "npm:eslint@^9.0.0",
|
|
11
|
-
"estree": "npm:@types/estree@^1.0.8"
|
|
12
|
-
};
|
|
13
|
-
var publish = { "exclude": ["**/*.test.ts", "tsdown.config.ts"] };
|
|
14
|
-
var tasks = { "test": "deno test --allow-env" };
|
|
15
|
-
var deno_default = {
|
|
16
|
-
name,
|
|
17
|
-
version,
|
|
18
|
-
license,
|
|
19
|
-
exports,
|
|
20
|
-
imports,
|
|
21
|
-
publish,
|
|
22
|
-
tasks
|
|
23
|
-
};
|
|
24
|
-
|
|
5
|
+
var version = "2.2.0-dev.622+e54cb037";
|
|
25
6
|
//#endregion
|
|
26
7
|
//#region src/lib/const.ts
|
|
27
8
|
/**
|
|
@@ -140,7 +121,6 @@ const RULE_IDS = {
|
|
|
140
121
|
actorSharedInboxPropertyMismatch: "actor-shared-inbox-property-mismatch",
|
|
141
122
|
collectionFilteringNotImplemented: "collection-filtering-not-implemented"
|
|
142
123
|
};
|
|
143
|
-
|
|
144
124
|
//#endregion
|
|
145
125
|
//#region src/lib/messages.ts
|
|
146
126
|
/**
|
|
@@ -172,14 +152,12 @@ const getExpectedCall = ({ ctxName, methodName, requiresIdentifier, idName }) =>
|
|
|
172
152
|
* Error message for collection filtering not implemented.
|
|
173
153
|
*/
|
|
174
154
|
const COLLECTION_FILTERING_NOT_IMPLEMENTED_ERROR = "Collection dispatcher should implement filtering to avoid large response payloads. Add a fourth parameter (filter) to handle filtering. See: https://fedify.dev/manual/collections#filtering-by-server";
|
|
175
|
-
|
|
176
155
|
//#endregion
|
|
177
156
|
//#region src/lib/utils.ts
|
|
178
157
|
const eq = (value) => (other) => value === other;
|
|
179
158
|
function cases(pred, ifTrue, ifFalse) {
|
|
180
159
|
return (value) => pred(value) ? ifTrue(value) : ifFalse(value);
|
|
181
160
|
}
|
|
182
|
-
|
|
183
161
|
//#endregion
|
|
184
162
|
//#region src/lib/pred.ts
|
|
185
163
|
function allOf(...predicates) {
|
|
@@ -193,7 +171,7 @@ const isNodeType = (type) => (node) => pipe(node, prop("type"), eq(type));
|
|
|
193
171
|
/**
|
|
194
172
|
* Checks if a node is of a specific name.
|
|
195
173
|
*/
|
|
196
|
-
const isNodeName = (name
|
|
174
|
+
const isNodeName = (name) => (node) => pipe(node, prop("name"), eq(name));
|
|
197
175
|
/**
|
|
198
176
|
* Checks if a node's callee is a MemberExpression.
|
|
199
177
|
*/
|
|
@@ -223,7 +201,6 @@ const isSetActorDispatcherCall = (node) => allOf(hasMemberExpressionCallee, hasI
|
|
|
223
201
|
* Checks if a function has at least n parameters.
|
|
224
202
|
*/
|
|
225
203
|
const hasMinParams = (min) => (fn) => fn.params.length >= min;
|
|
226
|
-
|
|
227
204
|
//#endregion
|
|
228
205
|
//#region src/lib/property-checker.ts
|
|
229
206
|
/**
|
|
@@ -339,7 +316,6 @@ function* flatten(node) {
|
|
|
339
316
|
default: return;
|
|
340
317
|
}
|
|
341
318
|
}
|
|
342
|
-
|
|
343
319
|
//#endregion
|
|
344
320
|
//#region src/lib/tracker.ts
|
|
345
321
|
/**
|
|
@@ -366,14 +342,13 @@ function trackFederationVariables() {
|
|
|
366
342
|
if (isCreateFederation(init) && id.type === "Identifier") federationVariables.add(id.name);
|
|
367
343
|
}
|
|
368
344
|
},
|
|
369
|
-
isFederationVariable(name
|
|
370
|
-
return federationVariables.has(name
|
|
345
|
+
isFederationVariable(name) {
|
|
346
|
+
return federationVariables.has(name);
|
|
371
347
|
},
|
|
372
348
|
isFederationObject
|
|
373
349
|
};
|
|
374
350
|
}
|
|
375
351
|
const isCreateFederation = (node) => node.callee.type === "Identifier" && /^create(Federation|FederationBuilder)$/i.test(node.callee.name);
|
|
376
|
-
|
|
377
352
|
//#endregion
|
|
378
353
|
//#region src/lib/required.ts
|
|
379
354
|
/**
|
|
@@ -397,8 +372,7 @@ function createRequiredRule(config, description) {
|
|
|
397
372
|
const federationTracker = trackFederationVariables();
|
|
398
373
|
const dispatcherTracker = createDispatcherTracker(config.setter, federationTracker);
|
|
399
374
|
const actorDispatchers = [];
|
|
400
|
-
const
|
|
401
|
-
const propertySearcher = createPropertySearcher(propertyChecker);
|
|
375
|
+
const propertySearcher = createPropertySearcher(createPropertyChecker(Boolean)(config.path));
|
|
402
376
|
return {
|
|
403
377
|
VariableDeclarator: federationTracker.VariableDeclarator,
|
|
404
378
|
CallExpression(node) {
|
|
@@ -441,15 +415,11 @@ function createRequiredRuleEslint(config) {
|
|
|
441
415
|
})
|
|
442
416
|
};
|
|
443
417
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
//#region src/rules/actor-assertion-method-required.ts
|
|
447
|
-
const deno$19 = createRequiredRuleDeno(properties.assertionMethod);
|
|
448
|
-
const eslint = createRequiredRuleEslint(properties.assertionMethod);
|
|
449
|
-
|
|
418
|
+
createRequiredRuleDeno(properties.assertionMethod);
|
|
419
|
+
const eslint$20 = createRequiredRuleEslint(properties.assertionMethod);
|
|
450
420
|
//#endregion
|
|
451
421
|
//#region src/lib/mismatch.ts
|
|
452
|
-
const isIdentifierWithName = (name
|
|
422
|
+
const isIdentifierWithName = (name) => (node) => allOf(isNodeType("Identifier"), isNodeName(name))(node);
|
|
453
423
|
/**
|
|
454
424
|
* Checks if a node is a CallExpression calling the expected context method.
|
|
455
425
|
*/
|
|
@@ -485,12 +455,8 @@ function createMismatchRule(config, describe) {
|
|
|
485
455
|
methodName: config.getter,
|
|
486
456
|
requiresIdentifier: config.requiresIdentifier
|
|
487
457
|
};
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
if (!hasProperty) return;
|
|
491
|
-
const propertyChecker = createPropertyChecker(isExpectedMethodCall(methodCallContext))(config.path);
|
|
492
|
-
const propertySearcher = createPropertySearcher(propertyChecker);
|
|
493
|
-
if (!propertySearcher(dispatcherArg.body)) context.report({
|
|
458
|
+
if (!createPropertySearcher(createPropertyChecker(Boolean)(config.path))(dispatcherArg.body)) return;
|
|
459
|
+
if (!createPropertySearcher(createPropertyChecker(isExpectedMethodCall(methodCallContext))(config.path))(dispatcherArg.body)) context.report({
|
|
494
460
|
node: dispatcherArg,
|
|
495
461
|
...describe(methodCallContext)
|
|
496
462
|
});
|
|
@@ -519,102 +485,44 @@ const createMismatchRuleEslint = (config) => ({
|
|
|
519
485
|
data: { message: actorPropertyMismatch(context) }
|
|
520
486
|
}))
|
|
521
487
|
});
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
const eslint$
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
const eslint$4 = createRequiredRuleEslint(properties.featuredTags);
|
|
542
|
-
|
|
543
|
-
//#endregion
|
|
544
|
-
//#region src/rules/actor-followers-property-mismatch.ts
|
|
545
|
-
const deno$14 = createMismatchRuleDeno(properties.followers);
|
|
546
|
-
const eslint$5 = createMismatchRuleEslint(properties.followers);
|
|
547
|
-
|
|
548
|
-
//#endregion
|
|
549
|
-
//#region src/rules/actor-followers-property-required.ts
|
|
550
|
-
const deno$13 = createRequiredRuleDeno(properties.followers);
|
|
551
|
-
const eslint$6 = createRequiredRuleEslint(properties.followers);
|
|
552
|
-
|
|
553
|
-
//#endregion
|
|
554
|
-
//#region src/rules/actor-following-property-mismatch.ts
|
|
555
|
-
const deno$12 = createMismatchRuleDeno(properties.following);
|
|
556
|
-
const eslint$7 = createMismatchRuleEslint(properties.following);
|
|
557
|
-
|
|
558
|
-
//#endregion
|
|
559
|
-
//#region src/rules/actor-following-property-required.ts
|
|
560
|
-
const deno$11 = createRequiredRuleDeno(properties.following);
|
|
561
|
-
const eslint$8 = createRequiredRuleEslint(properties.following);
|
|
562
|
-
|
|
563
|
-
//#endregion
|
|
564
|
-
//#region src/rules/actor-id-mismatch.ts
|
|
565
|
-
const deno$10 = createMismatchRuleDeno(properties.id);
|
|
566
|
-
const eslint$9 = createMismatchRuleEslint(properties.id);
|
|
567
|
-
|
|
568
|
-
//#endregion
|
|
569
|
-
//#region src/rules/actor-id-required.ts
|
|
570
|
-
const deno$9 = createRequiredRuleDeno(properties.id);
|
|
488
|
+
createMismatchRuleDeno(properties.featured);
|
|
489
|
+
const eslint$19 = createMismatchRuleEslint(properties.featured);
|
|
490
|
+
createRequiredRuleDeno(properties.featured);
|
|
491
|
+
const eslint$18 = createRequiredRuleEslint(properties.featured);
|
|
492
|
+
createMismatchRuleDeno(properties.featuredTags);
|
|
493
|
+
const eslint$17 = createMismatchRuleEslint(properties.featuredTags);
|
|
494
|
+
createRequiredRuleDeno(properties.featuredTags);
|
|
495
|
+
const eslint$16 = createRequiredRuleEslint(properties.featuredTags);
|
|
496
|
+
createMismatchRuleDeno(properties.followers);
|
|
497
|
+
const eslint$15 = createMismatchRuleEslint(properties.followers);
|
|
498
|
+
createRequiredRuleDeno(properties.followers);
|
|
499
|
+
const eslint$14 = createRequiredRuleEslint(properties.followers);
|
|
500
|
+
createMismatchRuleDeno(properties.following);
|
|
501
|
+
const eslint$13 = createMismatchRuleEslint(properties.following);
|
|
502
|
+
createRequiredRuleDeno(properties.following);
|
|
503
|
+
const eslint$12 = createRequiredRuleEslint(properties.following);
|
|
504
|
+
createMismatchRuleDeno(properties.id);
|
|
505
|
+
const eslint$11 = createMismatchRuleEslint(properties.id);
|
|
506
|
+
createRequiredRuleDeno(properties.id);
|
|
571
507
|
const eslint$10 = createRequiredRuleEslint(properties.id);
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
const eslint$
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
const deno$5 = createRequiredRuleDeno(properties.liked);
|
|
591
|
-
const eslint$14 = createRequiredRuleEslint(properties.liked);
|
|
592
|
-
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region src/rules/actor-outbox-property-mismatch.ts
|
|
595
|
-
const deno$4 = createMismatchRuleDeno(properties.outbox);
|
|
596
|
-
const eslint$15 = createMismatchRuleEslint(properties.outbox);
|
|
597
|
-
|
|
598
|
-
//#endregion
|
|
599
|
-
//#region src/rules/actor-outbox-property-required.ts
|
|
600
|
-
const deno$3 = createRequiredRuleDeno(properties.outbox);
|
|
601
|
-
const eslint$16 = createRequiredRuleEslint(properties.outbox);
|
|
602
|
-
|
|
603
|
-
//#endregion
|
|
604
|
-
//#region src/rules/actor-public-key-required.ts
|
|
605
|
-
const deno$2 = createRequiredRuleDeno(properties.publicKey);
|
|
606
|
-
const eslint$17 = createRequiredRuleEslint(properties.publicKey);
|
|
607
|
-
|
|
608
|
-
//#endregion
|
|
609
|
-
//#region src/rules/actor-shared-inbox-property-mismatch.ts
|
|
610
|
-
const deno$1 = createMismatchRuleDeno(properties.sharedInbox);
|
|
611
|
-
const eslint$18 = createMismatchRuleEslint(properties.sharedInbox);
|
|
612
|
-
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region src/rules/actor-shared-inbox-property-required.ts
|
|
615
|
-
const deno = createRequiredRuleDeno(properties.sharedInbox);
|
|
616
|
-
const eslint$19 = createRequiredRuleEslint(properties.sharedInbox);
|
|
617
|
-
|
|
508
|
+
createMismatchRuleDeno(properties.inbox);
|
|
509
|
+
const eslint$9 = createMismatchRuleEslint(properties.inbox);
|
|
510
|
+
createRequiredRuleDeno(properties.inbox);
|
|
511
|
+
const eslint$8 = createRequiredRuleEslint(properties.inbox);
|
|
512
|
+
createMismatchRuleDeno(properties.liked);
|
|
513
|
+
const eslint$7 = createMismatchRuleEslint(properties.liked);
|
|
514
|
+
createRequiredRuleDeno(properties.liked);
|
|
515
|
+
const eslint$6 = createRequiredRuleEslint(properties.liked);
|
|
516
|
+
createMismatchRuleDeno(properties.outbox);
|
|
517
|
+
const eslint$5 = createMismatchRuleEslint(properties.outbox);
|
|
518
|
+
createRequiredRuleDeno(properties.outbox);
|
|
519
|
+
const eslint$4 = createRequiredRuleEslint(properties.outbox);
|
|
520
|
+
createRequiredRuleDeno(properties.publicKey);
|
|
521
|
+
const eslint$3 = createRequiredRuleEslint(properties.publicKey);
|
|
522
|
+
createMismatchRuleDeno(properties.sharedInbox);
|
|
523
|
+
const eslint$2 = createMismatchRuleEslint(properties.sharedInbox);
|
|
524
|
+
createRequiredRuleDeno(properties.sharedInbox);
|
|
525
|
+
const eslint$1 = createRequiredRuleEslint(properties.sharedInbox);
|
|
618
526
|
//#endregion
|
|
619
527
|
//#region src/rules/collection-filtering-not-implemented.ts
|
|
620
528
|
/**
|
|
@@ -633,7 +541,7 @@ const isFollowersDispatcherCall = (node) => "callee" in node && node.callee && n
|
|
|
633
541
|
* CollectionDispatcher signature: (context, identifier, cursor, filter?) => ...
|
|
634
542
|
*/
|
|
635
543
|
const hasFilterParameter = hasMinParams(4);
|
|
636
|
-
const eslint
|
|
544
|
+
const eslint = {
|
|
637
545
|
meta: {
|
|
638
546
|
type: "suggestion",
|
|
639
547
|
docs: { description: "Ensure followers dispatcher implements filtering" },
|
|
@@ -657,39 +565,42 @@ const eslint$20 = {
|
|
|
657
565
|
};
|
|
658
566
|
}
|
|
659
567
|
};
|
|
660
|
-
|
|
661
568
|
//#endregion
|
|
662
569
|
//#region src/index.ts
|
|
570
|
+
/**
|
|
571
|
+
* ESLint plugin for Fedify.
|
|
572
|
+
* Provides lint rules for validating Fedify federation code.
|
|
573
|
+
*/
|
|
663
574
|
const rules = {
|
|
664
|
-
[RULE_IDS.actorIdMismatch]: eslint$
|
|
575
|
+
[RULE_IDS.actorIdMismatch]: eslint$11,
|
|
665
576
|
[RULE_IDS.actorIdRequired]: eslint$10,
|
|
666
|
-
[RULE_IDS.actorFollowingPropertyRequired]: eslint$
|
|
667
|
-
[RULE_IDS.actorFollowingPropertyMismatch]: eslint$
|
|
668
|
-
[RULE_IDS.actorFollowersPropertyRequired]: eslint$
|
|
669
|
-
[RULE_IDS.actorFollowersPropertyMismatch]: eslint$
|
|
670
|
-
[RULE_IDS.actorOutboxPropertyRequired]: eslint$
|
|
671
|
-
[RULE_IDS.actorOutboxPropertyMismatch]: eslint$
|
|
672
|
-
[RULE_IDS.actorLikedPropertyRequired]: eslint$
|
|
673
|
-
[RULE_IDS.actorLikedPropertyMismatch]: eslint$
|
|
674
|
-
[RULE_IDS.actorFeaturedPropertyRequired]: eslint$
|
|
675
|
-
[RULE_IDS.actorFeaturedPropertyMismatch]: eslint$
|
|
676
|
-
[RULE_IDS.actorFeaturedTagsPropertyRequired]: eslint$
|
|
677
|
-
[RULE_IDS.actorFeaturedTagsPropertyMismatch]: eslint$
|
|
678
|
-
[RULE_IDS.actorInboxPropertyRequired]: eslint$
|
|
679
|
-
[RULE_IDS.actorInboxPropertyMismatch]: eslint$
|
|
680
|
-
[RULE_IDS.actorSharedInboxPropertyRequired]: eslint$
|
|
681
|
-
[RULE_IDS.actorSharedInboxPropertyMismatch]: eslint$
|
|
682
|
-
[RULE_IDS.actorPublicKeyRequired]: eslint$
|
|
683
|
-
[RULE_IDS.actorAssertionMethodRequired]: eslint,
|
|
684
|
-
[RULE_IDS.collectionFilteringNotImplemented]: eslint
|
|
577
|
+
[RULE_IDS.actorFollowingPropertyRequired]: eslint$12,
|
|
578
|
+
[RULE_IDS.actorFollowingPropertyMismatch]: eslint$13,
|
|
579
|
+
[RULE_IDS.actorFollowersPropertyRequired]: eslint$14,
|
|
580
|
+
[RULE_IDS.actorFollowersPropertyMismatch]: eslint$15,
|
|
581
|
+
[RULE_IDS.actorOutboxPropertyRequired]: eslint$4,
|
|
582
|
+
[RULE_IDS.actorOutboxPropertyMismatch]: eslint$5,
|
|
583
|
+
[RULE_IDS.actorLikedPropertyRequired]: eslint$6,
|
|
584
|
+
[RULE_IDS.actorLikedPropertyMismatch]: eslint$7,
|
|
585
|
+
[RULE_IDS.actorFeaturedPropertyRequired]: eslint$18,
|
|
586
|
+
[RULE_IDS.actorFeaturedPropertyMismatch]: eslint$19,
|
|
587
|
+
[RULE_IDS.actorFeaturedTagsPropertyRequired]: eslint$16,
|
|
588
|
+
[RULE_IDS.actorFeaturedTagsPropertyMismatch]: eslint$17,
|
|
589
|
+
[RULE_IDS.actorInboxPropertyRequired]: eslint$8,
|
|
590
|
+
[RULE_IDS.actorInboxPropertyMismatch]: eslint$9,
|
|
591
|
+
[RULE_IDS.actorSharedInboxPropertyRequired]: eslint$1,
|
|
592
|
+
[RULE_IDS.actorSharedInboxPropertyMismatch]: eslint$2,
|
|
593
|
+
[RULE_IDS.actorPublicKeyRequired]: eslint$3,
|
|
594
|
+
[RULE_IDS.actorAssertionMethodRequired]: eslint$20,
|
|
595
|
+
[RULE_IDS.collectionFilteringNotImplemented]: eslint
|
|
685
596
|
};
|
|
686
597
|
const recommendedRuleIds = [RULE_IDS.actorIdMismatch, RULE_IDS.actorIdRequired];
|
|
687
598
|
/**
|
|
688
599
|
* Recommended configuration - enables all rules as warnings
|
|
689
600
|
*/
|
|
690
601
|
const recommendedRules = pipe(rules, keys, map((key) => [`@fedify/lint/${key}`, recommendedRuleIds.includes(key) ? "error" : "warn"]), fromEntries);
|
|
691
|
-
const pluginName =
|
|
692
|
-
const pluginVersion =
|
|
602
|
+
const pluginName = name;
|
|
603
|
+
const pluginVersion = version;
|
|
693
604
|
/**
|
|
694
605
|
* Strict configuration - enables all rules as errors
|
|
695
606
|
*/
|
|
@@ -718,7 +629,5 @@ const recommendedConfig = {
|
|
|
718
629
|
plugins: { [pluginName]: plugin },
|
|
719
630
|
rules: recommendedRules
|
|
720
631
|
};
|
|
721
|
-
var src_default = recommendedConfig;
|
|
722
|
-
|
|
723
632
|
//#endregion
|
|
724
|
-
export {
|
|
633
|
+
export { recommendedConfig as default, plugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/lint",
|
|
3
|
-
"version": "2.2.0-dev.
|
|
3
|
+
"version": "2.2.0-dev.622+e54cb037",
|
|
4
4
|
"description": "Fedify linting rules and plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"eslint": ">=9.0.0",
|
|
50
|
-
"@fedify/fedify": "^2.2.0-dev.
|
|
50
|
+
"@fedify/fedify": "^2.2.0-dev.622+e54cb037"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"eslint": {
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"@types/eslint": "^9.0.0",
|
|
64
64
|
"@types/estree": "^1.0.8",
|
|
65
65
|
"eslint": "^9.0.0",
|
|
66
|
-
"tsdown": "^0.
|
|
67
|
-
"typescript": "^5.9.
|
|
66
|
+
"tsdown": "^0.21.6",
|
|
67
|
+
"typescript": "^5.9.2"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build:self": "tsdown",
|