eslint-plugin-remeda 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +70 -76
- package/dist/index.js +19 -15
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __create = Object.create;
|
3
2
|
var __defProp = Object.defineProperty;
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
6
|
var __export = (target, all) => {
|
9
7
|
for (var name in all)
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
15
|
}
|
18
16
|
return to;
|
19
17
|
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
19
|
|
30
20
|
// src/index.ts
|
@@ -33,7 +23,7 @@ __export(src_exports, {
|
|
33
23
|
default: () => src_default
|
34
24
|
});
|
35
25
|
module.exports = __toCommonJS(src_exports);
|
36
|
-
var
|
26
|
+
var import_lodash_es12 = require("lodash-es");
|
37
27
|
|
38
28
|
// package.json
|
39
29
|
var version = "0.0.0-development";
|
@@ -80,7 +70,7 @@ var package_default = {
|
|
80
70
|
},
|
81
71
|
devDependencies: {
|
82
72
|
"@arethetypeswrong/cli": "^0.15.4",
|
83
|
-
"@types/lodash": "^4.17.
|
73
|
+
"@types/lodash-es": "^4.17.12",
|
84
74
|
"@types/node": "^20.14.9",
|
85
75
|
"@vitest/coverage-v8": "^2.0.3",
|
86
76
|
"@vitest/ui": "^2.0.3",
|
@@ -115,39 +105,39 @@ var package_default = {
|
|
115
105
|
],
|
116
106
|
license: "MIT",
|
117
107
|
dependencies: {
|
118
|
-
lodash: "^4.17.21"
|
108
|
+
"lodash-es": "^4.17.21"
|
119
109
|
}
|
120
110
|
};
|
121
111
|
|
122
112
|
// src/rules/collection-method-value.ts
|
123
|
-
var
|
113
|
+
var import_lodash_es6 = require("lodash-es");
|
124
114
|
|
125
115
|
// src/util/astUtil.ts
|
126
|
-
var
|
127
|
-
var getCaller = (0,
|
128
|
-
var getMethodName = (0,
|
129
|
-
var isMethodCall = (0,
|
116
|
+
var import_lodash_es = require("lodash-es");
|
117
|
+
var getCaller = (0, import_lodash_es.property)(["callee", "object"]);
|
118
|
+
var getMethodName = (0, import_lodash_es.property)(["callee", "property", "name"]);
|
119
|
+
var isMethodCall = (0, import_lodash_es.matches)({
|
130
120
|
type: "CallExpression",
|
131
121
|
callee: { type: "MemberExpression" }
|
132
122
|
});
|
133
|
-
var isFunctionExpression = (0,
|
134
|
-
(0,
|
135
|
-
(0,
|
123
|
+
var isFunctionExpression = (0, import_lodash_es.overSome)(
|
124
|
+
(0, import_lodash_es.matchesProperty)("type", "FunctionExpression"),
|
125
|
+
(0, import_lodash_es.matchesProperty)("type", "FunctionDeclaration")
|
136
126
|
);
|
137
|
-
var isFunctionDefinitionWithBlock = (0,
|
127
|
+
var isFunctionDefinitionWithBlock = (0, import_lodash_es.overSome)(
|
138
128
|
isFunctionExpression,
|
139
|
-
(0,
|
129
|
+
(0, import_lodash_es.matches)({
|
140
130
|
type: "ArrowFunctionExpression",
|
141
131
|
body: { type: "BlockStatement" }
|
142
132
|
})
|
143
133
|
);
|
144
|
-
var getFirstFunctionLine = (0,
|
145
|
-
[isFunctionDefinitionWithBlock, (0,
|
146
|
-
[(0,
|
134
|
+
var getFirstFunctionLine = (0, import_lodash_es.cond)([
|
135
|
+
[isFunctionDefinitionWithBlock, (0, import_lodash_es.property)(["body", "body", 0])],
|
136
|
+
[(0, import_lodash_es.matches)({ type: "ArrowFunctionExpression" }), (0, import_lodash_es.property)("body")]
|
147
137
|
]);
|
148
|
-
var isPropAccess = (0,
|
149
|
-
(0,
|
150
|
-
(0,
|
138
|
+
var isPropAccess = (0, import_lodash_es.overSome)(
|
139
|
+
(0, import_lodash_es.matches)({ computed: false }),
|
140
|
+
(0, import_lodash_es.matchesProperty)(["property", "type"], "Literal")
|
151
141
|
);
|
152
142
|
function isMemberExpOf(node, objectName, { maxLength = Number.MAX_VALUE, allowComputed } = {}) {
|
153
143
|
if (objectName) {
|
@@ -166,18 +156,18 @@ function isMemberExpOf(node, objectName, { maxLength = Number.MAX_VALUE, allowCo
|
|
166
156
|
}
|
167
157
|
}
|
168
158
|
}
|
169
|
-
var getFirstParamName = (0,
|
170
|
-
var isReturnStatement = (0,
|
159
|
+
var getFirstParamName = (0, import_lodash_es.property)(["params", 0, "name"]);
|
160
|
+
var isReturnStatement = (0, import_lodash_es.matchesProperty)("type", "ReturnStatement");
|
171
161
|
function hasOnlyOneStatement(func) {
|
172
162
|
if (isFunctionDefinitionWithBlock(func)) {
|
173
|
-
return (0,
|
163
|
+
return (0, import_lodash_es.get)(func, "body.body.length") === 1;
|
174
164
|
}
|
175
165
|
if (func.type === "ArrowFunctionExpression") {
|
176
|
-
return !(0,
|
166
|
+
return !(0, import_lodash_es.get)(func, "body.body");
|
177
167
|
}
|
178
168
|
}
|
179
169
|
function isObjectOfMethodCall(node) {
|
180
|
-
return (0,
|
170
|
+
return (0, import_lodash_es.get)(node, "parent.object") === node && (0, import_lodash_es.get)(node, "parent.parent.type") === "CallExpression";
|
181
171
|
}
|
182
172
|
function isLiteral(node) {
|
183
173
|
return node.type === "Literal";
|
@@ -187,7 +177,7 @@ function isBinaryExpWithMemberOf(operator, exp, objectName, {
|
|
187
177
|
allowComputed,
|
188
178
|
onlyLiterals
|
189
179
|
} = {}) {
|
190
|
-
if (!(0,
|
180
|
+
if (!(0, import_lodash_es.isMatch)(exp, { type: "BinaryExpression", operator })) {
|
191
181
|
return false;
|
192
182
|
}
|
193
183
|
const [left, right] = [exp.left, exp.right].map(
|
@@ -195,7 +185,7 @@ function isBinaryExpWithMemberOf(operator, exp, objectName, {
|
|
195
185
|
);
|
196
186
|
return left === !right && (!onlyLiterals || isLiteral(exp.left) || isLiteral(exp.right));
|
197
187
|
}
|
198
|
-
var isNegationExpression = (0,
|
188
|
+
var isNegationExpression = (0, import_lodash_es.matches)({
|
199
189
|
type: "UnaryExpression",
|
200
190
|
operator: "!"
|
201
191
|
});
|
@@ -217,14 +207,14 @@ function getValueReturnedInFirstStatement(func) {
|
|
217
207
|
}
|
218
208
|
}
|
219
209
|
function isCallFromObject(node, objName) {
|
220
|
-
return node && objName && node.type === "CallExpression" && (0,
|
210
|
+
return node && objName && node.type === "CallExpression" && (0, import_lodash_es.get)(node, "callee.object.name") === objName;
|
221
211
|
}
|
222
212
|
function isComputed(node) {
|
223
|
-
return (0,
|
213
|
+
return (0, import_lodash_es.get)(node, "computed") && node.property.type !== "Literal";
|
224
214
|
}
|
225
215
|
function isEquivalentMemberExp(a, b) {
|
226
|
-
return (0,
|
227
|
-
if ((0,
|
216
|
+
return (0, import_lodash_es.isEqualWith)(a, b, (left, right, key) => {
|
217
|
+
if ((0, import_lodash_es.includes)(["loc", "range", "computed", "start", "end", "parent"], key)) {
|
228
218
|
return true;
|
229
219
|
}
|
230
220
|
if (isComputed(left) || isComputed(right)) {
|
@@ -237,7 +227,7 @@ function isEquivalentMemberExp(a, b) {
|
|
237
227
|
}
|
238
228
|
});
|
239
229
|
}
|
240
|
-
var isEqEqEq = (0,
|
230
|
+
var isEqEqEq = (0, import_lodash_es.matches)({ type: "BinaryExpression", operator: "===" });
|
241
231
|
var isMinus = (node) => node.type === "UnaryExpression" && node.operator === "-";
|
242
232
|
var comparisonType = {
|
243
233
|
exact: 0,
|
@@ -247,11 +237,11 @@ var comparisonType = {
|
|
247
237
|
};
|
248
238
|
var comparisonOperators = ["==", "!=", "===", "!=="];
|
249
239
|
function getIsValue(value2) {
|
250
|
-
return value2 < 0 ? (0,
|
240
|
+
return value2 < 0 ? (0, import_lodash_es.overEvery)(isMinus, (0, import_lodash_es.matches)({ argument: { value: -value2 } })) : (0, import_lodash_es.matches)({ value: value2 });
|
251
241
|
}
|
252
242
|
function getExpressionComparedToInt(node, value2, checkOver) {
|
253
243
|
const isValue = getIsValue(value2);
|
254
|
-
if ((0,
|
244
|
+
if ((0, import_lodash_es.includes)(comparisonOperators, node.operator)) {
|
255
245
|
if (isValue(node.right)) {
|
256
246
|
return node.left;
|
257
247
|
}
|
@@ -283,13 +273,13 @@ function collectParameterValues(node) {
|
|
283
273
|
return [node.name];
|
284
274
|
}
|
285
275
|
case "ObjectPattern": {
|
286
|
-
return (0,
|
276
|
+
return (0, import_lodash_es.flatMap)(
|
287
277
|
node.properties,
|
288
278
|
(prop) => collectParameterValues(prop.value)
|
289
279
|
);
|
290
280
|
}
|
291
281
|
case "ArrayPattern": {
|
292
|
-
return (0,
|
282
|
+
return (0, import_lodash_es.flatMap)(node.elements, collectParameterValues);
|
293
283
|
}
|
294
284
|
default: {
|
295
285
|
return [];
|
@@ -331,7 +321,7 @@ function getDocsUrl(ruleName) {
|
|
331
321
|
}
|
332
322
|
|
333
323
|
// src/util/methodDataUtil.ts
|
334
|
-
var
|
324
|
+
var import_lodash_es2 = require("lodash-es");
|
335
325
|
|
336
326
|
// src/util/methodData.ts
|
337
327
|
var methodData_exports = {};
|
@@ -2755,16 +2745,16 @@ var zipWith = {
|
|
2755
2745
|
|
2756
2746
|
// src/util/methodDataUtil.ts
|
2757
2747
|
function isCollectionMethod(method2) {
|
2758
|
-
return methodSupportsShorthand(method2) || (0,
|
2748
|
+
return methodSupportsShorthand(method2) || (0, import_lodash_es2.includes)(["reduce", "reduceRight"], method2);
|
2759
2749
|
}
|
2760
2750
|
function methodSupportsShorthand(method2, shorthandType) {
|
2761
|
-
const methodShorthandData = (0,
|
2762
|
-
return (0,
|
2751
|
+
const methodShorthandData = (0, import_lodash_es2.get)(methodData_exports, `${method2}.shorthand`);
|
2752
|
+
return (0, import_lodash_es2.isObject)(methodShorthandData) ? Boolean(shorthandType && methodShorthandData[shorthandType]) : Boolean(methodShorthandData);
|
2763
2753
|
}
|
2764
2754
|
function getIterateeIndex(method2) {
|
2765
2755
|
const methodData = methodData_exports[method2];
|
2766
2756
|
if (methodData) {
|
2767
|
-
if ((0,
|
2757
|
+
if ((0, import_lodash_es2.has)(methodData, "iterateeIndex")) {
|
2768
2758
|
return methodData.iterateeIndex;
|
2769
2759
|
}
|
2770
2760
|
if (methodData.iteratee) {
|
@@ -2786,20 +2776,20 @@ function getSideEffectIterationMethods() {
|
|
2786
2776
|
}
|
2787
2777
|
|
2788
2778
|
// src/util/remedaUtil.ts
|
2789
|
-
var
|
2779
|
+
var import_lodash_es5 = require("lodash-es");
|
2790
2780
|
|
2791
2781
|
// src/util/settingsUtil.ts
|
2792
|
-
var
|
2782
|
+
var import_lodash_es3 = require("lodash-es");
|
2793
2783
|
function getSettings(context) {
|
2794
|
-
return (0,
|
2784
|
+
return (0, import_lodash_es3.chain)(context).get(["settings", "remeda"]).clone().defaults({
|
2795
2785
|
version: 4
|
2796
2786
|
}).value();
|
2797
2787
|
}
|
2798
2788
|
|
2799
2789
|
// src/util/importUtil.ts
|
2800
|
-
var
|
2790
|
+
var import_lodash_es4 = require("lodash-es");
|
2801
2791
|
function getNameFromCjsRequire(init) {
|
2802
|
-
if ((0,
|
2792
|
+
if ((0, import_lodash_es4.get)(init, "callee.name") === "require" && (0, import_lodash_es4.get)(init, "arguments.length") === 1 && init.arguments[0].type === "Literal") {
|
2803
2793
|
return init.arguments[0].value;
|
2804
2794
|
}
|
2805
2795
|
}
|
@@ -2943,7 +2933,7 @@ function getIsTypeMethod(name) {
|
|
2943
2933
|
"Error"
|
2944
2934
|
// "Element",
|
2945
2935
|
];
|
2946
|
-
return (0,
|
2936
|
+
return (0, import_lodash_es5.includes)(types, name) ? `is${(0, import_lodash_es5.capitalize)(name)}` : null;
|
2947
2937
|
}
|
2948
2938
|
function getRemedaMethodCallExpVisitor(remedaContext, reporter) {
|
2949
2939
|
return function(node) {
|
@@ -3005,7 +2995,7 @@ function create2(context) {
|
|
3005
2995
|
return node.parent.type !== "ExpressionStatement";
|
3006
2996
|
}
|
3007
2997
|
function isSideEffectIterationMethod(method2) {
|
3008
|
-
return (0,
|
2998
|
+
return (0, import_lodash_es6.includes)(getSideEffectIterationMethods(), method2);
|
3009
2999
|
}
|
3010
3000
|
function isParentCommit(node, callType) {
|
3011
3001
|
return callType === "chained" && isCallToMethod(node.parent.parent, "commit");
|
@@ -3035,7 +3025,7 @@ var RULE_NAME = "collection-method-value";
|
|
3035
3025
|
var collection_method_value_default = rule;
|
3036
3026
|
|
3037
3027
|
// src/rules/collection-return.ts
|
3038
|
-
var
|
3028
|
+
var import_lodash_es7 = require("lodash-es");
|
3039
3029
|
var meta2 = {
|
3040
3030
|
type: "problem",
|
3041
3031
|
schema: [],
|
@@ -3047,7 +3037,7 @@ function create3(context) {
|
|
3047
3037
|
const funcInfos = /* @__PURE__ */ new Map();
|
3048
3038
|
let currFuncInfo;
|
3049
3039
|
const remedaContext = getRemedaContext(context);
|
3050
|
-
return (0,
|
3040
|
+
return (0, import_lodash_es7.assign)(
|
3051
3041
|
{
|
3052
3042
|
"CallExpression:exit": getRemedaMethodCallExpVisitor(
|
3053
3043
|
remedaContext,
|
@@ -3420,7 +3410,7 @@ var RULE_NAME8 = "prefer-is-empty";
|
|
3420
3410
|
var prefer_is_empty_default = rule8;
|
3421
3411
|
|
3422
3412
|
// src/rules/prefer-is-nil.ts
|
3423
|
-
var
|
3413
|
+
var import_lodash_es8 = require("lodash-es");
|
3424
3414
|
var { isNegationExpression: isNegationExpression2, isEquivalentMemberExp: isEquivalentMemberExp2 } = astUtil_default;
|
3425
3415
|
var meta9 = {
|
3426
3416
|
type: "problem",
|
@@ -3433,14 +3423,14 @@ function create10(context) {
|
|
3433
3423
|
const remedaContext = getRemedaContext(context);
|
3434
3424
|
const nilChecks = {
|
3435
3425
|
null: {
|
3436
|
-
isValue: (0,
|
3426
|
+
isValue: (0, import_lodash_es8.matches)({ type: "Literal", value: null }),
|
3437
3427
|
expressionChecks: [
|
3438
3428
|
getRemedaTypeCheckedBy("isNull"),
|
3439
3429
|
getValueComparedTo("null")
|
3440
3430
|
]
|
3441
3431
|
},
|
3442
3432
|
undefined: {
|
3443
|
-
isValue: (0,
|
3433
|
+
isValue: (0, import_lodash_es8.matches)({ type: "Identifier", name: "undefined" }),
|
3444
3434
|
expressionChecks: [
|
3445
3435
|
getRemedaTypeCheckedBy("isUndefined"),
|
3446
3436
|
getValueComparedTo("undefined"),
|
@@ -3458,13 +3448,13 @@ function create10(context) {
|
|
3458
3448
|
return node.type === "BinaryExpression" && node.operator === operator && (nilChecks[nil].isValue(node.right) && node.left || nilChecks[nil].isValue(node.left) && node.right);
|
3459
3449
|
};
|
3460
3450
|
}
|
3461
|
-
const getTypeofArgument = (0,
|
3451
|
+
const getTypeofArgument = (0, import_lodash_es8.cond)([
|
3462
3452
|
[
|
3463
|
-
(0,
|
3464
|
-
(0,
|
3453
|
+
(0, import_lodash_es8.matches)({ type: "UnaryExpression", operator: "typeof" }),
|
3454
|
+
(0, import_lodash_es8.property)("argument")
|
3465
3455
|
]
|
3466
3456
|
]);
|
3467
|
-
const isUndefinedString = (0,
|
3457
|
+
const isUndefinedString = (0, import_lodash_es8.matches)({
|
3468
3458
|
type: "Literal",
|
3469
3459
|
value: "undefined"
|
3470
3460
|
});
|
@@ -3472,7 +3462,11 @@ function create10(context) {
|
|
3472
3462
|
return node.type === "BinaryExpression" && node.operator === operator && (isUndefinedString(node.right) && getTypeofArgument(node.left) || isUndefinedString(node.left) && getTypeofArgument(node.right));
|
3473
3463
|
}
|
3474
3464
|
function checkExpression(nil, operator, node) {
|
3475
|
-
|
3465
|
+
const mappedValues = (0, import_lodash_es8.map)(
|
3466
|
+
nilChecks[nil].expressionChecks,
|
3467
|
+
(check) => check(node, operator)
|
3468
|
+
);
|
3469
|
+
return (0, import_lodash_es8.find)(mappedValues);
|
3476
3470
|
}
|
3477
3471
|
function checkNegatedExpression(nil, node) {
|
3478
3472
|
return isNegationExpression2(node) && checkExpression(nil, "===", node.argument) || checkExpression(nil, "!==", node);
|
@@ -3517,7 +3511,7 @@ var RULE_NAME9 = "prefer-is-nil";
|
|
3517
3511
|
var prefer_is_nil_default = rule9;
|
3518
3512
|
|
3519
3513
|
// src/rules/prefer-map.ts
|
3520
|
-
var
|
3514
|
+
var import_lodash_es9 = require("lodash-es");
|
3521
3515
|
var {
|
3522
3516
|
getFirstFunctionLine: getFirstFunctionLine4,
|
3523
3517
|
hasOnlyOneStatement: hasOnlyOneStatement3,
|
@@ -3535,14 +3529,14 @@ var meta10 = {
|
|
3535
3529
|
function create11(context) {
|
3536
3530
|
function onlyHasPush(func) {
|
3537
3531
|
const firstLine = getFirstFunctionLine4(func);
|
3538
|
-
const firstParam = (0,
|
3532
|
+
const firstParam = (0, import_lodash_es9.get)(func, "params[0]");
|
3539
3533
|
const exp = func && !isFunctionDefinitionWithBlock2(func) ? firstLine : (
|
3540
3534
|
//@ts-expect-error
|
3541
3535
|
firstLine?.expression
|
3542
3536
|
);
|
3543
|
-
return func && hasOnlyOneStatement3(func) && getMethodName3(exp) === "push" && !(0,
|
3537
|
+
return func && hasOnlyOneStatement3(func) && getMethodName3(exp) === "push" && !(0, import_lodash_es9.includes)(
|
3544
3538
|
collectParameterValues2(firstParam),
|
3545
|
-
(0,
|
3539
|
+
(0, import_lodash_es9.get)(exp, "callee.object.name")
|
3546
3540
|
);
|
3547
3541
|
}
|
3548
3542
|
return getRemedaMethodVisitors(context, (node, iteratee2, { method: method2 }) => {
|
@@ -3610,7 +3604,7 @@ var RULE_NAME11 = "prefer-nullish-coalescing";
|
|
3610
3604
|
var prefer_nullish_coalescing_default = rule11;
|
3611
3605
|
|
3612
3606
|
// src/rules/prefer-remeda-typecheck.ts
|
3613
|
-
var
|
3607
|
+
var import_lodash_es10 = require("lodash-es");
|
3614
3608
|
var meta12 = {
|
3615
3609
|
type: "problem",
|
3616
3610
|
schema: [],
|
@@ -3633,7 +3627,7 @@ function create13(context) {
|
|
3633
3627
|
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
3634
3628
|
const scope = sourceCode?.getScope?.(node);
|
3635
3629
|
const definedVariables = scope.variables;
|
3636
|
-
return (0,
|
3630
|
+
return (0, import_lodash_es10.some)(definedVariables, { name: node.name });
|
3637
3631
|
}
|
3638
3632
|
function getValueForSide(node, side) {
|
3639
3633
|
const otherSide = otherSides[side];
|
@@ -3713,7 +3707,7 @@ var RULE_NAME13 = "prefer-some";
|
|
3713
3707
|
var prefer_some_default = rule13;
|
3714
3708
|
|
3715
3709
|
// src/rules/prefer-times.ts
|
3716
|
-
var
|
3710
|
+
var import_lodash_es11 = require("lodash-es");
|
3717
3711
|
var meta14 = {
|
3718
3712
|
type: "problem",
|
3719
3713
|
schema: [],
|
@@ -3723,7 +3717,7 @@ var meta14 = {
|
|
3723
3717
|
};
|
3724
3718
|
function create15(context) {
|
3725
3719
|
return getRemedaMethodVisitors(context, (node, iteratee2, { method: method2 }) => {
|
3726
|
-
if (method2 === "map" && (0,
|
3720
|
+
if (method2 === "map" && (0, import_lodash_es11.get)(iteratee2, "params.length") === 0) {
|
3727
3721
|
context.report({
|
3728
3722
|
node,
|
3729
3723
|
message: "Prefer R.times over R.map without using arguments"
|
@@ -3764,7 +3758,7 @@ var plugin = {
|
|
3764
3758
|
configs: {},
|
3765
3759
|
processors: {}
|
3766
3760
|
};
|
3767
|
-
var pluginShortName = (0,
|
3761
|
+
var pluginShortName = (0, import_lodash_es12.last)(plugin.meta.name.split("-"));
|
3768
3762
|
Object.assign(plugin.configs, {
|
3769
3763
|
recommended: {
|
3770
3764
|
plugins: {
|
package/dist/index.js
CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
5
5
|
};
|
6
6
|
|
7
7
|
// src/index.ts
|
8
|
-
import { last as last2 } from "lodash";
|
8
|
+
import { last as last2 } from "lodash-es";
|
9
9
|
|
10
10
|
// package.json
|
11
11
|
var version = "0.0.0-development";
|
@@ -52,7 +52,7 @@ var package_default = {
|
|
52
52
|
},
|
53
53
|
devDependencies: {
|
54
54
|
"@arethetypeswrong/cli": "^0.15.4",
|
55
|
-
"@types/lodash": "^4.17.
|
55
|
+
"@types/lodash-es": "^4.17.12",
|
56
56
|
"@types/node": "^20.14.9",
|
57
57
|
"@vitest/coverage-v8": "^2.0.3",
|
58
58
|
"@vitest/ui": "^2.0.3",
|
@@ -87,12 +87,12 @@ var package_default = {
|
|
87
87
|
],
|
88
88
|
license: "MIT",
|
89
89
|
dependencies: {
|
90
|
-
lodash: "^4.17.21"
|
90
|
+
"lodash-es": "^4.17.21"
|
91
91
|
}
|
92
92
|
};
|
93
93
|
|
94
94
|
// src/rules/collection-method-value.ts
|
95
|
-
import { includes as includes5 } from "lodash";
|
95
|
+
import { includes as includes5 } from "lodash-es";
|
96
96
|
|
97
97
|
// src/util/astUtil.ts
|
98
98
|
import {
|
@@ -107,7 +107,7 @@ import {
|
|
107
107
|
overEvery,
|
108
108
|
overSome,
|
109
109
|
property
|
110
|
-
} from "lodash";
|
110
|
+
} from "lodash-es";
|
111
111
|
var getCaller = property(["callee", "object"]);
|
112
112
|
var getMethodName = property(["callee", "property", "name"]);
|
113
113
|
var isMethodCall = matches({
|
@@ -315,7 +315,7 @@ function getDocsUrl(ruleName) {
|
|
315
315
|
}
|
316
316
|
|
317
317
|
// src/util/methodDataUtil.ts
|
318
|
-
import { get as get3, has as has2, includes as includes3, isObject as isObject2 } from "lodash";
|
318
|
+
import { get as get3, has as has2, includes as includes3, isObject as isObject2 } from "lodash-es";
|
319
319
|
|
320
320
|
// src/util/methodData.ts
|
321
321
|
var methodData_exports = {};
|
@@ -2770,10 +2770,10 @@ function getSideEffectIterationMethods() {
|
|
2770
2770
|
}
|
2771
2771
|
|
2772
2772
|
// src/util/remedaUtil.ts
|
2773
|
-
import { capitalize as capitalize2, includes as includes4 } from "lodash";
|
2773
|
+
import { capitalize as capitalize2, includes as includes4 } from "lodash-es";
|
2774
2774
|
|
2775
2775
|
// src/util/settingsUtil.ts
|
2776
|
-
import { chain as chain2, get as get4 } from "lodash";
|
2776
|
+
import { chain as chain2, get as get4 } from "lodash-es";
|
2777
2777
|
function getSettings(context) {
|
2778
2778
|
return chain2(context).get(["settings", "remeda"]).clone().defaults({
|
2779
2779
|
version: 4
|
@@ -2781,7 +2781,7 @@ function getSettings(context) {
|
|
2781
2781
|
}
|
2782
2782
|
|
2783
2783
|
// src/util/importUtil.ts
|
2784
|
-
import { get as get5 } from "lodash";
|
2784
|
+
import { get as get5 } from "lodash-es";
|
2785
2785
|
function getNameFromCjsRequire(init) {
|
2786
2786
|
if (get5(init, "callee.name") === "require" && get5(init, "arguments.length") === 1 && init.arguments[0].type === "Literal") {
|
2787
2787
|
return init.arguments[0].value;
|
@@ -3019,7 +3019,7 @@ var RULE_NAME = "collection-method-value";
|
|
3019
3019
|
var collection_method_value_default = rule;
|
3020
3020
|
|
3021
3021
|
// src/rules/collection-return.ts
|
3022
|
-
import { assign as assign2 } from "lodash";
|
3022
|
+
import { assign as assign2 } from "lodash-es";
|
3023
3023
|
var meta2 = {
|
3024
3024
|
type: "problem",
|
3025
3025
|
schema: [],
|
@@ -3404,7 +3404,7 @@ var RULE_NAME8 = "prefer-is-empty";
|
|
3404
3404
|
var prefer_is_empty_default = rule8;
|
3405
3405
|
|
3406
3406
|
// src/rules/prefer-is-nil.ts
|
3407
|
-
import
|
3407
|
+
import { cond as cond3, find as find2, map as map2, matches as matches3, property as property3 } from "lodash-es";
|
3408
3408
|
var { isNegationExpression: isNegationExpression2, isEquivalentMemberExp: isEquivalentMemberExp2 } = astUtil_default;
|
3409
3409
|
var meta9 = {
|
3410
3410
|
type: "problem",
|
@@ -3456,7 +3456,11 @@ function create10(context) {
|
|
3456
3456
|
return node.type === "BinaryExpression" && node.operator === operator && (isUndefinedString(node.right) && getTypeofArgument(node.left) || isUndefinedString(node.left) && getTypeofArgument(node.right));
|
3457
3457
|
}
|
3458
3458
|
function checkExpression(nil, operator, node) {
|
3459
|
-
|
3459
|
+
const mappedValues = map2(
|
3460
|
+
nilChecks[nil].expressionChecks,
|
3461
|
+
(check) => check(node, operator)
|
3462
|
+
);
|
3463
|
+
return find2(mappedValues);
|
3460
3464
|
}
|
3461
3465
|
function checkNegatedExpression(nil, node) {
|
3462
3466
|
return isNegationExpression2(node) && checkExpression(nil, "===", node.argument) || checkExpression(nil, "!==", node);
|
@@ -3501,7 +3505,7 @@ var RULE_NAME9 = "prefer-is-nil";
|
|
3501
3505
|
var prefer_is_nil_default = rule9;
|
3502
3506
|
|
3503
3507
|
// src/rules/prefer-map.ts
|
3504
|
-
import { get as get6, includes as includes6 } from "lodash";
|
3508
|
+
import { get as get6, includes as includes6 } from "lodash-es";
|
3505
3509
|
var {
|
3506
3510
|
getFirstFunctionLine: getFirstFunctionLine4,
|
3507
3511
|
hasOnlyOneStatement: hasOnlyOneStatement3,
|
@@ -3594,7 +3598,7 @@ var RULE_NAME11 = "prefer-nullish-coalescing";
|
|
3594
3598
|
var prefer_nullish_coalescing_default = rule11;
|
3595
3599
|
|
3596
3600
|
// src/rules/prefer-remeda-typecheck.ts
|
3597
|
-
import { some as some2 } from "lodash";
|
3601
|
+
import { some as some2 } from "lodash-es";
|
3598
3602
|
var meta12 = {
|
3599
3603
|
type: "problem",
|
3600
3604
|
schema: [],
|
@@ -3697,7 +3701,7 @@ var RULE_NAME13 = "prefer-some";
|
|
3697
3701
|
var prefer_some_default = rule13;
|
3698
3702
|
|
3699
3703
|
// src/rules/prefer-times.ts
|
3700
|
-
import { get as get7 } from "lodash";
|
3704
|
+
import { get as get7 } from "lodash-es";
|
3701
3705
|
var meta14 = {
|
3702
3706
|
type: "problem",
|
3703
3707
|
schema: [],
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint-plugin-remeda",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.4.0",
|
4
4
|
"author": "Andrea Pontrandolfo <andrea.pontra@gmail.com>",
|
5
5
|
"description": "ESLint plugin for Remeda library.",
|
6
6
|
"type": "module",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
43
|
"@arethetypeswrong/cli": "^0.15.4",
|
44
|
-
"@types/lodash": "^4.17.
|
44
|
+
"@types/lodash-es": "^4.17.12",
|
45
45
|
"@types/node": "^20.14.9",
|
46
46
|
"@vitest/coverage-v8": "^2.0.3",
|
47
47
|
"@vitest/ui": "^2.0.3",
|
@@ -76,6 +76,6 @@
|
|
76
76
|
],
|
77
77
|
"license": "MIT",
|
78
78
|
"dependencies": {
|
79
|
-
"lodash": "^4.17.21"
|
79
|
+
"lodash-es": "^4.17.21"
|
80
80
|
}
|
81
81
|
}
|