@eslint-react/var 5.24.2 → 5.24.4
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.js +13 -30
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { Check, Compare, Extract, Traverse } from "@eslint-react/ast";
|
|
|
3
3
|
import { findVariable, getStaticValue } from "@typescript-eslint/utils/ast-utils";
|
|
4
4
|
import { DefinitionType } from "@typescript-eslint/scope-manager";
|
|
5
5
|
import { P, isMatching } from "ts-pattern";
|
|
6
|
-
|
|
7
6
|
//#region ../../.pkgs/eff/dist/index.js
|
|
8
7
|
const pipeArguments = (self, args) => {
|
|
9
8
|
switch (args.length) {
|
|
@@ -27,7 +26,7 @@ const pipeArguments = (self, args) => {
|
|
|
27
26
|
const Prototype = { pipe() {
|
|
28
27
|
return pipeArguments(this, arguments);
|
|
29
28
|
} };
|
|
30
|
-
|
|
29
|
+
(function() {
|
|
31
30
|
function PipeableBase() {}
|
|
32
31
|
PipeableBase.prototype = Prototype;
|
|
33
32
|
return PipeableBase;
|
|
@@ -62,23 +61,18 @@ const dual = function(arity, body) {
|
|
|
62
61
|
};
|
|
63
62
|
const identity = (a) => a;
|
|
64
63
|
const cast = identity;
|
|
65
|
-
|
|
66
|
-
const constTrue = constant(true);
|
|
67
|
-
const constFalse = constant(false);
|
|
68
|
-
const constNull = constant(null);
|
|
69
|
-
const constUndefined = constant(void 0);
|
|
70
|
-
const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
64
|
+
dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
71
65
|
const absurd = (_) => {
|
|
72
66
|
throw new Error("Called `absurd` function which should be uncallable");
|
|
73
67
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
cast(absurd);
|
|
69
|
+
dual(2, (a, b) => (data) => a(data) && b(data));
|
|
70
|
+
dual(2, (a, b) => (data) => a(data) || b(data));
|
|
71
|
+
dual(2, (a, b) => (data) => a(data) !== b(data));
|
|
72
|
+
dual(2, (a, b) => (data) => a(data) === b(data));
|
|
73
|
+
dual(2, (antecedent, consequent) => (data) => !antecedent(data) || consequent(data));
|
|
74
|
+
dual(2, (a, b) => (data) => !a(data) && !b(data));
|
|
75
|
+
dual(2, (a, b) => (data) => !a(data) || !b(data));
|
|
82
76
|
function isFunction(input) {
|
|
83
77
|
return typeof input === "function";
|
|
84
78
|
}
|
|
@@ -92,21 +86,20 @@ function getOrInsertComputed(map, key, callback) {
|
|
|
92
86
|
map.set(key, value);
|
|
93
87
|
return value;
|
|
94
88
|
}
|
|
95
|
-
|
|
89
|
+
dual(2, (self, predicate) => {
|
|
96
90
|
const input = Array.isArray(self) ? self : Array.from(self);
|
|
97
91
|
const len = input.length;
|
|
98
92
|
let idx = 0;
|
|
99
93
|
while (idx < len && predicate(input[idx], idx)) idx++;
|
|
100
94
|
return input.slice(idx);
|
|
101
95
|
});
|
|
102
|
-
|
|
96
|
+
dual(2, (self, predicate) => {
|
|
103
97
|
const input = Array.isArray(self) ? self : Array.from(self);
|
|
104
98
|
const len = input.length;
|
|
105
99
|
let idx = 0;
|
|
106
100
|
while (idx < len && predicate(input[idx], idx)) idx++;
|
|
107
101
|
return input.slice(0, idx);
|
|
108
102
|
});
|
|
109
|
-
|
|
110
103
|
//#endregion
|
|
111
104
|
//#region src/create-import-lookup.ts
|
|
112
105
|
function createImportLookup(program, options) {
|
|
@@ -179,7 +172,6 @@ function createImportLookup(program, options) {
|
|
|
179
172
|
}
|
|
180
173
|
};
|
|
181
174
|
}
|
|
182
|
-
|
|
183
175
|
//#endregion
|
|
184
176
|
//#region src/resolve-origin.ts
|
|
185
177
|
function resolveOrigin(context, node, options) {
|
|
@@ -209,7 +201,6 @@ function resolveOrigin(context, node, options) {
|
|
|
209
201
|
default: return null;
|
|
210
202
|
}
|
|
211
203
|
}
|
|
212
|
-
|
|
213
204
|
//#endregion
|
|
214
205
|
//#region src/is-value-equal.ts
|
|
215
206
|
const thisBlockTypes = [
|
|
@@ -270,7 +261,6 @@ function isValueEqual(context, a, b) {
|
|
|
270
261
|
}
|
|
271
262
|
}
|
|
272
263
|
}
|
|
273
|
-
|
|
274
264
|
//#endregion
|
|
275
265
|
//#region src/is-assignment-target-equal.ts
|
|
276
266
|
function isAssignmentTargetEqual(context, a, b) {
|
|
@@ -279,7 +269,6 @@ function isAssignmentTargetEqual(context, a, b) {
|
|
|
279
269
|
if (Check.isIdentifier(unwrappedA) && Check.isIdentifier(unwrappedB)) return isValueEqual(context, unwrappedA, unwrappedB);
|
|
280
270
|
return Compare.isEqual(unwrappedA, unwrappedB) || isValueEqual(context, unwrappedA, unwrappedB);
|
|
281
271
|
}
|
|
282
|
-
|
|
283
272
|
//#endregion
|
|
284
273
|
//#region src/resolve-import-source.ts
|
|
285
274
|
function getRequireExpressionArguments(node) {
|
|
@@ -312,13 +301,11 @@ function resolveImportSource(name, initialScope, seen = /* @__PURE__ */ new Set(
|
|
|
312
301
|
if (parent?.type === AST_NODE_TYPES.ImportDeclaration) return parent.source.value;
|
|
313
302
|
return null;
|
|
314
303
|
}
|
|
315
|
-
|
|
316
304
|
//#endregion
|
|
317
305
|
//#region src/is-initialized-from-react.ts
|
|
318
306
|
function isInitializedFromReact(name, initialScope, importSource = "react") {
|
|
319
307
|
return name.toLowerCase() === "react" || Boolean(resolveImportSource(name, initialScope)?.startsWith(importSource));
|
|
320
308
|
}
|
|
321
|
-
|
|
322
309
|
//#endregion
|
|
323
310
|
//#region src/is-initialized-from-react-native.ts
|
|
324
311
|
function isInitializedFromReactNative(name, initialScope, importSource = "react-native") {
|
|
@@ -328,7 +315,6 @@ function isInitializedFromReactNative(name, initialScope, importSource = "react-
|
|
|
328
315
|
"rn"
|
|
329
316
|
].includes(name.toLowerCase()) || Boolean(resolveImportSource(name, initialScope)?.startsWith(importSource));
|
|
330
317
|
}
|
|
331
|
-
|
|
332
318
|
//#endregion
|
|
333
319
|
//#region src/resolve.ts
|
|
334
320
|
function resolve(context, node, options) {
|
|
@@ -359,7 +345,6 @@ function resolve(context, node, options) {
|
|
|
359
345
|
default: return null;
|
|
360
346
|
}
|
|
361
347
|
}
|
|
362
|
-
|
|
363
348
|
//#endregion
|
|
364
349
|
//#region src/resolve-enclosing-assignment-target.ts
|
|
365
350
|
function resolveEnclosingAssignmentTarget(node) {
|
|
@@ -373,7 +358,6 @@ function resolveEnclosingAssignmentTarget(node) {
|
|
|
373
358
|
default: return resolveEnclosingAssignmentTarget(node.parent);
|
|
374
359
|
}
|
|
375
360
|
}
|
|
376
|
-
|
|
377
361
|
//#endregion
|
|
378
362
|
//#region src/resolve-object-type.ts
|
|
379
363
|
function resolveObjectType(context, node) {
|
|
@@ -476,6 +460,5 @@ function resolveObjectType(context, node) {
|
|
|
476
460
|
return resolveObjectType(context, node.expression);
|
|
477
461
|
}
|
|
478
462
|
}
|
|
479
|
-
|
|
480
463
|
//#endregion
|
|
481
|
-
export { createImportLookup, isAssignmentTargetEqual, isInitializedFromReact, isInitializedFromReactNative, isValueEqual, resolve, resolveEnclosingAssignmentTarget, resolveImportSource, resolveObjectType, resolveOrigin };
|
|
464
|
+
export { createImportLookup, isAssignmentTargetEqual, isInitializedFromReact, isInitializedFromReactNative, isValueEqual, resolve, resolveEnclosingAssignmentTarget, resolveImportSource, resolveObjectType, resolveOrigin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/var",
|
|
3
|
-
"version": "5.24.
|
|
3
|
+
"version": "5.24.4",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module for static analysis of variables.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eslint-react/ast": "5.24.
|
|
33
|
-
"@eslint-react/eslint": "5.24.
|
|
32
|
+
"@eslint-react/ast": "5.24.4",
|
|
33
|
+
"@eslint-react/eslint": "5.24.4",
|
|
34
34
|
"@typescript-eslint/scope-manager": "^8.71.0",
|
|
35
35
|
"@typescript-eslint/types": "^8.71.0",
|
|
36
36
|
"@typescript-eslint/utils": "^8.71.0",
|