eslint-plugin-remeda 1.3.0 → 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 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 import_lodash7 = __toESM(require("lodash"), 1);
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.7",
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 import_includes = __toESM(require("lodash/includes"), 1);
113
+ var import_lodash_es6 = require("lodash-es");
124
114
 
125
115
  // src/util/astUtil.ts
126
- var import_lodash = require("lodash");
127
- var getCaller = (0, import_lodash.property)(["callee", "object"]);
128
- var getMethodName = (0, import_lodash.property)(["callee", "property", "name"]);
129
- var isMethodCall = (0, import_lodash.matches)({
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, import_lodash.overSome)(
134
- (0, import_lodash.matchesProperty)("type", "FunctionExpression"),
135
- (0, import_lodash.matchesProperty)("type", "FunctionDeclaration")
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, import_lodash.overSome)(
127
+ var isFunctionDefinitionWithBlock = (0, import_lodash_es.overSome)(
138
128
  isFunctionExpression,
139
- (0, import_lodash.matches)({
129
+ (0, import_lodash_es.matches)({
140
130
  type: "ArrowFunctionExpression",
141
131
  body: { type: "BlockStatement" }
142
132
  })
143
133
  );
144
- var getFirstFunctionLine = (0, import_lodash.cond)([
145
- [isFunctionDefinitionWithBlock, (0, import_lodash.property)(["body", "body", 0])],
146
- [(0, import_lodash.matches)({ type: "ArrowFunctionExpression" }), (0, import_lodash.property)("body")]
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, import_lodash.overSome)(
149
- (0, import_lodash.matches)({ computed: false }),
150
- (0, import_lodash.matchesProperty)(["property", "type"], "Literal")
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, import_lodash.property)(["params", 0, "name"]);
170
- var isReturnStatement = (0, import_lodash.matchesProperty)("type", "ReturnStatement");
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, import_lodash.get)(func, "body.body.length") === 1;
163
+ return (0, import_lodash_es.get)(func, "body.body.length") === 1;
174
164
  }
175
165
  if (func.type === "ArrowFunctionExpression") {
176
- return !(0, import_lodash.get)(func, "body.body");
166
+ return !(0, import_lodash_es.get)(func, "body.body");
177
167
  }
178
168
  }
179
169
  function isObjectOfMethodCall(node) {
180
- return (0, import_lodash.get)(node, "parent.object") === node && (0, import_lodash.get)(node, "parent.parent.type") === "CallExpression";
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, import_lodash.isMatch)(exp, { type: "BinaryExpression", operator })) {
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, import_lodash.matches)({
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, import_lodash.get)(node, "callee.object.name") === objName;
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, import_lodash.get)(node, "computed") && node.property.type !== "Literal";
213
+ return (0, import_lodash_es.get)(node, "computed") && node.property.type !== "Literal";
224
214
  }
225
215
  function isEquivalentMemberExp(a, b) {
226
- return (0, import_lodash.isEqualWith)(a, b, (left, right, key) => {
227
- if ((0, import_lodash.includes)(["loc", "range", "computed", "start", "end", "parent"], key)) {
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, import_lodash.matches)({ type: "BinaryExpression", operator: "===" });
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, import_lodash.overEvery)(isMinus, (0, import_lodash.matches)({ argument: { value: -value2 } })) : (0, import_lodash.matches)({ value: value2 });
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, import_lodash.includes)(comparisonOperators, node.operator)) {
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, import_lodash.flatMap)(
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, import_lodash.flatMap)(node.elements, collectParameterValues);
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 import_lodash2 = require("lodash");
324
+ var import_lodash_es2 = require("lodash-es");
335
325
 
336
326
  // src/util/methodData.ts
337
327
  var methodData_exports = {};
