@bigbinary/eslint-plugin-neeto 1.0.23 → 1.0.25

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 (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +895 -39
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -74,6 +74,7 @@ module.exports = {
74
74
  - [use-array-methods](./docs/src/rules/use-array-methods.md)
75
75
  - [use-axios-config-for-passing-query-parameters](./docs/src/rules/use-axios-config-for-passing-query-parameters.md)
76
76
  - [use-common-routes](./docs/src/rules/use-common-routes.md)
77
+ - [use-inline-svg-for-render](./docs/src/rules/use-inline-svg-for-render.md)
77
78
  - [use-neetoui-classes](./docs/src/rules/use-neetoui-classes.md)
78
79
  - [use-react-query-for-managing-remote-data](./docs/src/rules/use-react-query-for-managing-remote-data.md)
79
80
  - [use-snake-case-for-api-connector-filename](./docs/src/rules/use-snake-case-for-api-connector-filename.md)
package/dist/index.js CHANGED
@@ -239,6 +239,7 @@
239
239
  "@bigbinary/neeto/routes-should-match-object-path": "error",
240
240
  "@bigbinary/neeto/use-axios-config-for-passing-query-parameters": "warn",
241
241
  "@bigbinary/neeto/use-common-routes": "error",
242
+ "@bigbinary/neeto/use-inline-svg-for-render": "error",
242
243
  "@bigbinary/neeto/use-react-query-for-managing-remote-data": "warn",
243
244
  "@bigbinary/neeto/use-snake-case-for-api-connector-filename": "error",
244
245
  "@bigbinary/neeto/use-webpack-alias": ["error", resolve.alias],
@@ -801,6 +802,9 @@
801
802
  }));
802
803
  };
803
804
  nullSafe(filterNonNull);
805
+ var findBy$1 = /*#__PURE__*/ramda.curry(function (pattern, array) {
806
+ return array.find(matches(pattern));
807
+ });
804
808
  var existsBy$1 = /*#__PURE__*/ramda.curry(function (pattern, array) {
805
809
  return array.some(matches(pattern));
806
810
  });
@@ -3502,7 +3506,7 @@
3502
3506
 
3503
3507
  function cov_26237ygvis() {
3504
3508
  var path = "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/utils/messages.js";
3505
- var hash = "d79b2dc96c78e0a1b2011884411a59d2ce915bb9";
3509
+ var hash = "53ffa05185c2e292053d8d0fe64f61634e79bc9d";
3506
3510
  var global = new Function("return this")();
3507
3511
  var gcv = "__coverage__";
3508
3512
  var coverageData = {
@@ -3925,7 +3929,7 @@
3925
3929
  },
3926
3930
  end: {
3927
3931
  line: 96,
3928
- column: 105
3932
+ column: 56
3929
3933
  }
3930
3934
  },
3931
3935
  "42": {
@@ -3935,7 +3939,7 @@
3935
3939
  },
3936
3940
  end: {
3937
3941
  line: 99,
3938
- column: 76
3942
+ column: 105
3939
3943
  }
3940
3944
  },
3941
3945
  "43": {
@@ -3945,7 +3949,7 @@
3945
3949
  },
3946
3950
  end: {
3947
3951
  line: 102,
3948
- column: 96
3952
+ column: 76
3949
3953
  }
3950
3954
  },
3951
3955
  "44": {
@@ -3955,7 +3959,7 @@
3955
3959
  },
3956
3960
  end: {
3957
3961
  line: 105,
3958
- column: 100
3962
+ column: 96
3959
3963
  }
3960
3964
  },
3961
3965
  "45": {
@@ -3965,7 +3969,7 @@
3965
3969
  },
3966
3970
  end: {
3967
3971
  line: 108,
3968
- column: 86
3972
+ column: 100
3969
3973
  }
3970
3974
  },
3971
3975
  "46": {
@@ -3975,7 +3979,7 @@
3975
3979
  },
3976
3980
  end: {
3977
3981
  line: 111,
3978
- column: 88
3982
+ column: 86
3979
3983
  }
3980
3984
  },
3981
3985
  "47": {
@@ -3985,7 +3989,7 @@
3985
3989
  },
3986
3990
  end: {
3987
3991
  line: 114,
3988
- column: 86
3992
+ column: 88
3989
3993
  }
3990
3994
  },
3991
3995
  "48": {
@@ -3995,7 +3999,7 @@
3995
3999
  },
3996
4000
  end: {
3997
4001
  line: 117,
3998
- column: 82
4002
+ column: 86
3999
4003
  }
4000
4004
  },
4001
4005
  "49": {
@@ -4005,7 +4009,7 @@
4005
4009
  },
4006
4010
  end: {
4007
4011
  line: 120,
4008
- column: 92
4012
+ column: 82
4009
4013
  }
4010
4014
  },
4011
4015
  "50": {
@@ -4015,7 +4019,7 @@
4015
4019
  },
4016
4020
  end: {
4017
4021
  line: 123,
4018
- column: 71
4022
+ column: 92
4019
4023
  }
4020
4024
  },
4021
4025
  "51": {
@@ -4025,27 +4029,27 @@
4025
4029
  },
