@bigbinary/eslint-plugin-neeto 1.0.42 → 1.0.43

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.
Files changed (2) hide show
  1. package/dist/index.js +108 -51
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -300,11 +300,12 @@
300
300
  "@bigbinary/neeto/use-trans-components-and-values-props": "error",
301
301
  "@bigbinary/neeto/use-webpack-alias": ["error", resolve.alias],
302
302
  "@bigbinary/neeto/use-zustand-for-global-state-management": "error",
303
- "@bigbinary/neeto/use-zustand-pick-transformer": "error",
303
+ "@bigbinary/neeto/use-zustand-pick-transformer": "warn",
304
304
  "@bigbinary/neeto/webpack-aliases-and-jsconfig-paths-should-be-in-sync": ["error", {
305
305
  jsconfigFilePath: path__default["default"].resolve(__dirname, "../../../..", "app/javascript/jsconfig.json"),
306
306
  aliasFilePath: path__default["default"].resolve(__dirname, "../../../..", "config/webpack/resolve.js")
307
307
  }],
308
+ "@bigbinary/neeto/zustand-recommend-comparator-function-usage": "warn",
308
309
  "@bigbinary/neeto/zustand-use-prop-to-pick-single-item": "error"
309
310
  };
310
311
 
@@ -53899,7 +53900,7 @@
53899
53900
 
53900
53901
  function cov_1xjehjxg0q() {
53901
53902
  var path = "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/zustand/constants.js";
53902
- var hash = "8e08636dc85c89a2d95a27d7f1ee9f6f7318c286";
53903
+ var hash = "2ca751b709d72097d37f37cd2b0f163733ea900a";
53903
53904
  var global = new Function("return this")();
53904
53905
  var gcv = "__coverage__";
53905
53906
  var coverageData = {
@@ -54137,31 +54138,41 @@
54137
54138
  },
54138
54139
  "23": {
54139
54140
  start: {
54140
- line: 206,
54141
- column: 58
54141
+ line: 207,
54142
+ column: 60
54142
54143
  },
54143
54144
  end: {
54144
- line: 210,
54145
+ line: 217,
54145
54146
  column: 1
54146
54147
  }
54147
54148
  },
54148
54149
  "24": {
54149
54150
  start: {
54150
- line: 212,
54151
- column: 61
54151
+ line: 219,
54152
+ column: 58
54152
54153
  },
54153
54154
  end: {
54154
- line: 216,
54155
+ line: 223,
54155
54156
  column: 1
54156
54157
  }
54157
54158
  },
54158
54159
  "25": {
54159
54160
  start: {
54160
- line: 220,
54161
+ line: 225,
54162
+ column: 61
54163
+ },
54164
+ end: {
54165
+ line: 229,
54166
+ column: 1
54167
+ }
54168
+ },
54169
+ "26": {
54170
+ start: {
54171
+ line: 233,
54161
54172
  column: 44
54162
54173
  },
54163
54174
  end: {
54164
- line: 227,
54175
+ line: 240,
54165
54176
  column: 1
54166
54177
  }
54167
54178
  }
@@ -54424,7 +54435,8 @@
54424
54435
  "22": 0,
54425
54436
  "23": 0,
54426
54437
  "24": 0,
54427
- "25": 0
54438
+ "25": 0,
54439
+ "26": 0
54428
54440
  },
54429
54441
  f: {
54430
54442
  "0": 0,
@@ -54439,7 +54451,7 @@
54439
54451
  "2": [0, 0, 0]
54440
54452
  },
54441
54453
  _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
54442
- hash: "8e08636dc85c89a2d95a27d7f1ee9f6f7318c286"
54454
+ hash: "2ca751b709d72097d37f37cd2b0f163733ea900a"
54443
54455
  };
54444
54456
  var coverage = global[gcv] || (global[gcv] = {});
54445
54457
  if (!coverage[path] || coverage[path].hash !== hash) {
@@ -54660,12 +54672,23 @@
54660
54672
  }
54661
54673
  }]
54662
54674
  });
54663
- var ZUSTAND_HOOK_USAGE_SINGLE_ARGUMENT_PATTERN = (cov_1xjehjxg0q().s[23]++, ramda.assocPath(["declarations", 0, "init", "arguments"], ZustandHookSingleArgumentCheck, ZUSTAND_HOOK_USAGE_PATTERN));
54664
- var ZUSTAND_HOOK_USAGE_MULTIPLE_ARGUMENTS_PATTERN = (cov_1xjehjxg0q().s[24]++, ramda.assocPath(["declarations", 0, "init", "arguments"], ZustandHookMultipleArgumentCheck, ZUSTAND_HOOK_USAGE_PATTERN));
54675
+
54676
+ // const order = useSampleStore(...);
54677
+ var ZUSTAND_HOOK_USAGE_SINGLE_IDENTIFIER_PATTERN = (cov_1xjehjxg0q().s[23]++, {
54678
+ kind: "const",
54679
+ declarations: [{
54680
+ type: TYPES.VARIABLE_DECLARATOR,
54681
+ id: {
54682
+ type: TYPES.IDENTIFIER
54683
+ }
54684
+ }]
54685
+ });
54686
+ var ZUSTAND_HOOK_USAGE_SINGLE_ARGUMENT_PATTERN = (cov_1xjehjxg0q().s[24]++, ramda.assocPath(["declarations", 0, "init", "arguments"], ZustandHookSingleArgumentCheck, ZUSTAND_HOOK_USAGE_PATTERN));
54687
+ var ZUSTAND_HOOK_USAGE_MULTIPLE_ARGUMENTS_PATTERN = (cov_1xjehjxg0q().s[25]++, ramda.assocPath(["declarations", 0, "init", "arguments"], ZustandHookMultipleArgumentCheck, ZUSTAND_HOOK_USAGE_PATTERN));
54665
54688
 
