eslint-plugin-remeda 1.3.0 → 1.3.1

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
@@ -33,7 +33,7 @@ __export(src_exports, {
33
33
  default: () => src_default
34
34
  });
35
35
  module.exports = __toCommonJS(src_exports);
36
- var import_lodash7 = __toESM(require("lodash"), 1);
36
+ var import_lodash12 = require("lodash");
37
37
 
38
38
  // package.json
39
39
  var version = "0.0.0-development";
@@ -120,7 +120,7 @@ var package_default = {
120
120
  };
121
121
 
122
122
  // src/rules/collection-method-value.ts
123
- var import_includes = __toESM(require("lodash/includes"), 1);
123
+ var import_lodash6 = require("lodash");
124
124
 
125
125
  // src/util/astUtil.ts
126
126
  var import_lodash = require("lodash");
@@ -2763,11 +2763,13 @@ function methodSupportsShorthand(method2, shorthandType) {
2763
2763
  }
2764
2764
  function getIterateeIndex(method2) {
2765
2765
  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;
2766
+ if (methodData) {
2767
+ if ((0, import_lodash2.has)(methodData, "iterateeIndex")) {
2768
+ return methodData.iterateeIndex;
2769
+ }
2770
+ if (methodData.iteratee) {
2771
+ return 1;
2772
+ }
2771
2773
  }
2772
2774
  return -1;
2773
2775
  }
@@ -2784,7 +2786,7 @@ function getSideEffectIterationMethods() {
2784
2786
  }
2785
2787
 
2786
2788
  // src/util/remedaUtil.ts
2787
- var import_lodash4 = require("lodash");
2789
+ var import_lodash5 = require("lodash");
2788
2790
 
2789
2791
  // src/util/settingsUtil.ts
2790
2792
  var import_lodash3 = require("lodash");
@@ -2795,9 +2797,9 @@ function getSettings(context) {
2795
2797
  }
2796
2798
 
2797
2799
  // src/util/importUtil.ts
2798
- var import_get = __toESM(require("lodash/get"), 1);
2800
+ var import_lodash4 = require("lodash");
2799
2801
  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") {
2802
+ if ((0, import_lodash4.get)(init, "callee.name") === "require" && (0, import_lodash4.get)(init, "arguments.length") === 1 && init.arguments[0].type === "Literal") {
2801
2803
  return init.arguments[0].value;
2802
2804
  }
2803
2805
  }
@@ -2941,7 +2943,7 @@ function getIsTypeMethod(name) {
2941
2943
  "Error"
2942
2944
  // "Element",
2943
2945
  ];
2944
- return (0, import_lodash4.includes)(types, name) ? `is${(0, import_lodash4.capitalize)(name)}` : null;
2946
+ return (0, import_lodash5.includes)(types, name) ? `is${(0, import_lodash5.capitalize)(name)}` : null;
2945
2947
  }
