@salesforce-ux/eslint-plugin-slds 0.1.0 → 0.1.2-alpha.0
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.
- package/.eslintrc.yml +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.js +2 -2
- package/build/rules/bem-mapping.d.ts +1166 -1166
- package/build/rules/bem-mapping.js +1166 -1166
- package/build/rules/enforce-bem-class.d.ts +1 -2
- package/build/rules/enforce-bem-class.js +4 -6
- package/build/rules/modal-close-button-issue.d.ts +0 -1
- package/build/rules/modal-close-button-issue.js +5 -6
- package/build/rules/{no-deprecated-slds2-classes.d.ts → no-deprecated-classes-slds2.d.ts} +1 -2
- package/build/rules/{no-deprecated-slds2-classes.js → no-deprecated-classes-slds2.js} +2 -3
- package/package.json +1 -1
|
@@ -2,7 +2,6 @@ declare const _default: {
|
|
|
2
2
|
meta: {
|
|
3
3
|
type: string;
|
|
4
4
|
docs: {
|
|
5
|
-
description: string;
|
|
6
5
|
category: string;
|
|
7
6
|
recommended: boolean;
|
|
8
7
|
};
|
|
@@ -20,7 +19,7 @@ declare const _default: {
|
|
|
20
19
|
additionalProperties: boolean;
|
|
21
20
|
}[];
|
|
22
21
|
messages: {
|
|
23
|
-
|
|
22
|
+
suggestedMsg: string;
|
|
24
23
|
};
|
|
25
24
|
};
|
|
26
25
|
create(context: any): {
|
|
@@ -5,7 +5,6 @@ module.exports = {
|
|
|
5
5
|
meta: {
|
|
6
6
|
type: "problem", // The rule type
|
|
7
7
|
docs: {
|
|
8
|
-
description: "Enforce consistent class naming using BEM convention",
|
|
9
8
|
category: "Stylistic Issues",
|
|
10
9
|
recommended: true,
|
|
11
10
|
},
|
|
@@ -21,12 +20,10 @@ module.exports = {
|
|
|
21
20
|
},
|
|
22
21
|
],
|
|
23
22
|
messages: {
|
|
24
|
-
|
|
23
|
+
suggestedMsg: "{{actual}} has been retired. Update it to the new name {{newValue}}.",
|
|
25
24
|
},
|
|
26
25
|
},
|
|
27
26
|
create(context) {
|
|
28
|
-
const pattern = /^(?:[a-z0-9]+(?:-[a-z0-9]+)*)(__[a-z0-9]+(?:-[a-z0-9]+)*)?(--[a-z0-9]+(?:-[a-z0-9]+)*)?$/;
|
|
29
|
-
const checkNaming = (name) => pattern.test(name);
|
|
30
27
|
function check(node) {
|
|
31
28
|
if ((0, node_1.isAttributesEmpty)(node)) {
|
|
32
29
|
return;
|
|
@@ -35,7 +32,7 @@ module.exports = {
|
|
|
35
32
|
if (classAttr && classAttr.value) {
|
|
36
33
|
const classNames = classAttr.value.value.split(/\s+/);
|
|
37
34
|
classNames.forEach((className) => {
|
|
38
|
-
if (className &&
|
|
35
|
+
if (className && className in bem_mapping_1.bemMapping) {
|
|
39
36
|
// Find the exact location of the problematic class name
|
|
40
37
|
const classNameStart = classAttr.value.value.indexOf(className) + 7; // 7 here is for `class= "`
|
|
41
38
|
const classNameEnd = classNameStart + className.length;
|
|
@@ -55,8 +52,9 @@ module.exports = {
|
|
|
55
52
|
loc: { start: startLoc, end: endLoc },
|
|
56
53
|
data: {
|
|
57
54
|
actual: className,
|
|
55
|
+
newValue
|
|
58
56
|
},
|
|
59
|
-
messageId: "
|
|
57
|
+
messageId: "suggestedMsg",
|
|
60
58
|
fix(fixer) {
|
|
61
59
|
if (newValue) {
|
|
62
60
|
const newClassValue = classAttr.value.value.replace(className, newValue);
|
|
@@ -4,18 +4,17 @@ module.exports = {
|
|
|
4
4
|
meta: {
|
|
5
5
|
type: "problem",
|
|
6
6
|
docs: {
|
|
7
|
-
description: "Ensure SLDS modal compliance by enforcing correct button and icon attributes.",
|
|
8
7
|
category: "Best Practices",
|
|
9
8
|
recommended: true,
|
|
10
9
|
},
|
|
11
10
|
fixable: "code",
|
|
12
11
|
schema: [],
|
|
13
12
|
messages: {
|
|
14
|
-
removeClass: "Remove the
|
|
15
|
-
changeVariant: "Change
|
|
16
|
-
removeVariant: "Remove
|
|
17
|
-
ensureButtonClasses: "
|
|
18
|
-
ensureSizeAttribute: "
|
|
13
|
+
removeClass: "Remove the slds-button_icon-inverse class from the modal close button in components that use the SLDS modal blueprint.",
|
|
14
|
+
changeVariant: "Change the variant attribute value from bare-inverse to bare in <lightning-button-icon> or <lightning-icon>.",
|
|
15
|
+
removeVariant: "Remove the variant attribute from the <lightning-icon> component inside the <button> element.",
|
|
16
|
+
ensureButtonClasses: "Add or move slds-button and slds-button_icon to the class attribute of the <button> element or <lightning-button-icon> component.",
|
|
17
|
+
ensureSizeAttribute: "To size icons properly, set the size attribute to large in the <lightning-icon> and <lightning-button-icon> components.",
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
create(context) {
|
|
@@ -2,13 +2,12 @@ declare const _default: {
|
|
|
2
2
|
meta: {
|
|
3
3
|
type: string;
|
|
4
4
|
docs: {
|
|
5
|
-
description: string;
|
|
6
5
|
category: string;
|
|
7
6
|
recommended: boolean;
|
|
8
7
|
};
|
|
9
8
|
schema: any[];
|
|
10
9
|
messages: {
|
|
11
|
-
|
|
10
|
+
errorMsg: string;
|
|
12
11
|
};
|
|
13
12
|
};
|
|
14
13
|
create(context: any): {
|
|
@@ -6,13 +6,12 @@ module.exports = {
|
|
|
6
6
|
meta: {
|
|
7
7
|
type: "problem", // The rule type
|
|
8
8
|
docs: {
|
|
9
|
-
description: "Disallow usage of deprecated CSS classes",
|
|
10
9
|
category: "Best Practices",
|
|
11
10
|
recommended: true,
|
|
12
11
|
},
|
|
13
12
|
schema: [], // No additional options needed
|
|
14
13
|
messages: {
|
|
15
|
-
|
|
14
|
+
errorMsg: "The class {{className}} isn't available in SLDS 2. Update it to a class supported in SLDS 2. See lightningdesignsystem.com for more information.",
|
|
16
15
|
},
|
|
17
16
|
},
|
|
18
17
|
create(context) {
|
|
@@ -43,7 +42,7 @@ module.exports = {
|
|
|
43
42
|
data: {
|
|
44
43
|
className,
|
|
45
44
|
},
|
|
46
|
-
messageId: "
|
|
45
|
+
messageId: "errorMsg",
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
});
|