@fedify/lint 2.0.25 → 2.0.26-dev.1876
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 +17 -3
- package/dist/index.js +17 -3
- package/package.json +2 -2
package/deno.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@ let _typescript_eslint_parser = require("@typescript-eslint/parser");
|
|
|
29
29
|
_typescript_eslint_parser = __toESM(_typescript_eslint_parser);
|
|
30
30
|
//#region deno.json
|
|
31
31
|
var name = "@fedify/lint";
|
|
32
|
-
var version = "2.0.
|
|
32
|
+
var version = "2.0.26-dev.1876+a95acb45";
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/lib/const.ts
|
|
35
35
|
/**
|
|
@@ -271,7 +271,21 @@ const checkObjectExpression = (propertyChecker) => (obj) => obj.properties.some(
|
|
|
271
271
|
* @returns A function that checks the ConditionalExpression
|
|
272
272
|
*/
|
|
273
273
|
const checkConditionalExpression = (propertyChecker) => (node) => [node.consequent, node.alternate].every(checkBranchWith(propertyChecker));
|
|
274
|
-
const
|
|
274
|
+
const unwrapTypeScriptExpression = (node) => {
|
|
275
|
+
switch (node.type) {
|
|
276
|
+
case "TSAsExpression":
|
|
277
|
+
case "TSSatisfiesExpression":
|
|
278
|
+
case "TSNonNullExpression":
|
|
279
|
+
case "TSTypeAssertion": return unwrapTypeScriptExpression(node.expression);
|
|
280
|
+
default: return node;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
const isNullLiteral = (node) => node.type === "Literal" && node.value === null;
|
|
284
|
+
const checkBranchWith = (propertyChecker) => (branch) => {
|
|
285
|
+
const expression = unwrapTypeScriptExpression(branch);
|
|
286
|
+
if (isNullLiteral(expression)) return true;
|
|
287
|
+
return (0, _fxts_core.pipe)(expression, cases(isNodeType("ConditionalExpression"), checkConditionalExpression(propertyChecker), (0, _fxts_core.pipeLazy)(extractObjectExpression, cases(_fxts_core.isObject, checkObjectExpression(propertyChecker), (0, _fxts_core.always)(false)))));
|
|
288
|
+
};
|
|
275
289
|
/**
|
|
276
290
|
* Extracts the first argument if it's an ObjectExpression.
|
|
277
291
|
*/
|
|
@@ -297,7 +311,7 @@ const createPropertySearcher = (propertyChecker) => {
|
|
|
297
311
|
case "ReturnStatement": return checkReturnStatement(propertyChecker)(node);
|
|
298
312
|
case "BlockStatement": return checkAllReturnPaths(propertyChecker)(node);
|
|
299
313
|
case "NewExpression": return (0, _fxts_core.pipe)(node, extractFirstObjectExpression, (0, _fxts_core.when)(_fxts_core.isObject, checkObjectExpression(propertyChecker)), Boolean);
|
|
300
|
-
default: return
|
|
314
|
+
default: return checkBranchWith(propertyChecker)(node);
|
|
301
315
|
}
|
|
302
316
|
};
|
|
303
317
|
};
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { always, every, fromEntries, head, isEmpty, isObject, keys, map, negate,
|
|
|
2
2
|
import parser from "@typescript-eslint/parser";
|
|
3
3
|
//#region deno.json
|
|
4
4
|
var name = "@fedify/lint";
|
|
5
|
-
var version = "2.0.
|
|
5
|
+
var version = "2.0.26-dev.1876+a95acb45";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/lib/const.ts
|
|
8
8
|
/**
|
|
@@ -244,7 +244,21 @@ const checkObjectExpression = (propertyChecker) => (obj) => obj.properties.some(
|
|
|
244
244
|
* @returns A function that checks the ConditionalExpression
|
|
245
245
|
*/
|
|
246
246
|
const checkConditionalExpression = (propertyChecker) => (node) => [node.consequent, node.alternate].every(checkBranchWith(propertyChecker));
|
|
247
|
-
const
|
|
247
|
+
const unwrapTypeScriptExpression = (node) => {
|
|
248
|
+
switch (node.type) {
|
|
249
|
+
case "TSAsExpression":
|
|
250
|
+
case "TSSatisfiesExpression":
|
|
251
|
+
case "TSNonNullExpression":
|
|
252
|
+
case "TSTypeAssertion": return unwrapTypeScriptExpression(node.expression);
|
|
253
|
+
default: return node;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
const isNullLiteral = (node) => node.type === "Literal" && node.value === null;
|
|
257
|
+
const checkBranchWith = (propertyChecker) => (branch) => {
|
|
258
|
+
const expression = unwrapTypeScriptExpression(branch);
|
|
259
|
+
if (isNullLiteral(expression)) return true;
|
|
260
|
+
return pipe(expression, cases(isNodeType("ConditionalExpression"), checkConditionalExpression(propertyChecker), pipeLazy(extractObjectExpression, cases(isObject, checkObjectExpression(propertyChecker), always(false)))));
|
|
261
|
+
};
|
|
248
262
|
/**
|
|
249
263
|
* Extracts the first argument if it's an ObjectExpression.
|
|
250
264
|
*/
|
|
@@ -270,7 +284,7 @@ const createPropertySearcher = (propertyChecker) => {
|
|
|
270
284
|
case "ReturnStatement": return checkReturnStatement(propertyChecker)(node);
|
|
271
285
|
case "BlockStatement": return checkAllReturnPaths(propertyChecker)(node);
|
|
272
286
|
case "NewExpression": return pipe(node, extractFirstObjectExpression, when(isObject, checkObjectExpression(propertyChecker)), Boolean);
|
|
273
|
-
default: return
|
|
287
|
+
default: return checkBranchWith(propertyChecker)(node);
|
|
274
288
|
}
|
|
275
289
|
};
|
|
276
290
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/lint",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26-dev.1876+a95acb45",
|
|
4
4
|
"description": "Fedify linting rules and plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"eslint": ">=9.0.0",
|
|
55
|
-
"@fedify/fedify": "^2.0.
|
|
55
|
+
"@fedify/fedify": "^2.0.26-dev.1876+a95acb45"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"eslint": {
|