@salesforce-ux/eslint-plugin-slds 0.1.5 → 0.1.6

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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Ideally we should be loading this from @salesforce-ux/metadata-slds package. But the eslint package in CJS and Metadata package is ESM.
3
+ * TODO: should avoid referencing this file.
4
+ */
5
+ export declare const deprecatedClasses: string[];
@@ -0,0 +1,380 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deprecatedClasses = void 0;
4
+ /**
5
+ * Ideally we should be loading this from @salesforce-ux/metadata-slds package. But the eslint package in CJS and Metadata package is ESM.
6
+ * TODO: should avoid referencing this file.
7
+ */
8
+ exports.deprecatedClasses = [
9
+ "slds-action-overflow—touch",
10
+ "slds-action-overflow_touch__body",
11
+ "slds-action-overflow_touch__container",
12
+ "slds-action-overflow_touch__content",
13
+ "slds-action-overflow_touch__footer",
14
+ "slds-align-content-center",
15
+ "slds-app-launcher__tile_small",
16
+ "slds-app-launcher__tile-body_small",
17
+ "slds-app-launcher__tile-figure_small",
18
+ "slds-attachments__item",
19
+ "slds-box_border",
20
+ "slds-button_icon-bare",
21
+ "slds-button_small",
22
+ "slds-button-space-left",
23
+ "slds-card_empty",
24
+ "slds-chat-avatar__intials",
25
+ "slds-chat-event__rule",
26
+ "slds-checkbox—faux_container",
27
+ "slds-coach__guidance",
28
+ "slds-coach__item",
29
+ "slds-coach__keys",
30
+ "slds-coach__value",
31
+ "slds-col-rule_bottom",
32
+ "slds-col-rule_left",
33
+ "slds-col-rule_right",
34
+ "slds-col-rule_top",
35
+ "slds-collapsed",
36
+ "slds-color__background_gray-1",
37
+ "slds-color__background_gray-10",
38
+ "slds-color__background_gray-11",
39
+ "slds-color__background_gray-12",
40
+ "slds-color__background_gray-2",
41
+ "slds-color__background_gray-3",
42
+ "slds-color__background_gray-4",
43
+ "slds-color__background_gray-5",
44
+ "slds-color__background_gray-6",
45
+ "slds-color__background_gray-7",
46
+ "slds-color__background_gray-8",
47
+ "slds-color__background_gray-9",
48
+ "slds-color__border_gray-1",
49
+ "slds-color__border_gray-10",
50
+ "slds-color__border_gray-11",
51
+ "slds-color__border_gray-12",
52
+ "slds-color__border_gray-2",
53
+ "slds-color__border_gray-3",
54
+ "slds-color__border_gray-4",
55
+ "slds-color__border_gray-5",
56
+ "slds-color__border_gray-6",
57
+ "slds-color__border_gray-7",
58
+ "slds-color__border_gray-8",
59
+ "slds-color__border_gray-9",
60
+ "slds-color__fill_gray-1",
61
+ "slds-color__fill_gray-10",
62
+ "slds-color__fill_gray-11",
63
+ "slds-color__fill_gray-12",
64
+ "slds-color__fill_gray-2",
65
+ "slds-color__fill_gray-3",
66
+ "slds-color__fill_gray-4",
67
+ "slds-color__fill_gray-5",
68
+ "slds-color__fill_gray-6",
69
+ "slds-color__fill_gray-7",
70
+ "slds-color__fill_gray-8",
71
+ "slds-color__fill_gray-9",
72
+ "slds-color__text_gray-1",
73
+ "slds-color__text_gray-10",
74
+ "slds-color__text_gray-11",
75
+ "slds-color__text_gray-12",
76
+ "slds-color__text_gray-2",
77
+ "slds-color__text_gray-3",
78
+ "slds-color__text_gray-4",
79
+ "slds-color__text_gray-5",
80
+ "slds-color__text_gray-6",
81
+ "slds-color__text_gray-7",
82
+ "slds-color__text_gray-8",
83
+ "slds-color__text_gray-9",
84
+ "slds-comment__replies",
85
+ "slds-context-bar_theme-marketing",
86
+ "slds-datepicker_time",
87
+ "slds-datepicker_time__list",
88
+ "slds-disabled-text",
89
+ "slds-docked-composer_overflow__pill",
90
+ "slds-dropdown_actions",
91
+ "slds-dropdown_nubbin-top",
92
+ "slds-einstein-header",
93
+ "slds-einstein-header__actions",
94
+ "slds-einstein-header__figure",
95
+ "slds-expanded",
96
+ "slds-expression_formula__rte",
97
+ "slds-faux-input",
98
+ "slds-faux-input_label",
99
+ "slds-flip_horizontal",
100
+ "slds-flip_vertical",
101
+ "slds-global-header__button_icon",
102
+ "slds-global-header__button_icon-actions",
103
+ "slds-global-header__button_icon-favorites",
104
+ "slds-global-header__icon",
105
+ "slds-global-header__notification",
106
+ "slds-global-header__notification_unread",
107
+ "slds-has-bottom-magnet",
108
+ "slds-has-buffer",
109
+ "slds-has-full-bleed",
110
+ "slds-has-icon",
111
+ "slds-has-icon_left-right",
112
+ "slds-has-icon_right",
113
+ "slds-has-top-magnet",
114
+ "slds-icon__container",
115
+ "slds-icon__container_circle",
116
+ "slds-icon_container_circle",
117
+ "slds-icon_flip",
118
+ "slds-icon_left",
119
+ "slds-icon_right",
120
+ "slds-icon-custom-1",
121
+ "slds-icon-custom-10",
122
+ "slds-icon-custom-100",
123
+ "slds-icon-custom-101",
124
+ "slds-icon-custom-102",
125
+ "slds-icon-custom-103",
126
+ "slds-icon-custom-104",
127
+ "slds-icon-custom-105",
128
+ "slds-icon-custom-106",
129
+ "slds-icon-custom-107",
130
+ "slds-icon-custom-108",
131
+ "slds-icon-custom-109",
132
+ "slds-icon-custom-11",
133
+ "slds-icon-custom-110",
134
+ "slds-icon-custom-111",
135
+ "slds-icon-custom-112",
136
+ "slds-icon-custom-113",
137
+ "slds-icon-custom-12",
138
+ "slds-icon-custom-13",
139
+ "slds-icon-custom-14",
140
+ "slds-icon-custom-15",
141
+ "slds-icon-custom-16",
142
+ "slds-icon-custom-17",
143
+ "slds-icon-custom-18",
144
+ "slds-icon-custom-19",
145
+ "slds-icon-custom-2",
146
+ "slds-icon-custom-20",
147
+ "slds-icon-custom-21",
148
+ "slds-icon-custom-22",
149
+ "slds-icon-custom-23",
150
+ "slds-icon-custom-24",
151
+ "slds-icon-custom-25",
152
+ "slds-icon-custom-26",
153
+ "slds-icon-custom-27",
154
+ "slds-icon-custom-28",
155
+ "slds-icon-custom-29",
156
+ "slds-icon-custom-3",
157
+ "slds-icon-custom-30",
158
+ "slds-icon-custom-31",
159
+ "slds-icon-custom-32",
160
+ "slds-icon-custom-33",
161
+ "slds-icon-custom-34",
162
+ "slds-icon-custom-35",
163
+ "slds-icon-custom-36",
164
+ "slds-icon-custom-37",
165
+ "slds-icon-custom-38",
166
+ "slds-icon-custom-39",
167
+ "slds-icon-custom-4",
168
+ "slds-icon-custom-40",
169
+ "slds-icon-custom-41",
170
+ "slds-icon-custom-42",
171
+ "slds-icon-custom-43",
172
+ "slds-icon-custom-44",
173
+ "slds-icon-custom-45",
174
+ "slds-icon-custom-46",
175
+ "slds-icon-custom-47",
176
+ "slds-icon-custom-48",
177
+ "slds-icon-custom-49",
178
+ "slds-icon-custom-5",
179
+ "slds-icon-custom-50",
180
+ "slds-icon-custom-51",
181
+ "slds-icon-custom-52",
182
+ "slds-icon-custom-53",
183
+ "slds-icon-custom-54",
184
+ "slds-icon-custom-55",
185
+ "slds-icon-custom-56",
186
+ "slds-icon-custom-57",
187
+ "slds-icon-custom-58",
188
+ "slds-icon-custom-59",
189
+ "slds-icon-custom-6",
190
+ "slds-icon-custom-60",
191
+ "slds-icon-custom-61",
192
+ "slds-icon-custom-62",
193
+ "slds-icon-custom-63",
194
+ "slds-icon-custom-64",
195
+ "slds-icon-custom-65",
196
+ "slds-icon-custom-66",
197
+ "slds-icon-custom-67",
198
+ "slds-icon-custom-68",
199
+ "slds-icon-custom-69",
200
+ "slds-icon-custom-7",
201
+ "slds-icon-custom-70",
202
+ "slds-icon-custom-71",
203
+ "slds-icon-custom-72",
204
+ "slds-icon-custom-73",
205
+ "slds-icon-custom-74",
206
+ "slds-icon-custom-75",
207
+ "slds-icon-custom-76",
208
+ "slds-icon-custom-77",
209
+ "slds-icon-custom-78",
210
+ "slds-icon-custom-79",
211
+ "slds-icon-custom-8",
212
+ "slds-icon-custom-80",
213
+ "slds-icon-custom-81",
214
+ "slds-icon-custom-82",
215
+ "slds-icon-custom-83",
216
+ "slds-icon-custom-84",
217
+ "slds-icon-custom-85",
218
+ "slds-icon-custom-86",
219
+ "slds-icon-custom-87",
220
+ "slds-icon-custom-88",
221
+ "slds-icon-custom-89",
222
+ "slds-icon-custom-9",
223
+ "slds-icon-custom-90",
224
+ "slds-icon-custom-91",
225
+ "slds-icon-custom-92",
226
+ "slds-icon-custom-93",
227
+ "slds-icon-custom-94",
228
+ "slds-icon-custom-95",
229
+ "slds-icon-custom-96",
230
+ "slds-icon-custom-97",
231
+ "slds-icon-custom-98",
232
+ "slds-icon-custom-99",
233
+ "slds-icon-standard-task-2",
234
+ "slds-icon-utility-error",
235
+ "slds-icon-utility-warning",
236
+ "slds-indicator-container",
237
+ "slds-is-focused",
238
+ "slds-is-interactive",
239
+ "slds-kx-is-animating-from-click",
240
+ "slds-large",
241
+ "slds-large-nowrap",
242
+ "slds-lookup",
243
+ "slds-lookup__item",
244
+ "slds-lookup__item_label",
245
+ "slds-lookup__item-action",
246
+ "slds-lookup__item-action_label",
247
+ "slds-lookup__list",
248
+ "lookup",
249
+ "slds-lookup__pill-container",
250
+ "slds-lookup__result-meta",
251
+ "slds-lookup__result-text",
252
+ "slds-lookup__search-input",
253
+ "slds-m-left_xxx-small",
254
+ "slds-max-medium-table_stacked",
255
+ "slds-max-medium-table_stacked-horizontal",
256
+ "slds-media__figure_fixed-width",
257
+ "slds-media_double",
258
+ "slds-media_responsive",
259
+ "slds-media_reverse",
260
+ "slds-media_timeline",
261
+ "slds-medium",
262
+ "slds-medium-nowrap",
263
+ "slds-mobile-combobox",
264
+ "slds-mobile-combobox__addon",
265
+ "slds-mobile-combobox__header",
266
+ "slds-mobile-combobox__header-has-icon",
267
+ "slds-mobile-combobox__input",
268
+ "slds-mobile-lookup__listbox",
269
+ "slds-mobile-lookup__listbox_container",
270
+ "slds-mobile-lookup__listbox_icon_container",
271
+ "slds-mobile-lookup__listbox_loader",
272
+ "slds-mobile-lookup__listbox_meta",
273
+ "slds-mobile-lookup__listbox_text",
274
+ "slds-mobile-lookup__listbox_trigger",
275
+ "slds-mobile-lookup__listbox-option",
276
+ "slds-mobile-lookup__listbox-option_heading",
277
+ "slds-modal__",
278
+ "slds-modal_form",
279
+ "slds-navigation-list—vertical-inverse",
280
+ "slds-navigation-list-vertical",
281
+ "slds-navigation-list-vertical__action",
282
+ "slds-navigation-list-vertical_shade",
283
+ "slds-notify",
284
+ "slds-notify-container",
285
+ "slds-page-header_joined",
286
+ "slds-page-header_object-home",
287
+ "slds-panel_filters",
288
+ "slds-path-coach",
289
+ "slds-picklist",
290
+ "slds-picklist__input",
291
+ "slds-picklist__item",
292
+ "slds-picklist_draggable",
293
+ "slds-picklist_fluid",
294
+ "slds-popover_einstein",
295
+ "slds-popover_feature",
296
+ "slds-popover_walkthrough",
297
+ "slds-popover_walkthrough-alt",
298
+ "slds-region",
299
+ "slds-region__pinned-top",
300
+ "slds-section-group_is-closed",
301
+ "slds-section-title",
302
+ "slds-small",
303
+ "slds-small-nowrap",
304
+ "slds-tab__scroll-controls",
305
+ "slds-table_joined",
306
+ "slds-table_joined-wrapper",
307
+ "slds-table—edit_container",
308
+ "slds-table—edit_container-message",
309
+ "slds-table—header-fixed_container",
310
+ "slds-tabs__content",
311
+ "slds-tabs__item",
312
+ "slds-tabs__nav-scroller",
313
+ "slds-tabs__nav-scroller_inner",
314
+ "slds-tabs_default__header",
315
+ "slds-tabs_mobile",
316
+ "slds-tabs_mobile__item",
317
+ "slds-tabs_mobile__title",
318
+ "slds-tabs_mobile__title-action",
319
+ "slds-tabs_path",
320
+ "slds-tabs_path__content",
321
+ "slds-tabs_path__item",
322
+ "slds-tabs_path__link",
323
+ "slds-tabs_path__nav",
324
+ "slds-tabs_path__stage",
325
+ "slds-tabs_path__title",
326
+ "slds-tabs-mobile",
327
+ "slds-tabs-mobile__group",
328
+ "slds-tabs-mobile__item",
329
+ "slds-tags",
330
+ "slds-tags__item",
331
+ "slds-tags__list",
332
+ "slds-text-heading_label-normal",
333
+ "slds-theme",
334
+ "slds-theme_alert-texture",
335
+ "slds-theme_offline",
336
+ "slds-timeline__media",
337
+ "slds-timeline__media_call",
338
+ "slds-timeline__media_email",
339
+ "slds-timeline__media_event",
340
+ "slds-timeline__media_task",
341
+ "slds-timeline__title",
342
+ "slds-timeline__title-content",
343
+ "slds-tooltip",
344
+ "slds-tooltip__body",
345
+ "slds-truncate_container—25",
346
+ "slds-truncate_container—33",
347
+ "slds-truncate_container—50",
348
+ "slds-truncate_container—66",
349
+ "slds-truncate_container—75",
350
+ "slds-var-m-around_xxx-small",
351
+ "slds-var-m-bottom_xxx-small",
352
+ "slds-var-m-horizontal_xxx-small",
353
+ "slds-var-m-left_xxx-small",
354
+ "slds-var-m-right_xxx-small",
355
+ "slds-var-m-top_xxx-small",
356
+ "slds-var-m-vertical_xxx-small",
357
+ "slds-var-p-around_xxx-small",
358
+ "slds-var-p-bottom_xxx-small",
359
+ "slds-var-p-horizontal_xxx-small",
360
+ "slds-var-p-left_xxx-small",
361
+ "slds-var-p-right_xxx-small",
362
+ "slds-var-p-top_xxx-small",
363
+ "slds-var-p-vertical_xxx-small",
364
+ "slds-video",
365
+ "slds-video_center",
366
+ "slds-video_right",
367
+ "slds-welcome-mat__info-badge",
368
+ "slds-welcome-mat__info-badge-container",
369
+ "slds-welcome-mat__info-progress_complete",
370
+ "slds-wizard",
371
+ "slds-wizard__item",
372
+ "slds-wizard__label",
373
+ "slds-wizard__link",
374
+ "slds-wizard__list",
375
+ "slds-wizard__marker",
376
+ "slds-wizard__progress",
377
+ "slds-wizard__progress-bar",
378
+ "slds-x-small",
379
+ "slds-x-small-nowrap"
380
+ ];
@@ -0,0 +1,28 @@
1
+ declare const _default: {
2
+ meta: {
3
+ type: string;
4
+ docs: {
5
+ category: string;
6
+ recommended: boolean;
7
+ description: string;
8
+ url: string;
9
+ };
10
+ fixable: string;
11
+ schema: {
12
+ type: string;
13
+ properties: {
14
+ pattern: {
15
+ type: string;
16
+ };
17
+ flags: {
18
+ type: string;
19
+ };
20
+ };
21
+ additionalProperties: boolean;
22
+ }[];
23
+ };
24
+ create(context: any): {
25
+ Tag: (node: any) => void;
26
+ };
27
+ };
28
+ export = _default;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ const node_1 = require("./utils/node");
3
+ const bem_mapping_1 = require("./bem-mapping");
4
+ module.exports = {
5
+ meta: {
6
+ type: "problem", // The rule type
7
+ docs: {
8
+ category: "Stylistic Issues",
9
+ recommended: true,
10
+ description: "Replace BEM double-dash syntax in class names with single underscore syntax.",
11
+ url: ""
12
+ },
13
+ fixable: "code", // This rule can be fixed automatically
14
+ schema: [
15
+ {
16
+ type: "object",
17
+ properties: {
18
+ pattern: { type: "string" }, // Regex pattern for BEM
19
+ flags: { type: "string" }, // Regex flags
20
+ },
21
+ additionalProperties: false,
22
+ },
23
+ ],
24
+ },
25
+ create(context) {
26
+ function check(node) {
27
+ if ((0, node_1.isAttributesEmpty)(node)) {
28
+ return;
29
+ }
30
+ const classAttr = (0, node_1.findAttr)(node, "class");
31
+ if (classAttr && classAttr.value) {
32
+ const classNames = classAttr.value.value.split(/\s+/);
33
+ classNames.forEach((className) => {
34
+ if (className && className in bem_mapping_1.bemMapping) {
35
+ // Find the exact location of the problematic class name
36
+ const classNameStart = classAttr.value.value.indexOf(className) + 7; // 7 here is for `class= "`
37
+ const classNameEnd = classNameStart + className.length;
38
+ // Use the loc property to get line and column from the class attribute
39
+ const startLoc = {
40
+ line: classAttr.loc.start.line,
41
+ column: classAttr.loc.start.column + classNameStart,
42
+ };
43
+ const endLoc = {
44
+ line: classAttr.loc.start.line,
45
+ column: classAttr.loc.start.column + classNameEnd,
46
+ };
47
+ // Check whether a fixed class is available
48
+ const newValue = bem_mapping_1.bemMapping[className];
49
+ context.report({
50
+ node,
51
+ loc: { start: startLoc, end: endLoc },
52
+ data: {
53
+ actual: className,
54
+ newValue
55
+ },
56
+ message: JSON.stringify({ message: "{{actual}} has been retired. Update it to the new name {{newValue}}.", suggestions: [newValue] }),
57
+ fix(fixer) {
58
+ if (newValue) {
59
+ const newClassValue = classAttr.value.value.replace(className, newValue);
60
+ return fixer.replaceTextRange([classAttr.value.range[0], classAttr.value.range[1]], `${newClassValue}`);
61
+ }
62
+ return null; // Ensure a return value even if no fix is applied
63
+ },
64
+ });
65
+ }
66
+ });
67
+ }
68
+ }
69
+ return {
70
+ Tag: check,
71
+ };
72
+ },
73
+ };
@@ -0,0 +1,17 @@
1
+ declare const _default: {
2
+ meta: {
3
+ type: string;
4
+ docs: {
5
+ category: string;
6
+ recommended: boolean;
7
+ description: string;
8
+ url: string;
9
+ };
10
+ fixable: string;
11
+ schema: any[];
12
+ };
13
+ create(context: any): {
14
+ Tag: (node: any) => void;
15
+ };
16
+ };
17
+ export = _default;