@@ -2755,19 +2745,21 @@ var zipWith = {
2755
2745
 
2756
2746
  // src/util/methodDataUtil.ts
2757
2747
  function isCollectionMethod(method2) {
2758
- return methodSupportsShorthand(method2) || (0, import_lodash2.includes)(["reduce", "reduceRight"], method2);
2748
+ return methodSupportsShorthand(method2) || (0, import_lodash_es2.includes)(["reduce", "reduceRight"], method2);
2759
2749
  }
2760
2750
  function methodSupportsShorthand(method2, shorthandType) {
2761
- const methodShorthandData = (0, import_lodash2.get)(methodData_exports, `${method2}.shorthand`);
2762
- return (0, import_lodash2.isObject)(methodShorthandData) ? Boolean(shorthandType && methodShorthandData[shorthandType]) : Boolean(methodShorthandData);
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
- if ((0, import_lodash2.has)(methodData, "iterateeIndex")) {
2767
- return methodData.iterateeIndex;
2768
- }
2769
- if (methodData.iteratee) {
2770
- return 1;
2756
+ if (methodData) {
2757
+ if ((0, import_lodash_es2.has)(methodData, "iterateeIndex")) {
2758
+ return methodData.iterateeIndex;
2759
+ }
2760
+ if (methodData.iteratee) {
2761
+ return 1;
2762
+ }
2771
2763
  }
2772
2764
  return -1;
2773
2765
  }
@@ -2784,20 +2776,20 @@ function getSideEffectIterationMethods() {
2784
2776
  }
2785
2777
 
2786
2778
  // src/util/remedaUtil.ts
2787
- var import_lodash4 = require("lodash");
2779
+ var import_lodash_es5 = require("lodash-es");
2788
2780
 
2789
2781
  // src/util/settingsUtil.ts
2790
- var import_lodash3 = require("lodash");
2782
+ var import_lodash_es3 = require("lodash-es");
2791
2783
  function getSettings(context) {
2792
- return (0, import_lodash3.chain)(context).get(["settings", "remeda"]).clone().defaults({
2784
+ return (0, import_lodash_es3.chain)(context).get(["settings", "remeda"]).clone().defaults({
2793
2785
  version: 4
2794
2786
  }).value();
2795
2787
  }
2796
2788
 
2797
2789
  // src/util/importUtil.ts
2798
- var import_get = __toESM(require("lodash/get"), 1);
2790
+ var import_lodash_es4 = require("lodash-es");
2799
2791
  function getNameFromCjsRequire(init) {
2800
- if ((0, import_get.default)(init, "callee.name") === "require" && (0, import_get.default)(init, "arguments.length") === 1 && init.arguments[0].type === "Literal") {
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") {
2801
2793
  return init.arguments[0].value;
2802
2794
  }
2803
2795
  }
@@ -2941,7 +2933,7 @@ function getIsTypeMethod(name) {
2941
2933
  "Error"
2942
2934
  // "Element",
2943
2935
  ];
2944
- return (0, import_lodash4.includes)(types, name) ? `is${(0, import_lodash4.capitalize)(name)}` : null;
2936
+ return (0, import_lodash_es5.includes)(types, name) ? `is${(0, import_lodash_es5.capitalize)(name)}` : null;
2945
2937
  }
2946
2938
  function getRemedaMethodCallExpVisitor(remedaContext, reporter) {
2947
2939
  return function(node) {
@@ -3003,7 +2995,7 @@ function create2(context) {
3003
2995
  return node.parent.type !== "ExpressionStatement";
3004
2996
  }
3005
2997
  function isSideEffectIterationMethod(method2) {
3006
- return (0, import_includes.default)(getSideEffectIterationMethods(), method2);
2998
+ return (0, import_lodash_es6.includes)(getSideEffectIterationMethods(), method2);
3007
2999
  }
3008
3000
  function isParentCommit(node, callType) {
3009
3001
  return callType === "chained" && isCallToMethod(node.parent.parent, "commit");
@@ -3033,7 +3025,7 @@ var RULE_NAME = "collection-method-value";
3033
3025
  var collection_method_value_default = rule;
3034
3026
 
3035
3027
  // src/rules/collection-return.ts
3036
- var import_assign = __toESM(require("lodash/assign"), 1);
3028
+ var import_lodash_es7 = require("lodash-es");
3037
3029
  var meta2 = {
3038
3030
  type: "problem",
3039
3031
  schema: [],
@@ -3045,7 +3037,7 @@ function create3(context) {
3045
3037
  const funcInfos = /* @__PURE__ */ new Map();
3046
3038
  let currFuncInfo;
3047
3039
  const remedaContext = getRemedaContext(context);
3048
- return (0, import_assign.default)(
3040
+ return (0, import_lodash_es7.assign)(
3049
3041
  {
3050
3042
  "CallExpression:exit": getRemedaMethodCallExpVisitor(
3051
3043
  remedaContext,
@@ -3418,7 +3410,7 @@ var RULE_NAME8 = "prefer-is-empty";
3418
3410
  var prefer_is_empty_default = rule8;
3419
3411
 
3420
3412
  // src/rules/prefer-is-nil.ts
3421
- var import_lodash5 = __toESM(require("lodash"), 1);
3413
+ var import_lodash_es8 = require("lodash-es");
3422
3414
  var { isNegationExpression: isNegationExpression2, isEquivalentMemberExp: isEquivalentMemberExp2 } = astUtil_default;
3423
3415
  var meta9 = {
3424
3416
  type: "problem",
@@ -3431,14 +3423,14 @@ function create10(context) {
3431
3423
  const remedaContext = getRemedaContext(context);
3432
3424
  const nilChecks = {
3433
3425
  null: {
3434
- isValue: (0, import_lodash5.matches)({ type: "Literal", value: null }),
3426
+ isValue: (0, import_lodash_es8.matches)({ type: "Literal", value: null }),
3435
3427
  expressionChecks: [
3436
3428
  getRemedaTypeCheckedBy("isNull"),
3437
3429
  getValueComparedTo("null")
3438
3430
  ]
3439
3431
  },
3440
3432
  undefined: {
3441
- isValue: (0, import_lodash5.matches)({ type: "Identifier", name: "undefined" }),
3433
+ isValue: (0, import_lodash_es8.matches)({ type: "Identifier", name: "undefined" }),
3442
3434
  expressionChecks: [
3443
3435
  getRemedaTypeCheckedBy("isUndefined"),
3444
3436
  getValueComparedTo("undefined"),
@@ -3456,13 +3448,13 @@ function create10(context) {
3456
3448
  return node.type === "BinaryExpression" && node.operator === operator && (nilChecks[nil].isValue(node.right) && node.left || nilChecks[nil].isValue(node.left) && node.right);
3457
3449
  };
3458
3450
  }
3459
- const getTypeofArgument = (0, import_lodash5.cond)([
3451
+ const getTypeofArgument = (0, import_lodash_es8.cond)([
3460
3452
  [
3461
- (0, import_lodash5.matches)({ type: "UnaryExpression", operator: "typeof" }),
3462
- (0, import_lodash5.property)("argument")
3453
+ (0, import_lodash_es8.matches)({ type: "UnaryExpression", operator: "typeof" }),
3454
+ (0, import_lodash_es8.property)("argument")
3463
3455
  ]
3464
3456
  ]);
3465
- const isUndefinedString = (0, import_lodash5.matches)({
3457
+ const isUndefinedString = (0, import_lodash_es8.matches)({
3466
3458
  type: "Literal",
3467
3459
  value: "undefined"
3468
3460
  });
@@ -3470,7 +3462,11 @@ function create10(context) {
3470
3462
  return node.type === "BinaryExpression" && node.operator === operator && (isUndefinedString(node.right) && getTypeofArgument(node.left) || isUndefinedString(node.left) && getTypeofArgument(node.right));
3471
3463
  }
3472
3464
  function checkExpression(nil, operator, node) {
3473
- return (0, import_lodash5.default)(nilChecks[nil].expressionChecks).map((check) => check(node, operator)).find();
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);
3474
3470
  }
3475
3471
  function checkNegatedExpression(nil, node) {
3476
3472
  return isNegationExpression2(node) && checkExpression(nil, "===", node.argument) || checkExpression(nil, "!==", node);
@@ -3515,8 +3511,7 @@ var RULE_NAME9 = "prefer-is-nil";
3515
3511
  var prefer_is_nil_default = rule9;
3516
3512
 
3517
3513
  // src/rules/prefer-map.ts
3518
- var import_get2 = __toESM(require("lodash/get"), 1);
3519
- var import_includes2 = __toESM(require("lodash/includes"), 1);
3514
+ var import_lodash_es9 = require("lodash-es");
3520
3515
  var {
3521
3516
  getFirstFunctionLine: getFirstFunctionLine4,
3522
3517
  hasOnlyOneStatement: hasOnlyOneStatement3,
@@ -3534,14 +3529,14 @@ var meta10 = {
3534
3529
  function create11(context) {
3535
3530
  function onlyHasPush(func) {
3536
3531
  const firstLine = getFirstFunctionLine4(func);
3537
- const firstParam = (0, import_get2.default)(func, "params[0]");
3532
+ const firstParam = (0, import_lodash_es9.get)(func, "params[0]");
3538
3533
  const exp = func && !isFunctionDefinitionWithBlock2(func) ? firstLine : (
3539
3534
  //@ts-expect-error
3540
3535
  firstLine?.expression
3541
3536
  );
3542
- return func && hasOnlyOneStatement3(func) && getMethodName3(exp) === "push" && !(0, import_includes2.default)(
3537
+ return func && hasOnlyOneStatement3(func) && getMethodName3(exp) === "push" && !(0, import_lodash_es9.includes)(
3543
3538
  collectParameterValues2(firstParam),
3544
- (0, import_get2.default)(exp, "callee.object.name")
3539
+ (0, import_lodash_es9.get)(exp, "callee.object.name")
3545
3540
  );
3546
3541
  }
3547
3542
  return getRemedaMethodVisitors(context, (node, iteratee2, { method: method2 }) => {
@@ -3609,7 +3604,7 @@ var RULE_NAME11 = "prefer-nullish-coalescing";
3609
3604
  var prefer_nullish_coalescing_default = rule11;
3610
3605
 
3611
3606
  // src/rules/prefer-remeda-typecheck.ts
3612
- var import_some = __toESM(require("lodash/some"), 1);
3607
+ var import_lodash_es10 = require("lodash-es");
3613
3608
  var meta12 = {
3614
3609
  type: "problem",
3615
3610
  schema: [],
@@ -3632,7 +3627,7 @@ function create13(context) {
3632
3627
  const sourceCode = context.sourceCode ?? context.getSourceCode();
3633
3628
  const scope = sourceCode?.getScope?.(node);
3634
3629
  const definedVariables = scope.variables;
3635
- return (0, import_some.default)(definedVariables, { name: node.name });
3630
+ return (0, import_lodash_es10.some)(definedVariables, { name: node.name });
3636
3631
  }
3637
3632
  function getValueForSide(node, side) {
3638
3633
  const otherSide = otherSides[side];
@@ -3712,7 +3707,7 @@ var RULE_NAME13 = "prefer-some";
3712
3707
  var prefer_some_default = rule13;
3713
3708
 
3714
3709
  // src/rules/prefer-times.ts
3715
- var import_lodash6 = require("lodash");
3710
+ var import_lodash_es11 = require("lodash-es");
3716
3711
  var meta14 = {
3717
3712
  type: "problem",
3718
3713
  schema: [],
@@ -3722,7 +3717,7 @@ var meta14 = {
3722
3717
  };
3723
3718
  function create15(context) {
3724
3719
  return getRemedaMethodVisitors(context, (node, iteratee2, { method: method2 }) => {
3725
- if (method2 === "map" && (0, import_lodash6.get)(iteratee2, "params.length") === 0) {
3720
+ if (method2 === "map" && (0, import_lodash_es11.get)(iteratee2, "params.length") === 0) {
3726
3721
  context.report({
3727
3722
  node,
3728
3723
  message: "Prefer R.times over R.map without using arguments"
@@ -3763,7 +3758,7 @@ var plugin = {
3763
3758
  configs: {},
3764
3759
  processors: {}
3765
3760
  };
3766
- var pluginShortName = import_lodash7.default.last(plugin.meta.name.split("-"));
3761
+ var pluginShortName = (0, import_lodash_es12.last)(plugin.meta.name.split("-"));
3767
3762
  Object.assign(plugin.configs, {
3768
3763
  recommended: {
3769
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 _2 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.7",
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 includes5 from "lodash/includes";
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 = {};
@@ -2747,11 +2747,13 @@ function methodSupportsShorthand(method2, shorthandType) {
2747
2747
  }
2748
2748
  function getIterateeIndex(method2) {
2749
2749
  const methodData = methodData_exports[method2];
2750
- if (has2(methodData, "iterateeIndex")) {
2751
- return methodData.iterateeIndex;
2752
- }
2753
- if (methodData.iteratee) {
2754
- return 1;
2750
+ if (methodData) {
2751
+ if (has2(methodData, "iterateeIndex")) {
2752
+ return methodData.iterateeIndex;
2753
+ }
2754
+ if (methodData.iteratee) {
2755
+ return 1;
2756
+ }
2755
2757
  }
2756
2758
  return -1;
2757
2759
  }
@@ -2768,10 +2770,10 @@ function getSideEffectIterationMethods() {
2768
2770
  }
2769
2771
 
2770
2772
  // src/util/remedaUtil.ts
2771
- import { capitalize as capitalize2, includes as includes4 } from "lodash";
2773
+ import { capitalize as capitalize2, includes as includes4 } from "lodash-es";
2772
2774
 
2773
2775
  // src/util/settingsUtil.ts
2774
- import { chain as chain2, get as get4 } from "lodash";
2776
+ import { chain as chain2, get as get4 } from "lodash-es";
2775
2777
  function getSettings(context) {
2776
2778
  return chain2(context).get(["settings", "remeda"]).clone().defaults({
2777
2779
  version: 4
@@ -2779,7 +2781,7 @@ function getSettings(context) {
2779
2781
  }
2780
2782
 
2781
2783
  // src/util/importUtil.ts
2782
- import get5 from "lodash/get";
2784
+ import { get as get5 } from "lodash-es";
2783
2785
  function getNameFromCjsRequire(init) {
2784
2786
  if (get5(init, "callee.name") === "require" && get5(init, "arguments.length") === 1 && init.arguments[0].type === "Literal") {
2785
2787
  return init.arguments[0].value;
@@ -3017,7 +3019,7 @@ var RULE_NAME = "collection-method-value";
3017
3019
  var collection_method_value_default = rule;
3018
3020
 
3019
3021
  // src/rules/collection-return.ts
3020
- import assign2 from "lodash/assign";
3022
+ import { assign as assign2 } from "lodash-es";
3021
3023
  var meta2 = {
3022
3024
  type: "problem",
3023
3025
  schema: [],
@@ -3402,7 +3404,7 @@ var RULE_NAME8 = "prefer-is-empty";
3402
3404
  var prefer_is_empty_default = rule8;
3403
3405
 
3404
3406
  // src/rules/prefer-is-nil.ts
3405
- import _, { cond as cond3, matches as matches3, property as property3 } from "lodash";
3407
+ import { cond as cond3, find as find2, map as map2, matches as matches3, property as property3 } from "lodash-es";
3406
3408
  var { isNegationExpression: isNegationExpression2, isEquivalentMemberExp: isEquivalentMemberExp2 } = astUtil_default;
3407
3409
  var meta9 = {
3408
3410
  type: "problem",
@@ -3454,7 +3456,11 @@ function create10(context) {
3454
3456
  return node.type === "BinaryExpression" && node.operator === operator && (isUndefinedString(node.right) && getTypeofArgument(node.left) || isUndefinedString(node.left) && getTypeofArgument(node.right));
3455
3457
  }
3456
3458
  function checkExpression(nil, operator, node) {
3457
- return _(nilChecks[nil].expressionChecks).map((check) => check(node, operator)).find();
3459
+ const mappedValues = map2(
3460
+ nilChecks[nil].expressionChecks,
3461
+ (check) => check(node, operator)
3462
+ );
3463
+ return find2(mappedValues);
3458
3464
  }
3459
3465
  function checkNegatedExpression(nil, node) {
3460
3466
  return isNegationExpression2(node) && checkExpression(nil, "===", node.argument) || checkExpression(nil, "!==", node);
@@ -3499,8 +3505,7 @@ var RULE_NAME9 = "prefer-is-nil";
3499
3505
  var prefer_is_nil_default = rule9;
3500
3506
 
3501
3507
  // src/rules/prefer-map.ts
3502
- import get6 from "lodash/get";
3503
- import includes6 from "lodash/includes";
3508
+ import { get as get6, includes as includes6 } from "lodash-es";
3504
3509
  var {
3505
3510
  getFirstFunctionLine: getFirstFunctionLine4,
3506
3511
  hasOnlyOneStatement: hasOnlyOneStatement3,
@@ -3593,7 +3598,7 @@ var RULE_NAME11 = "prefer-nullish-coalescing";
3593
3598
  var prefer_nullish_coalescing_default = rule11;
3594
3599
 
3595
3600
  // src/rules/prefer-remeda-typecheck.ts
3596
- import some2 from "lodash/some";
3601
+ import { some as some2 } from "lodash-es";
3597
3602
  var meta12 = {
3598
3603
  type: "problem",
3599
3604
  schema: [],
@@ -3696,7 +3701,7 @@ var RULE_NAME13 = "prefer-some";
3696
3701
  var prefer_some_default = rule13;
3697
3702
 
3698
3703
  // src/rules/prefer-times.ts
3699
- import { get as get7 } from "lodash";
3704
+ import { get as get7 } from "lodash-es";
3700
3705
  var meta14 = {
3701
3706
  type: "problem",
3702
3707
  schema: [],
@@ -3747,7 +3752,7 @@ var plugin = {
3747
3752
  configs: {},
3748
3753
  processors: {}
3749
3754
  };
3750
- var pluginShortName = _2.last(plugin.meta.name.split("-"));
3755
+ var pluginShortName = last2(plugin.meta.name.split("-"));
3751
3756
  Object.assign(plugin.configs, {
3752
3757
  recommended: {
3753
3758
  plugins: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-remeda",
3
- "version": "1.3.0",
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.7",
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
  }