4026
4030
  end: {
4027
4031
  line: 126,
4028
- column: 53
4032
+ column: 71
4029
4033
  }
4030
4034
  },
4031
4035
  "52": {
4032
4036
  start: {
4033
- line: 128,
4034
- column: 56
4037
+ line: 129,
4038
+ column: 2
4035
4039
  },
4036
4040
  end: {
4037
- line: 132,
4038
- column: 1
4041
+ line: 129,
4042
+ column: 53
4039
4043
  }
4040
4044
  },
4041
4045
  "53": {
4042
4046
  start: {
4043
- line: 135,
4044
- column: 2
4047
+ line: 131,
4048
+ column: 56
4045
4049
  },
4046
4050
  end: {
4047
4051
  line: 135,
4048
- column: 49
4052
+ column: 1
4049
4053
  }
4050
4054
  },
4051
4055
  "54": {
@@ -4055,7 +4059,7 @@
4055
4059
  },
4056
4060
  end: {
4057
4061
  line: 138,
4058
- column: 54
4062
+ column: 49
4059
4063
  }
4060
4064
  },
4061
4065
  "55": {
@@ -4065,6 +4069,16 @@
4065
4069
  },
4066
4070
  end: {
4067
4071
  line: 141,
4072
+ column: 54
4073
+ }
4074
+ },
4075
+ "56": {
4076
+ start: {
4077
+ line: 144,
4078
+ column: 2
4079
+ },
4080
+ end: {
4081
+ line: 144,
4068
4082
  column: 43
4069
4083
  }
4070
4084
  }
@@ -4368,7 +4382,8 @@
4368
4382
  "52": 0,
4369
4383
  "53": 0,
4370
4384
  "54": 0,
4371
- "55": 0
4385
+ "55": 0,
4386
+ "56": 0
4372
4387
  },
4373
4388
  f: {
4374
4389
  "0": 0,
@@ -4384,7 +4399,7 @@
4384
4399
  },
4385
4400
  b: {},
4386
4401
  _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
4387
- hash: "d79b2dc96c78e0a1b2011884411a59d2ce915bb9"
4402
+ hash: "53ffa05185c2e292053d8d0fe64f61634e79bc9d"
4388
4403
  };
4389
4404
  var coverage = global[gcv] || (global[gcv] = {});
4390
4405
  if (!coverage[path] || coverage[path].hash !== hash) {
@@ -4478,21 +4493,22 @@
4478
4493
  var ROUTES_SHOULD_USE_DEFAULT_EXPORT = (cov_26237ygvis().s[38]++, "`routes` should be exported using the default export method.");
4479
4494
  var USE_ARRAY_METHODS = (cov_26237ygvis().s[39]++, "Use array methods (forEach, map, filter, reduce, etc) instead of 'for' loop. Refer 'Advanced Array Methods' section in https://bit.ly/array-methods-page-1");
4480
4495
  var USE_AXIOS_CONFIG_FOR_PASSING_QUERY_PARAMETERS_MESSAGE = (cov_26237ygvis().s[40]++, "Use 'params attribute in axios configuration' to pass query parameters.");
4481
- var USE_LINK_FOR_NAVIGATION = (cov_26237ygvis().s[41]++, "Use Link or NavLink component from 'react-router-dom' for click-navigation instead of onClick handler");
4482
- var USE_ANCHOR_FOR_NAVIGATION = (cov_26237ygvis().s[42]++, "Use Anchor element (<a>) for click-navigation instead of onClick handler");
4483
- var USE_BUTTON_TO_FOR_LINK_NAVIGATION = (cov_26237ygvis().s[43]++, "Use `to` prop of Button (<Button to='path'>) for click-navigation instead of onClick handler");
4484
- var USE_BUTTON_TO_FOR_ANCHOR_NAVIGATION = (cov_26237ygvis().s[44]++, "Use `href` prop of Button (<Button href='path'>) for click-navigation instead of onClick handler");
4485
- var USE_NEETOUI_BORDER_COLOR = (cov_26237ygvis().s[45]++, "Use neetoUI border color. Refer https://bit.ly/border-color-page for more details.");
4486
- var USE_NEETOUI_BORDER_RADIUS = (cov_26237ygvis().s[46]++, "Use neetoUI border radius. Refer https://bit.ly/border-radius-page for more details.");
4487
- var USE_NEETOUI_BOX_SHADOW = (cov_26237ygvis().s[47]++, "Use neetoUI border shadow. Refer https://bit.ly/box-shadows-page for more details.");
4488
- var USE_NEETOUI_TEXT_COLOR = (cov_26237ygvis().s[48]++, "Use neetoUI text color. Refer https://bit.ly/text-color-page for more details.");
4489
- var DONT_USE_ZUSTAND_STORE_WITHOUT_SELECTOR = (cov_26237ygvis().s[49]++, "Don't use zustand store hook without a selector function. It will impact the performance");
4490
- var DONT_USE_ZUSTAND_STORE_WITHOUT_COMPARATOR_FUNCTION = (cov_26237ygvis().s[50]++, "Don't pick multiple zustand state items without comparator function");
4491
- var USE_PROP_FOR_PICKING_SINGLE_ITEM = (cov_26237ygvis().s[51]++, "Use prop instead of pick when picking single item");
4492
- var ENSURE_ZUSTAND_STORES_ARE_TYPE_ANNOTATED = (cov_26237ygvis().s[52]++, "\n Zustand stores should be type annotated like this:\n /** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\n const useUserStore = create(...)\n");
4493
- var USE_REACT_QUERY_FOR_MANAGING_REMOTE_DATA = (cov_26237ygvis().s[53]++, "API calls should be managed using React Query");
4494
- var FILES_INSIDE_REACT_QUERY_FOLDER_SHOULD_END_WITH_API = (cov_26237ygvis().s[54]++, "Files inside reactQuery folder should end with Api");
4495
- var USE_ZUSTAND_FOR_GLOBAL_STATE_MANAGEMENT = (cov_26237ygvis().s[55]++, "Use zustand for global state management");
4496
+ var USE_INLINE_SVG_FOR_RENDER = (cov_26237ygvis().s[41]++, "Use inline SVG instead of img tag for rendering SVGs");
4497
+ var USE_LINK_FOR_NAVIGATION = (cov_26237ygvis().s[42]++, "Use Link or NavLink component from 'react-router-dom' for click-navigation instead of onClick handler");
4498
+ var USE_ANCHOR_FOR_NAVIGATION = (cov_26237ygvis().s[43]++, "Use Anchor element (<a>) for click-navigation instead of onClick handler");
4499
+ var USE_BUTTON_TO_FOR_LINK_NAVIGATION = (cov_26237ygvis().s[44]++, "Use `to` prop of Button (<Button to='path'>) for click-navigation instead of onClick handler");
4500
+ var USE_BUTTON_TO_FOR_ANCHOR_NAVIGATION = (cov_26237ygvis().s[45]++, "Use `href` prop of Button (<Button href='path'>) for click-navigation instead of onClick handler");
4501
+ var USE_NEETOUI_BORDER_COLOR = (cov_26237ygvis().s[46]++, "Use neetoUI border color. Refer https://bit.ly/border-color-page for more details.");
4502
+ var USE_NEETOUI_BORDER_RADIUS = (cov_26237ygvis().s[47]++, "Use neetoUI border radius. Refer https://bit.ly/border-radius-page for more details.");
4503
+ var USE_NEETOUI_BOX_SHADOW = (cov_26237ygvis().s[48]++, "Use neetoUI border shadow. Refer https://bit.ly/box-shadows-page for more details.");
4504
+ var USE_NEETOUI_TEXT_COLOR = (cov_26237ygvis().s[49]++, "Use neetoUI text color. Refer https://bit.ly/text-color-page for more details.");
4505
+ var DONT_USE_ZUSTAND_STORE_WITHOUT_SELECTOR = (cov_26237ygvis().s[50]++, "Don't use zustand store hook without a selector function. It will impact the performance");
4506
+ var DONT_USE_ZUSTAND_STORE_WITHOUT_COMPARATOR_FUNCTION = (cov_26237ygvis().s[51]++, "Don't pick multiple zustand state items without comparator function");
4507
+ var USE_PROP_FOR_PICKING_SINGLE_ITEM = (cov_26237ygvis().s[52]++, "Use prop instead of pick when picking single item");
4508
+ var ENSURE_ZUSTAND_STORES_ARE_TYPE_ANNOTATED = (cov_26237ygvis().s[53]++, "\n Zustand stores should be type annotated like this:\n /** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\n const useUserStore = create(...)\n");
4509
+ var USE_REACT_QUERY_FOR_MANAGING_REMOTE_DATA = (cov_26237ygvis().s[54]++, "API calls should be managed using React Query");
4510
+ var FILES_INSIDE_REACT_QUERY_FOLDER_SHOULD_END_WITH_API = (cov_26237ygvis().s[55]++, "Files inside reactQuery folder should end with Api");
4511
+ var USE_ZUSTAND_FOR_GLOBAL_STATE_MANAGEMENT = (cov_26237ygvis().s[56]++, "Use zustand for global state management");
4496
4512
 
4497
4513
  function cov_22o2x8aeul() {
4498
4514
  var path = "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/api-connector-name-should-match-filename.js";
@@ -13245,14 +13261,14 @@
13245
13261
  }
13246
13262
  cov_rzpuelrue();
13247
13263
 
13248
- // import create from "zustand";
13264
+ // import { create } from "zustand";
13249
13265
  cov_rzpuelrue().s[0]++;
13250
13266
  var storeImportPattern = function storeImportPattern() {
13251
13267
  cov_rzpuelrue().f[0]++;
13252
13268
  cov_rzpuelrue().s[1]++;
13253
13269
  return {
13254
13270
  specifiers: [{
13255
- type: TYPES.IMPORT_DEFAULT_SPECIFIER,
13271
+ type: TYPES.IMPORT_SPECIFIER,
13256
13272
  local: {
13257
13273
  type: TYPES.IDENTIFIER
13258
13274
  }
@@ -43354,6 +43370,845 @@
43354
43370
  }
43355
43371
  };
43356
43372
 
43373
+ function cov_3tui28gyx() {
43374
+ var path = "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/use-inline-svg-for-render/constants.js";
43375
+ var hash = "87ef6b367b8d2462357c332288b35ea052916eba";
43376
+ var global = new Function("return this")();
43377
+ var gcv = "__coverage__";
43378
+ var coverageData = {
43379
+ path: "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/use-inline-svg-for-render/constants.js",
43380
+ statementMap: {
43381
+ "0": {
43382
+ start: {
43383
+ line: 1,
43384
+ column: 26
43385
+ },
43386
+ end: {
43387
+ line: 1,
43388
+ column: 35
43389
+ }
43390
+ }
43391
+ },
43392
+ fnMap: {},
43393
+ branchMap: {},
43394
+ s: {
43395
+ "0": 0
43396
+ },
43397
+ f: {},
43398
+ b: {},
43399
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
43400
+ hash: "87ef6b367b8d2462357c332288b35ea052916eba"
43401
+ };
43402
+ var coverage = global[gcv] || (global[gcv] = {});
43403
+ if (!coverage[path] || coverage[path].hash !== hash) {
43404
+ coverage[path] = coverageData;
43405
+ }
43406
+ var actualCoverage = coverage[path];
43407
+ {
43408
+ // @ts-ignore
43409
+ cov_3tui28gyx = function () {
43410
+ return actualCoverage;
43411
+ };
43412
+ }
43413
+ return actualCoverage;
43414
+ }
43415
+ cov_3tui28gyx();
43416
+ var IMAGE_PATH = (cov_3tui28gyx().s[0]++, "images/");
43417
+
43418
+ function cov_1x96vrelh3() {
43419
+ var path = "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/use-inline-svg-for-render/utils.js";
43420
+ var hash = "5d17bfe91b25a48f3b4999e714ace5b5a1fc0e2a";
43421
+ var global = new Function("return this")();
43422
+ var gcv = "__coverage__";
43423
+ var coverageData = {
43424
+ path: "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/use-inline-svg-for-render/utils.js",
43425
+ statementMap: {
43426
+ "0": {
43427
+ start: {
43428
+ line: 6,
43429
+ column: 27
43430
+ },
43431
+ end: {
43432
+ line: 7,
43433
+ column: 55
43434
+ }
43435
+ },
43436
+ "1": {
43437
+ start: {
43438
+ line: 7,
43439
+ column: 2
43440
+ },
43441
+ end: {
43442
+ line: 7,
43443
+ column: 55
43444
+ }
43445
+ },
43446
+ "2": {
43447
+ start: {
43448
+ line: 9,
43449
+ column: 31
43450
+ },
43451
+ end: {
43452
+ line: 10,
43453
+ column: 57
43454
+ }
43455
+ },
43456
+ "3": {
43457
+ start: {
43458
+ line: 10,
43459
+ column: 2
43460
+ },
43461
+ end: {
43462
+ line: 10,
43463
+ column: 57
43464
+ }
43465
+ },
43466
+ "4": {
43467
+ start: {
43468
+ line: 12,
43469
+ column: 41
43470
+ },
43471
+ end: {
43472
+ line: 26,
43473
+ column: 1
43474
+ }
43475
+ },
43476
+ "5": {
43477
+ start: {
43478
+ line: 13,
43479
+ column: 25
43480
+ },
43481
+ end: {
43482
+ line: 18,
43483
+ column: 3
43484
+ }
43485
+ },
43486
+ "6": {
43487
+ start: {
43488
+ line: 14,
43489
+ column: 4
43490
+ },
43491
+ end: {
43492
+ line: 17,
43493
+ column: 46
43494
+ }
43495
+ },
43496
+ "7": {
43497
+ start: {
43498
+ line: 20,
43499
+ column: 2
43500
+ },
43501
+ end: {
43502
+ line: 25,
43503
+ column: 4
43504
+ }
43505
+ }
43506
+ },
43507
+ fnMap: {
43508
+ "0": {
43509
+ name: "(anonymous_0)",
43510
+ decl: {
43511
+ start: {
43512
+ line: 6,
43513
+ column: 27
43514
+ },
43515
+ end: {
43516
+ line: 6,
43517
+ column: 28
43518
+ }
43519
+ },
43520
+ loc: {
43521
+ start: {
43522
+ line: 7,
43523
+ column: 2
43524
+ },
43525
+ end: {
43526
+ line: 7,
43527
+ column: 55
43528
+ }
43529
+ },
43530
+ line: 7
43531
+ },
43532
+ "1": {
43533
+ name: "(anonymous_1)",
43534
+ decl: {
43535
+ start: {
43536
+ line: 9,
43537
+ column: 31
43538
+ },
43539
+ end: {
43540
+ line: 9,
43541
+ column: 32
43542
+ }
43543
+ },
43544
+ loc: {
43545
+ start: {
43546
+ line: 10,
43547
+ column: 2
43548
+ },
43549
+ end: {
43550
+ line: 10,
43551
+ column: 57
43552
+ }
43553
+ },
43554
+ line: 10
43555
+ },
43556
+ "2": {
43557
+ name: "(anonymous_2)",
43558
+ decl: {
43559
+ start: {
43560
+ line: 12,
43561
+ column: 41
43562
+ },
43563
+ end: {
43564
+ line: 12,
43565
+ column: 42
43566
+ }
43567
+ },
43568
+ loc: {
43569
+ start: {
43570
+ line: 12,
43571
+ column: 73
43572
+ },
43573
+ end: {
43574
+ line: 26,
43575
+ column: 1
43576
+ }
43577
+ },
43578
+ line: 12
43579
+ },
43580
+ "3": {
43581
+ name: "(anonymous_3)",
43582
+ decl: {
43583
+ start: {
43584
+ line: 13,
43585
+ column: 40
43586
+ },
43587
+ end: {
43588
+ line: 13,
43589
+ column: 41
43590
+ }
43591
+ },
43592
+ loc: {
43593
+ start: {
43594
+ line: 14,
43595
+ column: 4
43596
+ },
43597
+ end: {
43598
+ line: 17,
43599
+ column: 46
43600
+ }
43601
+ },
43602
+ line: 14
43603
+ }
43604
+ },
43605
+ branchMap: {
43606
+ "0": {
43607
+ loc: {
43608
+ start: {
43609
+ line: 14,
43610
+ column: 4
43611
+ },
43612
+ end: {
43613
+ line: 17,
43614
+ column: 46
43615
+ }
43616
+ },
43617
+ type: "cond-expr",
43618
+ locations: [{
43619
+ start: {
43620
+ line: 16,
43621
+ column: 8
43622
+ },
43623
+ end: {
43624
+ line: 16,
43625
+ column: 46
43626
+ }
43627
+ }, {
43628
+ start: {
43629
+ line: 17,
43630
+ column: 8
43631
+ },
43632
+ end: {
43633
+ line: 17,
43634
+ column: 46
43635
+ }
43636
+ }],
43637
+ line: 14
43638
+ },
43639
+ "1": {
43640
+ loc: {
43641
+ start: {
43642
+ line: 14,
43643
+ column: 4
43644
+ },
43645
+ end: {
43646
+ line: 15,
43647
+ column: 76
43648
+ }
43649
+ },
43650
+ type: "binary-expr",
43651
+ locations: [{
43652
+ start: {
43653
+ line: 14,
43654
+ column: 4
43655
+ },
43656
+ end: {
43657
+ line: 14,
43658
+ column: 33
43659
+ }
43660
+ }, {
43661
+ start: {
43662
+ line: 15,
43663
+ column: 4
43664
+ },
43665
+ end: {
43666
+ line: 15,
43667
+ column: 76
43668
+ }
43669
+ }],
43670
+ line: 14
43671
+ },
43672
+ "2": {
43673
+ loc: {
43674
+ start: {
43675
+ line: 21,
43676
+ column: 4
43677
+ },
43678
+ end: {
43679
+ line: 24,
43680
+ column: 5
43681
+ }
43682
+ },
43683
+ type: "binary-expr",
43684
+ locations: [{
43685
+ start: {
43686
+ line: 21,
43687
+ column: 4
43688
+ },
43689
+ end: {
43690
+ line: 21,
43691
+ column: 49
43692
+ }
43693
+ }, {
43694
+ start: {
43695
+ line: 21,
43696
+ column: 53
43697
+ },
43698
+ end: {
43699
+ line: 24,
43700
+ column: 5
43701
+ }
43702
+ }],
43703
+ line: 21
43704
+ }
43705
+ },
43706
+ s: {
43707
+ "0": 0,
43708
+ "1": 0,
43709
+ "2": 0,
43710
+ "3": 0,
43711
+ "4": 0,
43712
+ "5": 0,
43713
+ "6": 0,
43714
+ "7": 0
43715
+ },
43716
+ f: {
43717
+ "0": 0,
43718
+ "1": 0,
43719
+ "2": 0,
43720
+ "3": 0
43721
+ },
43722
+ b: {
43723
+ "0": [0, 0],
43724
+ "1": [0, 0],
43725
+ "2": [0, 0]
43726
+ },
43727
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
43728
+ hash: "5d17bfe91b25a48f3b4999e714ace5b5a1fc0e2a"
43729
+ };
43730
+ var coverage = global[gcv] || (global[gcv] = {});
43731
+ if (!coverage[path] || coverage[path].hash !== hash) {
43732
+ coverage[path] = coverageData;
43733
+ }
43734
+ var actualCoverage = coverage[path];
43735
+ {
43736
+ // @ts-ignore
43737
+ cov_1x96vrelh3 = function () {
43738
+ return actualCoverage;
43739
+ };
43740
+ }
43741
+ return actualCoverage;
43742
+ }
43743
+ cov_1x96vrelh3();
43744
+ cov_1x96vrelh3().s[0]++;
43745
+ var resolvePath = function resolvePath(relativePath) {
43746
+ cov_1x96vrelh3().f[0]++;
43747
+ cov_1x96vrelh3().s[1]++;
43748
+ return path__default["default"].resolve(__dirname, "../../../../", relativePath);
43749
+ };
43750
+ cov_1x96vrelh3().s[2]++;
43751
+ var isImportFileSvg = function isImportFileSvg(importPath) {
43752
+ cov_1x96vrelh3().f[1]++;
43753
+ cov_1x96vrelh3().s[3]++;
43754
+ return fs.existsSync(resolvePath("app/assets/".concat(importPath, ".svg")));
43755
+ };
43756
+ cov_1x96vrelh3().s[4]++;
43757
+ var findSrcIndexIfContainsSvg = function findSrcIndexIfContainsSvg(attributes, svgs, fileName) {
43758
+ cov_1x96vrelh3().f[2]++;
43759
+ var returnElements = (cov_1x96vrelh3().s[5]++, attributes.map(function (attribute, index) {
43760
+ cov_1x96vrelh3().f[3]++;
43761
+ cov_1x96vrelh3().s[6]++;
43762
+ return (cov_1x96vrelh3().b[1][0]++, attribute.name.name === "src") && (cov_1x96vrelh3().b[1][1]++, existsBy$1({
43763
+ file: fileName,
43764
+ svg: attribute.value.expression.name
43765
+ }, svgs)) ? (cov_1x96vrelh3().b[0][0]++, {
43766
+ containsSvg: true,
43767
+ srcIndex: index
43768
+ }) : (cov_1x96vrelh3().b[0][1]++, {
43769
+ containsSvg: false,
43770
+ srcIndex: null
43771
+ });
43772
+ }));
43773
+ cov_1x96vrelh3().s[7]++;
43774
+ return (cov_1x96vrelh3().b[2][0]++, findBy$1({
43775
+ containsSvg: true
43776
+ }, returnElements)) || (cov_1x96vrelh3().b[2][1]++, {
43777
+ containsSvg: false,
43778
+ srcIndex: null
43779
+ });
43780
+ };
43781
+
43782
+ function cov_28jujmuad7() {
43783
+ var path = "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/use-inline-svg-for-render/index.js";
43784
+ var hash = "1561c7e2951468e0f36e873e112585927e44a7e6";
43785
+ var global = new Function("return this")();
43786
+ var gcv = "__coverage__";
43787
+ var coverageData = {
43788
+ path: "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/use-inline-svg-for-render/index.js",
43789
+ statementMap: {
43790
+ "0": {
43791
+ start: {
43792
+ line: 6,
43793
+ column: 13
43794
+ },
43795
+ end: {
43796
+ line: 6,
43797
+ column: 15
43798
+ }
43799
+ },
43800
+ "1": {
43801
+ start: {
43802
+ line: 16,
43803
+ column: 22
43804
+ },
43805
+ end: {
43806
+ line: 51,
43807
+ column: 3
43808
+ }
43809
+ },
43810
+ "2": {
43811
+ start: {
43812
+ line: 18,
43813
+ column: 6
43814
+ },
43815
+ end: {
43816
+ line: 26,
43817
+ column: 7
43818
+ }
43819
+ },
43820
+ "3": {
43821
+ start: {
43822
+ line: 22,
43823
+ column: 8
43824
+ },
43825
+ end: {
43826
+ line: 25,
43827
+ column: 11
43828
+ }
43829
+ },
43830
+ "4": {
43831
+ start: {
43832
+ line: 29,
43833
+ column: 6
43834
+ },
43835
+ end: {
43836
+ line: 49,
43837
+ column: 7
43838
+ }
43839
+ },
43840
+ "5": {
43841
+ start: {
43842
+ line: 30,
43843
+ column: 42
43844
+ },
43845
+ end: {
43846
+ line: 34,
43847
+ column: 9
43848
+ }
43849
+ },
43850
+ "6": {
43851
+ start: {
43852
+ line: 36,
43853
+ column: 8
43854
+ },
43855
+ end: {
43856
+ line: 48,
43857
+ column: 9
43858
+ }
43859
+ },
43860
+ "7": {
43861
+ start: {
43862
+ line: 37,
43863
+ column: 10
43864
+ },
43865
+ end: {
43866
+ line: 47,
43867
+ column: 13
43868
+ }
43869
+ },
43870
+ "8": {
43871
+ start: {
43872
+ line: 40,
43873
+ column: 26
43874
+ },
43875
+ end: {
43876
+ line: 46,
43877
+ column: 13
43878
+ }
43879
+ }
43880
+ },
43881
+ fnMap: {
43882
+ "0": {
43883
+ name: "(anonymous_0)",
43884
+ decl: {
43885
+ start: {
43886
+ line: 16,
43887
+ column: 10
43888
+ },
43889
+ end: {
43890
+ line: 16,
43891
+ column: 11
43892
+ }
43893
+ },
43894
+ loc: {
43895
+ start: {
43896
+ line: 16,
43897
+ column: 22
43898
+ },
43899
+ end: {
43900
+ line: 51,
43901
+ column: 3
43902
+ }
43903
+ },
43904
+ line: 16
43905
+ },
43906
+ "1": {
43907
+ name: "(anonymous_1)",
43908
+ decl: {
43909
+ start: {
43910
+ line: 17,
43911
+ column: 4
43912
+ },
43913
+ end: {
43914
+ line: 17,
43915
+ column: 5
43916
+ }
43917
+ },
43918
+ loc: {
43919
+ start: {
43920
+ line: 17,
43921
+ column: 28
43922
+ },
43923
+ end: {
43924
+ line: 27,
43925
+ column: 5
43926
+ }
43927
+ },
43928
+ line: 17
43929
+ },
43930
+ "2": {
43931
+ name: "(anonymous_2)",
43932
+ decl: {
43933
+ start: {
43934
+ line: 28,
43935
+ column: 4
43936
+ },
43937
+ end: {
43938
+ line: 28,
43939
+ column: 5
43940
+ }
43941
+ },
43942
+ loc: {
43943
+ start: {
43944
+ line: 28,
43945
+ column: 24
43946
+ },
43947
+ end: {
43948
+ line: 50,
43949
+ column: 5
43950
+ }
43951
+ },
43952
+ line: 28
43953
+ },
43954
+ "3": {
43955
+ name: "(anonymous_3)",
43956
+ decl: {
43957
+ start: {
43958
+ line: 40,
43959
+ column: 17
43960
+ },
43961
+ end: {
43962
+ line: 40,
43963
+ column: 18
43964
+ }
43965
+ },
43966
+ loc: {
43967
+ start: {
43968
+ line: 40,
43969
+ column: 26
43970
+ },
43971
+ end: {
43972
+ line: 46,
43973
+ column: 13
43974
+ }
43975
+ },
43976
+ line: 40
43977
+ }
43978
+ },
43979
+ branchMap: {
43980
+ "0": {
43981
+ loc: {
43982
+ start: {
43983
+ line: 18,
43984
+ column: 6
43985
+ },
43986
+ end: {
43987
+ line: 26,
43988
+ column: 7
43989
+ }
43990
+ },
43991
+ type: "if",
43992
+ locations: [{
43993
+ start: {
43994
+ line: 18,
43995
+ column: 6
43996
+ },
43997
+ end: {
43998
+ line: 26,
43999
+ column: 7
44000
+ }
44001
+ }, {
44002
+ start: {
44003
+ line: undefined,
44004
+ column: undefined
44005
+ },
44006
+ end: {
44007
+ line: undefined,
44008
+ column: undefined
44009
+ }
44010
+ }],
44011
+ line: 18
44012
+ },
44013
+ "1": {
44014
+ loc: {
44015
+ start: {
44016
+ line: 19,
44017
+ column: 8
44018
+ },
44019
+ end: {
44020
+ line: 20,
44021
+ column: 42
44022
+ }
44023
+ },
44024
+ type: "binary-expr",
44025
+ locations: [{
44026
+ start: {
44027
+ line: 19,
44028
+ column: 8
44029
+ },
44030
+ end: {
44031
+ line: 19,
44032
+ column: 48
44033
+ }
44034
+ }, {
44035
+ start: {
44036
+ line: 20,
44037
+ column: 8
44038
+ },
44039
+ end: {
44040
+ line: 20,
44041
+ column: 42
44042
+ }
44043
+ }],
44044
+ line: 19
44045
+ },
44046
+ "2": {
44047
+ loc: {
44048
+ start: {
44049
+ line: 29,
44050
+ column: 6
44051
+ },
44052
+ end: {
44053
+ line: 49,
44054
+ column: 7
44055
+ }
44056
+ },
44057
+ type: "if",
44058
+ locations: [{
44059
+ start: {
44060
+ line: 29,
44061
+ column: 6
44062
+ },
44063
+ end: {
44064
+ line: 49,
44065
+ column: 7
44066
+ }
44067
+ }, {
44068
+ start: {
44069
+ line: undefined,
44070
+ column: undefined
44071
+ },
44072
+ end: {
44073
+ line: undefined,
44074
+ column: undefined
44075
+ }
44076
+ }],
44077
+ line: 29
44078
+ },
44079
+ "3": {
44080
+ loc: {
44081
+ start: {
44082
+ line: 36,
44083
+ column: 8
44084
+ },
44085
+ end: {
44086
+ line: 48,
44087
+ column: 9
44088
+ }
44089
+ },
44090
+ type: "if",
44091
+ locations: [{
44092
+ start: {
44093
+ line: 36,
44094
+ column: 8
44095
+ },
44096
+ end: {
44097
+ line: 48,
44098
+ column: 9
44099
+ }
44100
+ }, {
44101
+ start: {
44102
+ line: undefined,
44103
+ column: undefined
44104
+ },
44105
+ end: {
44106
+ line: undefined,
44107
+ column: undefined
44108
+ }
44109
+ }],
44110
+ line: 36
44111
+ }
44112
+ },
44113
+ s: {
44114
+ "0": 0,
44115
+ "1": 0,
44116
+ "2": 0,
44117
+ "3": 0,
44118
+ "4": 0,
44119
+ "5": 0,
44120
+ "6": 0,
44121
+ "7": 0,
44122
+ "8": 0
44123
+ },
44124
+ f: {
44125
+ "0": 0,
44126
+ "1": 0,
44127
+ "2": 0,
44128
+ "3": 0
44129
+ },
44130
+ b: {
44131
+ "0": [0, 0],
44132
+ "1": [0, 0],
44133
+ "2": [0, 0],
44134
+ "3": [0, 0]
44135
+ },
44136
+ _coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
44137
+ hash: "1561c7e2951468e0f36e873e112585927e44a7e6"
44138
+ };
44139
+ var coverage = global[gcv] || (global[gcv] = {});
44140
+ if (!coverage[path] || coverage[path].hash !== hash) {
44141
+ coverage[path] = coverageData;
44142
+ }
44143
+ var actualCoverage = coverage[path];
44144
+ {
44145
+ // @ts-ignore
44146
+ cov_28jujmuad7 = function () {
44147
+ return actualCoverage;
44148
+ };
44149
+ }
44150
+ return actualCoverage;
44151
+ }
44152
+ cov_28jujmuad7();
44153
+ var svgs = (cov_28jujmuad7().s[0]++, []);
44154
+ var useInlineSvgForRender = {
44155
+ meta: {
44156
+ type: "problem",
44157
+ fixable: "code",
44158
+ docs: {
44159
+ description: "Enforces use of inline SVG over img tag for rendering"
44160
+ }
44161
+ },
44162
+ create: function create(context) {
44163
+ cov_28jujmuad7().f[0]++;
44164
+ cov_28jujmuad7().s[1]++;
44165
+ return {
44166
+ ImportDeclaration: function ImportDeclaration(node) {
44167
+ cov_28jujmuad7().f[1]++;
44168
+ cov_28jujmuad7().s[2]++;
44169
+ if ((cov_28jujmuad7().b[1][0]++, node.source.value.startsWith(IMAGE_PATH)) && (cov_28jujmuad7().b[1][1]++, isImportFileSvg(node.source.value))) {
44170
+ cov_28jujmuad7().b[0][0]++;
44171
+ cov_28jujmuad7().s[3]++;
44172
+ svgs.push({
44173
+ svg: node.specifiers[0].local.name,
44174
+ file: context.getFilename()
44175
+ });
44176
+ } else {
44177
+ cov_28jujmuad7().b[0][1]++;
44178
+ }
44179
+ },
44180
+ JSXIdentifier: function JSXIdentifier(node) {
44181
+ cov_28jujmuad7().f[2]++;
44182
+ cov_28jujmuad7().s[4]++;
44183
+ if (node.name === "img") {
44184
+ cov_28jujmuad7().b[2][0]++;
44185
+ var _ref = (cov_28jujmuad7().s[5]++, findSrcIndexIfContainsSvg(node.parent.attributes, svgs, context.getFilename())),
44186
+ containsSvg = _ref.containsSvg,
44187
+ srcIndex = _ref.srcIndex;
44188
+ cov_28jujmuad7().s[6]++;
44189
+ if (containsSvg) {
44190
+ cov_28jujmuad7().b[3][0]++;
44191
+ cov_28jujmuad7().s[7]++;
44192
+ context.report({
44193
+ node: node,
44194
+ message: USE_INLINE_SVG_FOR_RENDER,
44195
+ fix: function fix(fixer) {
44196
+ cov_28jujmuad7().f[3]++;
44197
+ cov_28jujmuad7().s[8]++;
44198
+ return [fixer.replaceTextRange(node.range.splice(0, 2), node.parent.attributes[srcIndex].value.expression.name), fixer.remove(node.parent.attributes[srcIndex])];
44199
+ }
44200
+ });
44201
+ } else {
44202
+ cov_28jujmuad7().b[3][1]++;
44203
+ }
44204
+ } else {
44205
+ cov_28jujmuad7().b[2][1]++;
44206
+ }
44207
+ }
44208
+ };
44209
+ }
44210
+ };
44211
+
43357
44212
  function cov_1xajtj7htf() {
43358
44213
  var path = "/home/runner/work/eslint-plugin-neeto/eslint-plugin-neeto/src/lib/rules/use-neetoui-classes/constants.js";
43359
44214
  var hash = "fefb4cdd77a539c970fbd1f43ada31a0562fc452";
@@ -48420,6 +49275,7 @@
48420
49275
  "use-array-methods": useArrayMethods,
48421
49276
  "use-axios-config-for-passing-query-parameters": useAxiosConfigForPassingQueryParameters,
48422
49277
  "use-common-routes": useCommonRoutes,
49278
+ "use-inline-svg-for-render": useInlineSvgForRender,
48423
49279
  "use-neetoui-classes": useNeetouiClasses,
48424
49280
  "use-react-query-for-managing-remote-data": useReactQueryForManagingRemoteData,
48425
49281
  "use-snake-case-for-api-connector-filename": useSnakeCaseForApiConnectorFilename,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/eslint-plugin-neeto",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "main": "dist/index.js",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
@@ -66,6 +66,7 @@
66
66
  "jest": "27.5.1",
67
67
  "lint-staged": "12.4.1",
68
68
  "minimatch": "^5.1.0",
69
+ "mock-fs": "^5.2.0",
69
70
  "prettier": "2.6.2",
70
71
  "ramda": "0.28.0",
71
72
  "rollup": "^2.75.7",