54666
54689
  // .....
54667
54690
  // const useCurrentUserStore = create(....);
54668
- var ZUSTAND_STORE_CREATE_PATTERN = (cov_1xjehjxg0q().s[25]++, {
54691
+ var ZUSTAND_STORE_CREATE_PATTERN = (cov_1xjehjxg0q().s[26]++, {
54669
54692
  kind: "const",
54670
54693
  declarations: DECALARATION_PATTERN,
54671
54694
  parent: {
@@ -54840,7 +54863,7 @@
54840
54863
  cov_oxvttglej();
54841
54864
  var ensureZustandStoresAreTypeAnnotated = {
54842
54865
  meta: {
54843
- type: "error",
54866
+ type: "problem",
54844
54867
  docs: {
54845
54868
  description: "Throw error if zustand stores are not type annotated via JSDoc comments"
54846
54869
  }
@@ -55479,7 +55502,7 @@
55479
55502
  cov_jfodn662q();
55480
55503
  var zustandRecommendComparatorFunctionUsage = {
55481
55504
  meta: {
55482
- type: "warn",
55505
+ type: "suggestion",
55483
55506
  docs: {
55484
55507
  description: "Warn about the usage of picking multiple state items without comparator function from inside zustand store hooks"
55485
55508
  }
@@ -55812,7 +55835,7 @@
55812
55835
 
55813
55836
  function cov_2h5ihxe0sh() {
55814
55837
  var path = "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/zustand/use-pick-transformer.js";
55815
- var hash = "645f56b971f77d6296baf189ede0715834465042";
55838
+ var hash = "9a1f7ec2aa8ca0b15973d446edcbf748306010fb";
55816
55839
  var global = new Function("return this")();
55817
55840
  var gcv = "__coverage__";
55818
55841
  var coverageData = {
@@ -55820,41 +55843,41 @@
55820
55843
  statementMap: {
55821
55844
  "0": {
55822
55845
  start: {
55823
- line: 15,
55846
+ line: 18,
55824
55847
  column: 22
55825
55848
  },
55826
55849
  end: {
55827
- line: 21,
55850
+ line: 29,
55828
55851
  column: 3
55829
55852
  }
55830
55853
  },
55831
55854
  "1": {
55832
55855
  start: {
55833
- line: 17,
55856
+ line: 20,
55834
55857
  column: 6
55835
55858
  },
55836
55859
  end: {
55837
- line: 17,
55838
- column: 80
55860
+ line: 25,
55861
+ column: 7
55839
55862
  }
55840
55863
  },
55841
55864
  "2": {
55842
55865
  start: {
55843
- line: 17,
55844
- column: 73
55866
+ line: 24,
55867
+ column: 8
55845
55868
  },
55846
55869
  end: {
55847
- line: 17,
55848
- column: 80
55870
+ line: 24,
55871
+ column: 15
55849
55872
  }
55850
55873
  },
55851
55874
  "3": {
55852
55875
  start: {
55853
- line: 19,
55876
+ line: 27,
55854
55877
  column: 6
55855
55878
  },
55856
55879
  end: {
55857
- line: 19,
55880
+ line: 27,
55858
55881
  column: 70
55859
55882
  }
55860
55883
  }
@@ -55864,72 +55887,72 @@
55864
55887
  name: "(anonymous_0)",
55865
55888
  decl: {
55866
55889
  start: {
55867
- line: 15,
55890
+ line: 18,
55868
55891
  column: 10
55869
55892
  },
55870
55893
  end: {
55871
- line: 15,
55894
+ line: 18,
55872
55895
  column: 11
55873
55896
  }
55874
55897
  },
55875
55898
  loc: {
55876
55899
  start: {
55877
- line: 15,
55900
+ line: 18,
55878
55901
  column: 22
55879
55902
  },
55880
55903
  end: {
55881
- line: 21,
55904
+ line: 29,
55882
55905
  column: 3
55883
55906
  }
55884
55907
  },
55885
- line: 15
55908
+ line: 18
55886
55909
  },
55887
55910
  "1": {
55888
55911
  name: "(anonymous_1)",
55889
55912
  decl: {
55890
55913
  start: {
55891
- line: 16,
55914
+ line: 19,
55892
55915
  column: 4
55893
55916
  },
55894
55917
  end: {
55895
- line: 16,
55918
+ line: 19,
55896
55919
  column: 5
55897
55920
  }
55898
55921
  },
55899
55922
  loc: {
55900
55923
  start: {
55901
- line: 16,
55924
+ line: 19,
55902
55925
  column: 30
55903
55926
  },
55904
55927
  end: {
55905
- line: 20,
55928
+ line: 28,
55906
55929
  column: 5
55907
55930
  }
55908
55931
  },
55909
- line: 16
55932
+ line: 19
55910
55933
  }
55911
55934
  },
55912
55935
  branchMap: {
55913
55936
  "0": {
55914
55937
  loc: {
55915
55938
  start: {
55916
- line: 17,
55939
+ line: 20,
55917
55940
  column: 6
55918
55941
  },
55919
55942
  end: {
55920
- line: 17,
55921
- column: 80
55943
+ line: 25,
55944
+ column: 7
55922
55945
  }
55923
55946
  },
55924
55947
  type: "if",
55925
55948
  locations: [{
55926
55949
  start: {
55927
- line: 17,
55950
+ line: 20,
55928
55951
  column: 6
55929
55952
  },
55930
55953
  end: {
55931
- line: 17,
55932
- column: 80
55954
+ line: 25,
55955
+ column: 7
55933
55956
  }
55934
55957
  }, {
55935
55958
  start: {
@@ -55941,7 +55964,40 @@
55941
55964
  column: undefined
55942
55965
  }
55943
55966
  }],
55944
- line: 17
55967
+ line: 20
55968
+ },
55969
+ "1": {
55970
+ loc: {
55971
+ start: {
55972
+ line: 21,
55973
+ column: 8
55974
+ },
55975
+ end: {
55976
+ line: 22,
55977
+ column: 67
55978
+ }
55979
+ },
55980
+ type: "binary-expr",
55981
+ locations: [{
55982
+ start: {
55983
+ line: 21,
55984
+ column: 8
55985
+ },
55986
+ end: {
55987
+ line: 21,
55988
+ column: 69
55989
+ }
55990
+ }, {
55991
+ start: {
55992
+ line: 22,
55993
+ column: 8
55994
+ },
55995
+ end: {
55996
+ line: 22,
55997
+ column: 67
55998
+ }
55999
+ }],
56000
+ line: 21
55945
56001
  }
55946
56002
  },
55947
56003
  s: {
@@ -55955,10 +56011,11 @@
55955
56011
  "1": 0
55956
56012
  },
55957
56013
  b: {
55958
- "0": [0, 0]
56014
+ "0": [0, 0],
56015
+ "1": [0, 0]
55959
56016
  },
55960
56017
  _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
55961
- hash: "645f56b971f77d6296baf189ede0715834465042"
56018
+ hash: "9a1f7ec2aa8ca0b15973d446edcbf748306010fb"
55962
56019
  };
55963
56020
  var coverage = global[gcv] || (global[gcv] = {});
55964
56021
  if (!coverage[path] || coverage[path].hash !== hash) {
@@ -55976,7 +56033,7 @@
55976
56033
  cov_2h5ihxe0sh();
55977
56034
  var useZustandPickTransformer = {
55978
56035
  meta: {
55979
- type: "error",
56036
+ type: "suggestion",
55980
56037
  docs: {
55981
56038
  description: "Enforce the use of zustand-pick syntax from babel-preset-neeto."
55982
56039
  }
@@ -55988,7 +56045,7 @@
55988
56045
  VariableDeclaration: function VariableDeclaration(node) {
55989
56046
  cov_2h5ihxe0sh().f[1]++;
55990
56047
  cov_2h5ihxe0sh().s[1]++;
55991
- if (!matches(ZUSTAND_HOOK_USAGE_MULTIPLE_ARGUMENTS_PATTERN, node)) {
56048
+ if ((cov_2h5ihxe0sh().b[1][0]++, !matches(ZUSTAND_HOOK_USAGE_MULTIPLE_ARGUMENTS_PATTERN, node)) || (cov_2h5ihxe0sh().b[1][1]++, matches(ZUSTAND_HOOK_USAGE_SINGLE_IDENTIFIER_PATTERN, node))) {
55992
56049
  cov_2h5ihxe0sh().b[0][0]++;
55993
56050
  cov_2h5ihxe0sh().s[2]++;
55994
56051
  return;
@@ -56707,7 +56764,7 @@
56707
56764
  cov_1scjdvsnf2();
56708
56765
  var zustandUsePropToPickSingleItem = {
56709
56766
  meta: {
56710
- type: "error",
56767
+ type: "problem",
56711
56768
  docs: {
56712
56769
  description: "Throw error if pick function is used to pick a single item"
56713
56770
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/eslint-plugin-neeto",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "main": "dist/index.js",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {