@dialpad/eslint-plugin-dialtone 1.1.0 → 1.1.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.
@@ -24,15 +24,85 @@ module.exports = {
24
24
  },
25
25
  },
26
26
  create(context) {
27
- const iconRegex = /.*@dialpad\/dialtone\/(vue\/.*|.+\.svg)/gm;
27
+ const iconRegex = /.*@dialpad\/dialtone\/(vue\/.*|.+\.svg)/gim;
28
+ const brandIconsList = [
29
+ 'IconAirtable',
30
+ 'IconAmex',
31
+ 'IconAppStoreBadge',
32
+ 'IconApple',
33
+ 'IconAsana',
34
+ 'IconBrandDialpadMeetings',
35
+ 'IconBrandDialpad',
36
+ 'IconBullhorn',
37
+ 'IconClockify',
38
+ 'IconCopperCrm',
39
+ 'IconDialpadAi',
40
+ 'IconDinersClub',
41
+ 'IconDiscover',
42
+ 'IconEvernote',
43
+ 'IconFacebook',
44
+ 'IconFreshsalesCrm',
45
+ 'IconFront',
46
+ 'IconGmail',
47
+ 'IconGoogleBusinessMessaging',
48
+ 'IconGoogleCalendar',
49
+ 'IconGoogleDocs',
50
+ 'IconGoogleDrive',
51
+ 'IconGoogleGlyph',
52
+ 'IconGreenhouse',
53
+ 'IconHighfive',
54
+ 'IconHubspot',
55
+ 'IconInstagram',
56
+ 'IconIntercom',
57
+ 'IconJcb',
58
+ 'IconJiraServiceDesk',
59
+ 'IconLineMessenger',
60
+ 'IconLinkedin',
61
+ 'IconMaestro',
62
+ 'IconMastercard',
63
+ 'IconMessenger',
64
+ 'IconMicrosoftDynamics365',
65
+ 'IconMicrosoftTeams',
66
+ 'IconMicrosoft',
67
+ 'IconMiro',
68
+ 'IconMondayCom',
69
+ 'IconOffice365',
70
+ 'IconPipedrive',
71
+ 'IconPlayStoreBadge',
72
+ 'IconSalesforceGlyph',
73
+ 'IconSalesforceLogo',
74
+ 'IconServicenow',
75
+ 'IconSlack',
76
+ 'IconSnapchat',
77
+ 'IconTelegram',
78
+ 'IconTiktok',
79
+ 'IconToggl',
80
+ 'IconTwitter',
81
+ 'IconUnionPay',
82
+ 'IconViber',
83
+ 'IconVisa',
84
+ 'IconWeChat',
85
+ 'IconWhatsapp',
86
+ 'IconZendesk',
87
+ 'IconZohoCrm',
88
+ 'IconZohoDesk',
89
+ 'IconZoho',
90
+ 'IconZoom',
91
+ ];
92
+
93
+ function isBrandIcon(source) {
94
+ const iconName = source.split('/').pop();
95
+ return brandIconsList.includes(iconName);
96
+ }
97
+
28
98
  //----------------------------------------------------------------------
29
99
  // Public
30
100
  //----------------------------------------------------------------------
31
101
 
32
102
  return {
33
103
  ImportDeclaration(node) {
34
- const matched = iconRegex.exec(node.source.value.toLowerCase());
35
- if (!matched ||matched.input.includes('/brand/') || matched.input.includes('/spot/')) return;
104
+ const matched = iconRegex.exec(node.source.value);
105
+ if (!matched || matched.input.includes('/brand/') || matched.input.includes('/spot/') || isBrandIcon(matched.input)) return;
36
106
 
37
107
  context.report({
38
108
  node: node,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialpad/eslint-plugin-dialtone",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "dialtone eslint plugin",
5
5
  "keywords": [
6
6
  "Dialpad",
@@ -23,9 +23,13 @@ ruleTester.run("deprecated-icons", rule, {
23
23
  code: "import svgLockIcon from '@dialpad/dialtone-icons/dist/svg/lock.svg';",
24
24
  },
25
25
  {
26
- name: 'Brand icon import',
26
+ name: 'Brand SVG icon import',
27
27
  code: "import dialpadAiIcon from '../../node_modules/@dialpad/dialtone/lib/build/svg/brand/dialpad-ai.svg';",
28
28
  },
29
+ {
30
+ name: 'Brand VUE icon import',
31
+ code: "import IconDialpadAi from '@dialpad/dialtone/vue/icons/IconDialpadAi';",
32
+ },
29
33
  {
30
34
  name: 'Spot illustration import',
31
35
  code: "import SpotBrowserTableGraph from '@dialpad/dialtone/vue/spot/SpotBrowserTableGraph';",