2946
2948
  function getRemedaMethodCallExpVisitor(remedaContext, reporter) {
2947
2949
  return function(node) {
@@ -3003,7 +3005,7 @@ function create2(context) {
3003
3005
  return node.parent.type !== "ExpressionStatement";
3004
3006
  }
3005
3007
  function isSideEffectIterationMethod(method2) {
3006
- return (0, import_includes.default)(getSideEffectIterationMethods(), method2);
3008
+ return (0, import_lodash6.includes)(getSideEffectIterationMethods(), method2);
3007
3009
  }
3008
3010
  function isParentCommit(node, callType) {
3009
3011
  return callType === "chained" && isCallToMethod(node.parent.parent, "commit");
@@ -3033,7 +3035,7 @@ var RULE_NAME = "collection-method-value";
3033
3035
  var collection_method_value_default = rule;
3034
3036
 
3035
3037
  // src/rules/collection-return.ts
3036
- var import_assign = __toESM(require("lodash/assign"), 1);
3038
+ var import_lodash7 = require("lodash");
3037
3039
  var meta2 = {
3038
3040
  type: "problem",
3039
3041
  schema: [],
@@ -3045,7 +3047,7 @@ function create3(context) {
3045
3047
  const funcInfos = /* @__PURE__ */ new Map();
3046
3048
  let currFuncInfo;
3047
3049
  const remedaContext = getRemedaContext(context);
3048
- return (0, import_assign.default)(
3050
+ return (0, import_lodash7.assign)(
3049
3051
  {
3050
3052
  "CallExpression:exit": getRemedaMethodCallExpVisitor(
3051
3053
  remedaContext,
@@ -3418,7 +3420,7 @@ var RULE_NAME8 = "prefer-is-empty";
3418
3420
  var prefer_is_empty_default = rule8;
3419
3421
 
3420
3422
  // src/rules/prefer-is-nil.ts
3421
- var import_lodash5 = __toESM(require("lodash"), 1);
3423
+ var import_lodash8 = __toESM(require("lodash"), 1);
3422
3424
  var { isNegationExpression: isNegationExpression2, isEquivalentMemberExp: isEquivalentMemberExp2 } = astUtil_default;
3423
3425
  var meta9 = {
3424
3426
  type: "problem",
@@ -3431,14 +3433,14 @@ function create10(context) {
3431
3433
  const remedaContext = getRemedaContext(context);
3432
3434
  const nilChecks = {
3433
3435
  null: {
3434
- isValue: (0, import_lodash5.matches)({ type: "Literal", value: null }),
3436
+ isValue: (0, import_lodash8.matches)({ type: "Literal", value: null }),
3435
3437
  expressionChecks: [
3436
3438
  getRemedaTypeCheckedBy("isNull"),
3437
3439
  getValueComparedTo("null")
3438
3440
  ]
3439
3441
  },
3440
3442
  undefined: {
3441
- isValue: (0, import_lodash5.matches)({ type: "Identifier", name: "undefined" }),
3443
+ isValue: (0, import_lodash8.matches)({ type: "Identifier", name: "undefined" }),
3442
3444
  expressionChecks: [
3443
3445
  getRemedaTypeCheckedBy("isUndefined"),
3444
3446
  getValueComparedTo("undefined"),
@@ -3456,13 +3458,13 @@ function create10(context) {
3456
3458
  return node.type === "BinaryExpression" && node.operator === operator && (nilChecks[nil].isValue(node.right) && node.left || nilChecks[nil].isValue(node.left) && node.right);
3457
3459
  };
3458
3460
  }
3459
- const getTypeofArgument = (0, import_lodash5.cond)([
3461
+ const getTypeofArgument = (0, import_lodash8.cond)([
3460
3462
  [
3461
- (0, import_lodash5.matches)({ type: "UnaryExpression", operator: "typeof" }),
3462
- (0, import_lodash5.property)("argument")
3463
+ (0, import_lodash8.matches)({ type: "UnaryExpression", operator: "typeof" }),
3464
+ (0, import_lodash8.property)("argument")
3463
3465
  ]
3464
3466
  ]);
3465
- const isUndefinedString = (0, import_lodash5.matches)({
3467
+ const isUndefinedString = (0, import_lodash8.matches)({
3466
3468
  type: "Literal",
3467
3469
  value: "undefined"
3468
3470
  });
@@ -3470,7 +3472,7 @@ function create10(context) {
3470
3472
  return node.type === "BinaryExpression" && node.operator === operator && (isUndefinedString(node.right) && getTypeofArgument(node.left) || isUndefinedString(node.left) && getTypeofArgument(node.right));
3471
3473
  }
3472
3474
  function checkExpression(nil, operator, node) {
3473
- return (0, import_lodash5.default)(nilChecks[nil].expressionChecks).map((check) => check(node, operator)).find();
3475
+ return (0, import_lodash8.default)(nilChecks[nil].expressionChecks).map((check) => check(node, operator)).find();
3474
3476
  }
3475
3477
  function checkNegatedExpression(nil, node) {
3476
3478
  return isNegationExpression2(node) && checkExpression(nil, "===", node.argument) || checkExpression(nil, "!==", node);
@@ -3515,8 +3517,7 @@ var RULE_NAME9 = "prefer-is-nil";
3515
3517
  var prefer_is_nil_default = rule9;
3516
3518
 
3517
3519
  // src/rules/prefer-map.ts
3518
- var import_get2 = __toESM(require("lodash/get"), 1);
3519
- var import_includes2 = __toESM(require("lodash/includes"), 1);
3520
+ var import_lodash9 = require("lodash");
3520
3521
  var {
3521
3522
  getFirstFunctionLine: getFirstFunctionLine4,
3522
3523
  hasOnlyOneStatement: hasOnlyOneStatement3,
@@ -3534,14 +3535,14 @@ var meta10 = {
3534
3535
  function create11(context) {
3535
3536
  function onlyHasPush(func) {
3536
3537
  const firstLine = getFirstFunctionLine4(func);
3537
- const firstParam = (0, import_get2.default)(func, "params[0]");
3538
+ const firstParam = (0, import_lodash9.get)(func, "params[0]");
3538
3539
  const exp = func && !isFunctionDefinitionWithBlock2(func) ? firstLine : (
3539
3540
  //@ts-expect-error
3540
3541
  firstLine?.expression
3541
3542
  );
3542
- return func && hasOnlyOneStatement3(func) && getMethodName3(exp) === "push" && !(0, import_includes2.default)(
3543
+ return func && hasOnlyOneStatement3(func) && getMethodName3(exp) === "push" && !(0, import_lodash9.includes)(
3543
3544
  collectParameterValues2(firstParam),
3544
- (0, import_get2.default)(exp, "callee.object.name")
3545
+ (0, import_lodash9.get)(exp, "callee.object.name")
3545
3546
  );
3546
3547
  }
3547
3548
  return getRemedaMethodVisitors(context, (node, iteratee2, { method: method2 }) => {
@@ -3609,7 +3610,7 @@ var RULE_NAME11 = "prefer-nullish-coalescing";
3609
3610
  var prefer_nullish_coalescing_default = rule11;
3610
3611
 
3611
3612
  // src/rules/prefer-remeda-typecheck.ts
3612
- var import_some = __toESM(require("lodash/some"), 1);
3613
+ var import_lodash10 = require("lodash");
3613
3614
  var meta12 = {
3614
3615
  type: "problem",
3615
3616
  schema: [],
@@ -3632,7 +3633,7 @@ function create13(context) {
3632
3633
  const sourceCode = context.sourceCode ?? context.getSourceCode();
3633
3634
  const scope = sourceCode?.getScope?.(node);
3634
3635
  const definedVariables = scope.variables;
3635
- return (0, import_some.default)(definedVariables, { name: node.name });
3636
+ return (0, import_lodash10.some)(definedVariables, { name: node.name });
3636
3637
  }
3637
3638
  function getValueForSide(node, side) {
3638
3639
  const otherSide = otherSides[side];
@@ -3712,7 +3713,7 @@ var RULE_NAME13 = "prefer-some";
3712
3713
  var prefer_some_default = rule13;
3713
3714
 
3714
3715
  // src/rules/prefer-times.ts
3715
- var import_lodash6 = require("lodash");
3716
+ var import_lodash11 = require("lodash");
3716
3717
  var meta14 = {
3717
3718
  type: "problem",
3718
3719
  schema: [],
@@ -3722,7 +3723,7 @@ var meta14 = {
3722
3723
  };
3723
3724
  function create15(context) {
3724
3725
  return getRemedaMethodVisitors(context, (node, iteratee2, { method: method2 }) => {
3725
- if (method2 === "map" && (0, import_lodash6.get)(iteratee2, "params.length") === 0) {
3726
+ if (method2 === "map" && (0, import_lodash11.get)(iteratee2, "params.length") === 0) {
3726
3727
  context.report({
3727
3728
  node,
3728
3729
  message: "Prefer R.times over R.map without using arguments"
@@ -3763,7 +3764,7 @@ var plugin = {
3763
3764
  configs: {},
3764
3765
  processors: {}
3765
3766
  };
3766
- var pluginShortName = import_lodash7.default.last(plugin.meta.name.split("-"));
3767
+ var pluginShortName = (0, import_lodash12.last)(plugin.meta.name.split("-"));
3767
3768
  Object.assign(plugin.configs, {
3768
3769
  recommended: {
3769
3770
  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";
9
9
 
10
10
  // package.json
11
11
  var version = "0.0.0-development";
@@ -92,7 +92,7 @@ var package_default = {
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";
96
96
 
97
97
  // src/util/astUtil.ts
98
98
  import {
@@ -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
  }
@@ -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";
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";
3021
3023
  var meta2 = {
3022
3024
  type: "problem",
3023
3025
  schema: [],
@@ -3499,8 +3501,7 @@ var RULE_NAME9 = "prefer-is-nil";
3499
3501
  var prefer_is_nil_default = rule9;
3500
3502
 
3501
3503
  // src/rules/prefer-map.ts
3502
- import get6 from "lodash/get";
3503
- import includes6 from "lodash/includes";
3504
+ import { get as get6, includes as includes6 } from "lodash";
3504
3505
  var {
3505
3506
  getFirstFunctionLine: getFirstFunctionLine4,
3506
3507
  hasOnlyOneStatement: hasOnlyOneStatement3,
@@ -3593,7 +3594,7 @@ var RULE_NAME11 = "prefer-nullish-coalescing";
3593
3594
  var prefer_nullish_coalescing_default = rule11;
3594
3595
 
3595
3596
  // src/rules/prefer-remeda-typecheck.ts
3596
- import some2 from "lodash/some";
3597
+ import { some as some2 } from "lodash";
3597
3598
  var meta12 = {
3598
3599
  type: "problem",
3599
3600
  schema: [],
@@ -3747,7 +3748,7 @@ var plugin = {
3747
3748
  configs: {},
3748
3749
  processors: {}
3749
3750
  };
3750
- var pluginShortName = _2.last(plugin.meta.name.split("-"));
3751
+ var pluginShortName = last2(plugin.meta.name.split("-"));
3751
3752
  Object.assign(plugin.configs, {
3752
3753
  recommended: {
3753
3754
  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.3.1",
4
4
  "author": "Andrea Pontrandolfo <andrea.pontra@gmail.com>",
5
5
  "description": "ESLint plugin for Remeda library.",
6
6
  "type": "module",