@hero-design/eslint-plugin 8.0.0-4 → 8.0.0-5

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.
File without changes
package/lib/index.js CHANGED
@@ -14,6 +14,213 @@ const requireIndex = require('requireindex');
14
14
  // Plugin Definition
15
15
  //------------------------------------------------------------------------------
16
16
 
17
+ const themeKeysMap = [
18
+ {
19
+ old: 'colors.globalPrimary',
20
+ new: 'colors.onDefaultGlobalSurface',
21
+ },
22
+ {
23
+ old: 'colors.globalPrimaryLight',
24
+ new: 'colors.globalPrimaryLight',
25
+ },
26
+ {
27
+ old: 'colors.globalPrimaryBackground',
28
+ new: 'colors.defaultGlobalSurface',
29
+ },
30
+ {
31
+ old: 'colors.primaryLight',
32
+ new: 'colors.secondary',
33
+ },
34
+ {
35
+ old: 'colors.primaryDark',
36
+ new: 'colors.primary',
37
+ },
38
+ {
39
+ old: 'colors.primaryBackground',
40
+ new: 'colors.highlightedSurface',
41
+ },
42
+ {
43
+ old: 'colors.primaryBackgroundDark',
44
+ new: 'colors.mutedOnDefaultGlobalSurface',
45
+ },
46
+ {
47
+ old: 'colors.secondaryLight',
48
+ new: 'colors.secondaryLight',
49
+ },
50
+ {
51
+ old: 'colors.secondaryBackground',
52
+ new: 'colors.secondaryBackground',
53
+ },
54
+ {
55
+ old: 'colors.infoMediumLight',
56
+ new: 'colors.mutedInfo',
57
+ },
58
+ {
59
+ old: 'colors.infoLight',
60
+ new: 'colors.mutedInfo',
61
+ },
62
+ {
63
+ old: 'colors.infoBackground',
64
+ new: 'colors.infoSurface',
65
+ },
66
+ {
67
+ old: 'colors.successLight',
68
+ new: 'colors.mutedSuccess',
69
+ },
70
+ {
71
+ old: 'colors.successDark',
72
+ new: 'colors.success',
73
+ },
74
+ {
75
+ old: 'colors.successBackground',
76
+ new: 'colors.successSurface',
77
+ },
78
+ {
79
+ old: 'colors.danger',
80
+ new: 'colors.error',
81
+ },
82
+ {
83
+ old: 'colors.dangerMediumLight',
84
+ new: 'colors.mutedError',
85
+ },
86
+ {
87
+ old: 'colors.dangerLight',
88
+ new: 'colors.mutedError',
89
+ },
90
+ {
91
+ old: 'colors.dangerBackground',
92
+ new: 'colors.errorSurface',
93
+ },
94
+ {
95
+ old: 'colors.warningLight',
96
+ new: 'colors.mutedWarning',
97
+ },
98
+ {
99
+ old: 'colors.warningDark',
100
+ new: 'colors.warning',
101
+ },
102
+ {
103
+ old: 'colors.warningBackground',
104
+ new: 'colors.warningSurface',
105
+ },
106
+ {
107
+ old: 'colors.platformBackground',
108
+ new: 'colors.defaultGlobalSurface',
109
+ },
110
+ {
111
+ old: 'colors.backgroundLight',
112
+ new: 'colors.neutralGlobalSurface',
113
+ },
114
+ {
115
+ old: 'colors.backgroundDark',
116
+ new: 'colors.darkGlobalSurface',
117
+ },
118
+ {
119
+ old: 'colors.text',
120
+ new: 'colors.onDefaultGlobalSurface',
121
+ },
122
+ {
123
+ old: 'colors.subduedText',
124
+ new: 'colors.mutedOnDefaultGlobalSurface',
125
+ },
126
+ {
127
+ old: 'colors.disabledText',
128
+ new: 'colors.inactiveOnDefaultGlobalSurface',
129
+ },
130
+ {
131
+ old: 'colors.disabledLightText',
132
+ new: 'colors.disabledOnDefaultGlobalSurface',
133
+ },
134
+ {
135
+ old: 'colors.invertedText',
136
+ new: 'colors.onDarkGlobalSurface',
137
+ },
138
+ {
139
+ old: 'colors.outline',
140
+ new: 'colors.secondaryOutline',
141
+ },
142
+ {
143
+ old: 'colors.archivedLight',
144
+ new: 'colors.disabledOnDefaultGlobalSurface',
145
+ },
146
+ {
147
+ old: 'colors.archivedDark',
148
+ new: 'colors.archived',
149
+ },
150
+ {
151
+ old: 'colors.archivedBackground',
152
+ new: 'colors.archivedSurface',
153
+ },
154
+ {
155
+ old: 'colors.black',
156
+ new: 'colors.onDefaultGlobalSurface',
157
+ },
158
+ {
159
+ old: 'colors.inactiveBackground',
160
+ new: 'colors.inactiveOnDefaultGlobalSurface',
161
+ },
162
+ {
163
+ old: 'colors.shadow',
164
+ new: 'colors.secondaryOutline',
165
+ },
166
+ {
167
+ old: 'colors.mutedGlobalPrimary',
168
+ new: 'colors.mutedOnDefaultGlobalSurface',
169
+ },
170
+ {
171
+ old: 'colors.onGlobalPrimary',
172
+ new: 'colors.onDefaultGlobalSurface',
173
+ },
174
+ {
175
+ old: 'colors.globalSecondary',
176
+ new: 'colors.secondary',
177
+ },
178
+ {
179
+ old: 'colors.globalPrimaryOutline',
180
+ new: 'colors.primaryOutline',
181
+ },
182
+ {
183
+ old: 'colors.globalSecondaryOutline',
184
+ new: 'colors.secondaryOutline',
185
+ },
186
+ {
187
+ old: 'colors.mutedPrimary',
188
+ new: 'colors.mutedPrimary',
189
+ },
190
+ {
191
+ old: 'colors.highlightedSecondarySurface',
192
+ new: 'colors.highlightedSecondarySurface',
193
+ },
194
+ {
195
+ old: 'colors.mutedSecondary',
196
+ new: 'colors.mutedSecondary',
197
+ },
198
+ {
199
+ old: 'colors.disabledSecondary',
200
+ new: 'colors.disabledSecondary',
201
+ },
202
+ {
203
+ old: 'colors.lightHighlightedSurface',
204
+ new: 'colors.highlightedSurface',
205
+ },
206
+ ];
207
+ const deprecatedThemeColors = themeKeysMap.map((c) => c.old.split('.')[1]);
208
+ const boxColorProps = [
209
+ 'backgroundColor',
210
+ 'bgColor',
211
+ 'borderColor',
212
+ 'borderTopColor',
213
+ 'borderBottomColor',
214
+ 'borderStartColor',
215
+ 'borderEndColor',
216
+ 'borderLeftColor',
217
+ 'borderRightColor',
218
+ ];
219
+ const deprecatedBoxPropValues = boxColorProps.map((prop) => ({
220
+ name: prop,
221
+ values: deprecatedThemeColors,
222
+ }));
223
+
17
224
  // import all rules in lib/rules
18
225
  module.exports = {
19
226
  rules: requireIndex(__dirname + '/rules'),
@@ -22,202 +229,13 @@ module.exports = {
22
229
  plugins: ['@hero-design'],
23
230
  rules: {
24
231
  '@hero-design/no-deprecated-theme-key': [
25
- 'warn',
232
+ 'error',
26
233
  {
27
- keys: [
28
- {
29
- old: 'colors.globalPrimary',
30
- new: 'colors.onDefaultGlobalSurface',
31
- },
32
- {
33
- old: 'colors.globalPrimaryLight',
34
- new: 'colors.globalPrimaryLight',
35
- },
36
- {
37
- old: 'colors.globalPrimaryBackground',
38
- new: 'colors.defaultGlobalSurface',
39
- },
40
- {
41
- old: 'colors.primaryLight',
42
- new: 'colors.secondary',
43
- },
44
- {
45
- old: 'colors.primaryDark',
46
- new: 'colors.primary',
47
- },
48
- {
49
- old: 'colors.primaryBackground',
50
- new: 'colors.highlightedSurface',
51
- },
52
- {
53
- old: 'colors.primaryBackgroundDark',
54
- new: 'colors.mutedOnDefaultGlobalSurface',
55
- },
56
- {
57
- old: 'colors.secondaryLight',
58
- new: 'colors.secondaryLight',
59
- },
60
- {
61
- old: 'colors.secondaryBackground',
62
- new: 'colors.secondaryBackground',
63
- },
64
- {
65
- old: 'colors.infoMediumLight',
66
- new: 'colors.mutedInfo',
67
- },
68
- {
69
- old: 'colors.infoLight',
70
- new: 'colors.mutedInfo',
71
- },
72
- {
73
- old: 'colors.infoBackground',
74
- new: 'colors.infoSurface',
75
- },
76
- {
77
- old: 'colors.successLight',
78
- new: 'colors.mutedSuccess',
79
- },
80
- {
81
- old: 'colors.successDark',
82
- new: 'colors.success',
83
- },
84
- {
85
- old: 'colors.successBackground',
86
- new: 'colors.successSurface',
87
- },
88
- {
89
- old: 'colors.danger',
90
- new: 'colors.error',
91
- },
92
- {
93
- old: 'colors.dangerMediumLight',
94
- new: 'colors.mutedError',
95
- },
96
- {
97
- old: 'colors.dangerLight',
98
- new: 'colors.mutedError',
99
- },
100
- {
101
- old: 'colors.dangerBackground',
102
- new: 'colors.errorSurface',
103
- },
104
- {
105
- old: 'colors.warningLight',
106
- new: 'colors.mutedWarning',
107
- },
108
- {
109
- old: 'colors.warningDark',
110
- new: 'colors.warning',
111
- },
112
- {
113
- old: 'colors.warningBackground',
114
- new: 'colors.warningSurface',
115
- },
116
- {
117
- old: 'colors.platformBackground',
118
- new: 'colors.defaultGlobalSurface',
119
- },
120
- {
121
- old: 'colors.backgroundLight',
122
- new: 'colors.neutralGlobalSurface',
123
- },
124
- {
125
- old: 'colors.backgroundDark',
126
- new: 'colors.darkGlobalSurface',
127
- },
128
- {
129
- old: 'colors.text',
130
- new: 'colors.onDefaultGlobalSurface',
131
- },
132
- {
133
- old: 'colors.subduedText',
134
- new: 'colors.mutedOnDefaultGlobalSurface',
135
- },
136
- {
137
- old: 'colors.disabledText',
138
- new: 'colors.inactiveOnDefaultGlobalSurface',
139
- },
140
- {
141
- old: 'colors.disabledLightText',
142
- new: 'colors.disabledOnDefaultGlobalSurface',
143
- },
144
- {
145
- old: 'colors.invertedText',
146
- new: 'colors.onDarkGlobalSurface',
147
- },
148
- {
149
- old: 'colors.outline',
150
- new: 'colors.secondaryOutline',
151
- },
152
- {
153
- old: 'colors.archivedLight',
154
- new: 'colors.disabledOnDefaultGlobalSurface',
155
- },
156
- {
157
- old: 'colors.archivedDark',
158
- new: 'colors.archived',
159
- },
160
- {
161
- old: 'colors.archivedBackground',
162
- new: 'colors.archivedSurface',
163
- },
164
- {
165
- old: 'colors.black',
166
- new: 'colors.onDefaultGlobalSurface',
167
- },
168
- {
169
- old: 'colors.inactiveBackground',
170
- new: 'colors.inactiveOnDefaultGlobalSurface',
171
- },
172
- {
173
- old: 'colors.shadow',
174
- new: 'colors.secondaryOutline',
175
- },
176
- {
177
- old: 'colors.mutedGlobalPrimary',
178
- new: 'colors.mutedOnDefaultGlobalSurface',
179
- },
180
- {
181
- old: 'colors.onGlobalPrimary',
182
- new: 'colors.onDefaultGlobalSurface',
183
- },
184
- {
185
- old: 'colors.globalSecondary',
186
- new: 'colors.secondary',
187
- },
188
- {
189
- old: 'colors.globalPrimaryOutline',
190
- new: 'colors.primaryOutline',
191
- },
192
- {
193
- old: 'colors.globalSecondaryOutline',
194
- new: 'colors.secondaryOutline',
195
- },
196
- {
197
- old: 'colors.mutedPrimary',
198
- new: 'colors.mutedPrimary',
199
- },
200
- {
201
- old: 'colors.highlightedSecondarySurface',
202
- new: 'colors.highlightedSecondarySurface',
203
- },
204
- {
205
- old: 'colors.mutedSecondary',
206
- new: 'colors.mutedSecondary',
207
- },
208
- {
209
- old: 'colors.disabledSecondary',
210
- new: 'colors.disabledSecondary',
211
- },
212
- {
213
- old: 'colors.lightHighlightedSurface',
214
- new: 'colors.highlightedSurface',
215
- },
216
- ],
234
+ keys: themeKeysMap,
217
235
  },
218
236
  ],
219
237
  '@hero-design/no-deprecated-component-prop': [
220
- 'warn',
238
+ 'error',
221
239
  {
222
240
  package: '@hero-design/rn',
223
241
  components: [
@@ -237,7 +255,7 @@ module.exports = {
237
255
  },
238
256
  ],
239
257
  '@hero-design/no-deprecated-component-prop-value': [
240
- 'warn',
258
+ 'error',
241
259
  {
242
260
  package: '@hero-design/rn',
243
261
  components: [
@@ -303,6 +321,10 @@ module.exports = {
303
321
  },
304
322
  ],
305
323
  },
324
+ {
325
+ name: 'Box',
326
+ props: deprecatedBoxPropValues,
327
+ },
306
328
  ],
307
329
  },
308
330
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/eslint-plugin",
3
- "version": "8.0.0-4",
3
+ "version": "8.0.0-5",
4
4
  "description": "Hero Design's eslint plugin",
5
5
  "keywords": [
6
6
  "eslint",
@@ -26,7 +26,7 @@
26
26
  "eslint-plugin-eslint-plugin": "^5.0.0",
27
27
  "eslint-plugin-node": "^11.1.0",
28
28
  "jest": "^27.3.1",
29
- "prettier-config-hd": "8.0.0-4"
29
+ "prettier-config-hd": "8.0.0-5"
30
30
  },
31
31
  "engines": {
32
32
  "node": "^14.17.0 || ^16.0.0 || >= 18.0.0"