@salesforce-ux/eslint-plugin-slds 1.0.8-internal → 1.0.9-internal
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/build/config/rule-messages.d.ts +2 -0
- package/build/config/rule-messages.js +197 -0
- package/build/config/rule-messages.js.map +7 -0
- package/build/index.js +40 -2471
- package/build/index.js.map +4 -4
- package/build/rules/enforce-bem-usage.js +16 -232
- package/build/rules/enforce-bem-usage.js.map +4 -4
- package/build/rules/modal-close-button-issue.js +11 -183
- package/build/rules/modal-close-button-issue.js.map +4 -4
- package/build/rules/no-deprecated-classes-slds2.js +4 -176
- package/build/rules/no-deprecated-classes-slds2.js.map +4 -4
- package/build/rules/v9/enforce-bem-usage.js +1 -161
- package/build/rules/v9/enforce-bem-usage.js.map +4 -4
- package/build/rules/v9/enforce-component-hook-naming-convention.js +1 -161
- package/build/rules/v9/enforce-component-hook-naming-convention.js.map +4 -4
- package/build/rules/v9/enforce-sds-to-slds-hooks.js +1 -161
- package/build/rules/v9/enforce-sds-to-slds-hooks.js.map +4 -4
- package/build/rules/v9/lwc-token-to-slds-hook.js +4 -262
- package/build/rules/v9/lwc-token-to-slds-hook.js.map +4 -4
- package/build/rules/v9/no-deprecated-slds-classes.js +1 -161
- package/build/rules/v9/no-deprecated-slds-classes.js.map +4 -4
- package/build/rules/v9/no-deprecated-tokens-slds1.js +29 -168
- package/build/rules/v9/no-deprecated-tokens-slds1.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/boxShadowHandler.js +9 -289
- package/build/rules/v9/no-hardcoded-values/handlers/boxShadowHandler.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/colorHandler.js +13 -283
- package/build/rules/v9/no-hardcoded-values/handlers/colorHandler.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/densityHandler.js +12 -328
- package/build/rules/v9/no-hardcoded-values/handlers/densityHandler.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/fontHandler.js +13 -309
- package/build/rules/v9/no-hardcoded-values/handlers/fontHandler.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/handlers/index.js +8 -875
- package/build/rules/v9/no-hardcoded-values/handlers/index.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds1.js +3 -1208
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds1.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds2.js +3 -1208
- package/build/rules/v9/no-hardcoded-values/no-hardcoded-values-slds2.js.map +4 -4
- package/build/rules/v9/no-hardcoded-values/noHardcodedValueRule.js +22 -993
- package/build/rules/v9/no-hardcoded-values/noHardcodedValueRule.js.map +4 -4
- package/build/rules/v9/no-slds-class-overrides.js +1 -161
- package/build/rules/v9/no-slds-class-overrides.js.map +4 -4
- package/build/rules/v9/no-slds-namespace-for-custom-hooks.js +3 -252
- package/build/rules/v9/no-slds-namespace-for-custom-hooks.js.map +4 -4
- package/build/rules/v9/no-slds-private-var.js +1 -161
- package/build/rules/v9/no-slds-private-var.js.map +4 -4
- package/build/rules/v9/no-slds-var-without-fallback.js +3 -255
- package/build/rules/v9/no-slds-var-without-fallback.js.map +4 -4
- package/build/rules/v9/no-sldshook-fallback-for-lwctoken.js +1 -161
- package/build/rules/v9/no-sldshook-fallback-for-lwctoken.js.map +4 -4
- package/build/rules/v9/no-unsupported-hooks-slds2.js +1 -161
- package/build/rules/v9/no-unsupported-hooks-slds2.js.map +4 -4
- package/build/rules/v9/reduce-annotations.js +1 -161
- package/build/rules/v9/reduce-annotations.js.map +4 -4
- package/build/{src/utils → utils}/boxShadowValueParser.d.ts +1 -1
- package/build/utils/boxShadowValueParser.js +63 -93
- package/build/utils/boxShadowValueParser.js.map +4 -4
- package/build/utils/color-lib-utils.js +2 -29
- package/build/utils/color-lib-utils.js.map +3 -3
- package/build/{src/utils → utils}/css-utils.d.ts +7 -0
- package/build/utils/css-utils.js +10 -71
- package/build/utils/css-utils.js.map +4 -4
- package/build/utils/hardcoded-shared-utils.js +17 -82
- package/build/utils/hardcoded-shared-utils.js.map +4 -4
- package/build/utils/property-matcher.js +2 -2
- package/build/utils/property-matcher.js.map +2 -2
- package/build/utils/styling-hook-utils.js +16 -39
- package/build/utils/styling-hook-utils.js.map +3 -3
- package/build/{src/utils → utils}/value-utils.d.ts +2 -2
- package/build/utils/value-utils.js +8 -8
- package/build/utils/value-utils.js.map +2 -2
- package/package.json +5 -10
- package/src/config/rule-messages.yml +0 -143
- /package/build/{src/index.d.ts → index.d.ts} +0 -0
- /package/build/{src/rules → rules}/enforce-bem-usage.d.ts +0 -0
- /package/build/{src/rules → rules}/modal-close-button-issue.d.ts +0 -0
- /package/build/{src/rules → rules}/no-deprecated-classes-slds2.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/enforce-bem-usage.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/enforce-component-hook-naming-convention.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/enforce-sds-to-slds-hooks.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/lwc-token-to-slds-hook.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-deprecated-slds-classes.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-deprecated-tokens-slds1.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/boxShadowHandler.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/colorHandler.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/densityHandler.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/fontHandler.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/handlers/index.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/no-hardcoded-values-slds1.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/no-hardcoded-values-slds2.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/noHardcodedValueRule.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-hardcoded-values/ruleOptionsSchema.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-slds-class-overrides.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-slds-namespace-for-custom-hooks.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-slds-private-var.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-slds-var-without-fallback.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-sldshook-fallback-for-lwctoken.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/no-unsupported-hooks-slds2.d.ts +0 -0
- /package/build/{src/rules → rules}/v9/reduce-annotations.d.ts +0 -0
- /package/build/{src/types → types}/index.d.ts +0 -0
- /package/build/{src/utils → utils}/color-lib-utils.d.ts +0 -0
- /package/build/{src/utils → utils}/css-functions.d.ts +0 -0
- /package/build/{src/utils → utils}/custom-mapping-utils.d.ts +0 -0
- /package/build/{src/utils → utils}/hardcoded-shared-utils.d.ts +0 -0
- /package/build/{src/utils → utils}/node.d.ts +0 -0
- /package/build/{src/utils → utils}/property-matcher.d.ts +0 -0
- /package/build/{src/utils → utils}/rule-utils.d.ts +0 -0
- /package/build/{src/utils → utils}/styling-hook-utils.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/property-matcher.ts"],
|
|
4
|
-
"sourcesContent": ["///stylelint-sds/packages/stylelint-plugin-slds/src/utils/property-matcher.ts\n/**\n * Check if any of the hook properties match the provided cssProperty using wildcard matching.\n * @param hookProperties - Array of property patterns (can contain wildcards like `*`)\n * @param cssProperty - The CSS property to be checked\n * @returns true if a match is found, otherwise false\n */\nexport function matchesCssProperty(\n hookProperties: string[],\n cssProperty: string\n): boolean {\n return hookProperties.some((propertyPattern: string) => {\n const regexPattern = new RegExp(\n '^' + propertyPattern.replace(/\\*/g, '.*') + '$'\n );\n return regexPattern.test(cssProperty);\n });\n}\n\n// Directions & Corners\nconst DIRECTION_VALUES = '(?:top|right|bottom|left|inline|block|inline-start|inline-end|start|end|block-start|block-end)';\nconst CORNER_VALUES = '(?:top-left|top-right|bottom-right|bottom-left|start-start|start-end|end-start|end-end)';\nconst INSET_VALUES = '(?:inline|block|inline-start|inline-end|block-start|block-end)';\n\n\n// Pre-compiled regex patterns for better performance\nconst BORDER_COLOR_REGEX = new RegExp(`^border(?:-${DIRECTION_VALUES})?-color$`);\nconst BORDER_WIDTH_REGEX = new RegExp(`^border(?:-${DIRECTION_VALUES})?-width$`);\nconst MARGIN_REGEX = new RegExp(`^margin(?:-${DIRECTION_VALUES})?$`);\nconst PADDING_REGEX = new RegExp(`^padding(?:-${DIRECTION_VALUES})?$`);\nconst BORDER_RADIUS_REGEX = new RegExp(`^border(?:-${CORNER_VALUES})?-radius$`);\nconst INSET_REGEX = new RegExp(`^inset(?:-${INSET_VALUES})?$`);\n\nexport function isBorderColorProperty(cssProperty: string): boolean {\n return BORDER_COLOR_REGEX.test(cssProperty);\n}\n\nexport function isBorderWidthProperty(cssProperty: string): boolean {\n return BORDER_WIDTH_REGEX.test(cssProperty);\n}\n\nexport function isMarginProperty(cssProperty: string): boolean {\n return MARGIN_REGEX.test(cssProperty);\n}\n\nexport function isPaddingProperty(cssProperty: string): boolean {\n return PADDING_REGEX.test(cssProperty);\n}\n\nexport function isBorderRadius(cssProperty: string): boolean {\n return BORDER_RADIUS_REGEX.test(cssProperty);\n}\n\nexport function isDimensionProperty(cssProperty: string): boolean {\n return ['width', 'height', 'min-width', 'max-width', 'min-height', 'max-height'].includes(cssProperty);\n}\n\nexport function isInsetProperty(cssProperty: string): boolean {\n return INSET_REGEX.test(cssProperty);\n}\n\nexport const fontProperties = [\n 'font',\n 'font-size', \n 'font-weight'\n];\n\nexport const colorProperties = [\n 'color',\n 'fill',\n 'background',\n 'background-color',\n 'stroke',\n 'border',\n 'border*',\n 'border*-color',\n 'outline',\n 'outline-color',\n];\n\nexport const densificationProperties = [\n 'border*',\n 'margin*',\n 'padding*',\n 'width',\n 'height',\n 'min-width',\n 'max-width',\n 'min-height',\n 'max-height',\n 'inset',\n 'top',\n 'right',\n 'left',\n 'bottom',\n 'outline',\n 'outline-width',\n 'line-height'\n]; \n\n/**\n * Convert property patterns to CSS AST selector patterns\n * Handles wildcards (*) and creates proper ESLint CSS selector syntax\n */\nexport function toSelector(properties: string[]): string {\n const selectorParts = properties.map(prop => {\n if (prop.includes('*')) {\n // Convert wildcards to regex patterns for CSS AST selectors\n // Anchor to start of string to prevent matching CSS custom properties\n const regexPattern = prop.replace(/\\*/g, '.*');\n return `Declaration[property=/^${regexPattern}$/]`;\n } else {\n // Exact property match\n return `Declaration[property='${prop}']`;\n }\n });\n \n return selectorParts.join(', ');\n}\n\nexport function resolveDensityPropertyToMatch(cssProperty:string){\n const propertyToMatch = cssProperty.toLowerCase();\n if(isOutlineWidthProperty(propertyToMatch) || isBorderWidthProperty(propertyToMatch)){\n return 'border-width';\n } else if(isMarginProperty(propertyToMatch)){\n return 'margin';\n } else if(isPaddingProperty(propertyToMatch)){\n return 'padding';\n } else if(isBorderRadius(propertyToMatch)){\n return 'border-radius';\n } else if(isDimensionProperty(propertyToMatch)){\n // Stylinghooks includes only width as property to match, for all other dimensions we need to match width\n return 'width';\n } else if(isInsetProperty(propertyToMatch)){\n // Stylinghooks includes only top/left/right/bottom as property to match, for all other insets we need to match top\n return 'top';\n }\n return propertyToMatch;\n}\n\nexport function resolveColorPropertyToMatch(cssProperty:string){\n const propertyToMatch = cssProperty.toLowerCase();\n if(propertyToMatch === 'outline' || propertyToMatch === 'outline-color'){\n return 'border-color';\n } else if(propertyToMatch === 'background' || propertyToMatch === 'background-color'){\n return 'background-color';\n } else if(isBorderColorProperty(propertyToMatch)){\n return 'border-color';\n }\n return propertyToMatch;\n}\n\nexport function isOutlineWidthProperty(propertyToMatch:string){\n return propertyToMatch === 'outline' || propertyToMatch === 'outline-width';\n}"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,mBACd,gBACA,aACS;AACT,SAAO,eAAe,KAAK,CAAC,oBAA4B;AACtD,UAAM,eAAe,IAAI;AAAA,MACvB,MAAM,gBAAgB,QAAQ,OAAO,IAAI,IAAI;AAAA,IAC/C;AACA,WAAO,aAAa,KAAK,WAAW;AAAA,EACtC,CAAC;AACH;AAGA,IAAM,mBAAmB;AACzB,IAAM,gBAAgB;AACtB,IAAM,eAAe;AAIrB,IAAM,qBAAqB,IAAI,OAAO,cAAc,gBAAgB,WAAW;AAC/E,IAAM,qBAAqB,IAAI,OAAO,cAAc,gBAAgB,WAAW;AAC/E,IAAM,eAAe,IAAI,OAAO,cAAc,gBAAgB,KAAK;AACnE,IAAM,gBAAgB,IAAI,OAAO,eAAe,gBAAgB,KAAK;AACrE,IAAM,sBAAsB,IAAI,OAAO,cAAc,aAAa,YAAY;AAC9E,IAAM,cAAc,IAAI,OAAO,aAAa,YAAY,KAAK;AAEtD,SAAS,sBAAsB,aAA8B;AAClE,SAAO,mBAAmB,KAAK,WAAW;
|
|
4
|
+
"sourcesContent": ["///stylelint-sds/packages/stylelint-plugin-slds/src/utils/property-matcher.ts\n/**\n * Check if any of the hook properties match the provided cssProperty using wildcard matching.\n * @param hookProperties - Array of property patterns (can contain wildcards like `*`)\n * @param cssProperty - The CSS property to be checked\n * @returns true if a match is found, otherwise false\n */\nexport function matchesCssProperty(\n hookProperties: string[],\n cssProperty: string\n): boolean {\n return hookProperties.some((propertyPattern: string) => {\n const regexPattern = new RegExp(\n '^' + propertyPattern.replace(/\\*/g, '.*') + '$'\n );\n return regexPattern.test(cssProperty);\n });\n}\n\n// Directions & Corners\nconst DIRECTION_VALUES = '(?:top|right|bottom|left|inline|block|inline-start|inline-end|start|end|block-start|block-end)';\nconst CORNER_VALUES = '(?:top-left|top-right|bottom-right|bottom-left|start-start|start-end|end-start|end-end)';\nconst INSET_VALUES = '(?:inline|block|inline-start|inline-end|block-start|block-end)';\n\n\n// Pre-compiled regex patterns for better performance\nconst BORDER_COLOR_REGEX = new RegExp(`^border(?:-${DIRECTION_VALUES})?-color$`);\nconst BORDER_WIDTH_REGEX = new RegExp(`^border(?:-${DIRECTION_VALUES})?-width$`);\nconst MARGIN_REGEX = new RegExp(`^margin(?:-${DIRECTION_VALUES})?$`);\nconst PADDING_REGEX = new RegExp(`^padding(?:-${DIRECTION_VALUES})?$`);\nconst BORDER_RADIUS_REGEX = new RegExp(`^border(?:-${CORNER_VALUES})?-radius$`);\nconst INSET_REGEX = new RegExp(`^inset(?:-${INSET_VALUES})?$`);\n\nexport function isBorderColorProperty(cssProperty: string): boolean {\n return cssProperty === 'border' || BORDER_COLOR_REGEX.test(cssProperty);\n}\n\nexport function isBorderWidthProperty(cssProperty: string): boolean {\n return cssProperty === 'border' || BORDER_WIDTH_REGEX.test(cssProperty);\n}\n\nexport function isMarginProperty(cssProperty: string): boolean {\n return MARGIN_REGEX.test(cssProperty);\n}\n\nexport function isPaddingProperty(cssProperty: string): boolean {\n return PADDING_REGEX.test(cssProperty);\n}\n\nexport function isBorderRadius(cssProperty: string): boolean {\n return BORDER_RADIUS_REGEX.test(cssProperty);\n}\n\nexport function isDimensionProperty(cssProperty: string): boolean {\n return ['width', 'height', 'min-width', 'max-width', 'min-height', 'max-height'].includes(cssProperty);\n}\n\nexport function isInsetProperty(cssProperty: string): boolean {\n return INSET_REGEX.test(cssProperty);\n}\n\nexport const fontProperties = [\n 'font',\n 'font-size', \n 'font-weight'\n];\n\nexport const colorProperties = [\n 'color',\n 'fill',\n 'background',\n 'background-color',\n 'stroke',\n 'border',\n 'border*',\n 'border*-color',\n 'outline',\n 'outline-color',\n];\n\nexport const densificationProperties = [\n 'border*',\n 'margin*',\n 'padding*',\n 'width',\n 'height',\n 'min-width',\n 'max-width',\n 'min-height',\n 'max-height',\n 'inset',\n 'top',\n 'right',\n 'left',\n 'bottom',\n 'outline',\n 'outline-width',\n 'line-height'\n]; \n\n/**\n * Convert property patterns to CSS AST selector patterns\n * Handles wildcards (*) and creates proper ESLint CSS selector syntax\n */\nexport function toSelector(properties: string[]): string {\n const selectorParts = properties.map(prop => {\n if (prop.includes('*')) {\n // Convert wildcards to regex patterns for CSS AST selectors\n // Anchor to start of string to prevent matching CSS custom properties\n const regexPattern = prop.replace(/\\*/g, '.*');\n return `Declaration[property=/^${regexPattern}$/]`;\n } else {\n // Exact property match\n return `Declaration[property='${prop}']`;\n }\n });\n \n return selectorParts.join(', ');\n}\n\nexport function resolveDensityPropertyToMatch(cssProperty:string){\n const propertyToMatch = cssProperty.toLowerCase();\n if(isOutlineWidthProperty(propertyToMatch) || isBorderWidthProperty(propertyToMatch)){\n return 'border-width';\n } else if(isMarginProperty(propertyToMatch)){\n return 'margin';\n } else if(isPaddingProperty(propertyToMatch)){\n return 'padding';\n } else if(isBorderRadius(propertyToMatch)){\n return 'border-radius';\n } else if(isDimensionProperty(propertyToMatch)){\n // Stylinghooks includes only width as property to match, for all other dimensions we need to match width\n return 'width';\n } else if(isInsetProperty(propertyToMatch)){\n // Stylinghooks includes only top/left/right/bottom as property to match, for all other insets we need to match top\n return 'top';\n }\n return propertyToMatch;\n}\n\nexport function resolveColorPropertyToMatch(cssProperty:string){\n const propertyToMatch = cssProperty.toLowerCase();\n if(propertyToMatch === 'outline' || propertyToMatch === 'outline-color'){\n return 'border-color';\n } else if(propertyToMatch === 'background' || propertyToMatch === 'background-color'){\n return 'background-color';\n } else if(isBorderColorProperty(propertyToMatch)){\n return 'border-color';\n }\n return propertyToMatch;\n}\n\nexport function isOutlineWidthProperty(propertyToMatch:string){\n return propertyToMatch === 'outline' || propertyToMatch === 'outline-width';\n}"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,54 +22,31 @@ __export(styling_hook_utils_exports, {
|
|
|
22
22
|
getStylingHooksForDensityValue: () => getStylingHooksForDensityValue
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(styling_hook_utils_exports);
|
|
25
|
-
|
|
26
|
-
// src/utils/value-utils.ts
|
|
27
|
-
var ALLOWED_UNITS = ["px", "em", "rem", "%", "ch"];
|
|
28
|
-
function parseUnitValue(value) {
|
|
29
|
-
if (!value) return null;
|
|
30
|
-
const unitsPattern = ALLOWED_UNITS.join("|");
|
|
31
|
-
const regex = new RegExp(`^(-?\\d*\\.?\\d+)(${unitsPattern})?$`);
|
|
32
|
-
const match = value.match(regex);
|
|
33
|
-
if (!match) return null;
|
|
34
|
-
const number = parseFloat(match[1]);
|
|
35
|
-
const unit = match[2] ? match[2] : null;
|
|
36
|
-
if (isNaN(number)) return null;
|
|
37
|
-
return { number, unit };
|
|
38
|
-
}
|
|
39
|
-
function toAlternateUnitValue(numberVal, unitType) {
|
|
40
|
-
if (unitType === "px") {
|
|
41
|
-
let floatValue = parseFloat(`${numberVal / 16}`);
|
|
42
|
-
if (!isNaN(floatValue)) {
|
|
43
|
-
return {
|
|
44
|
-
unit: "rem",
|
|
45
|
-
number: parseFloat(floatValue.toFixed(4))
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
} else if (unitType === "rem") {
|
|
49
|
-
const intValue = parseInt(`${numberVal * 16}`);
|
|
50
|
-
if (!isNaN(intValue)) {
|
|
51
|
-
return {
|
|
52
|
-
unit: "px",
|
|
53
|
-
number: intValue
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// src/utils/styling-hook-utils.ts
|
|
25
|
+
var import_value_utils = require("./value-utils");
|
|
61
26
|
function isValueMatch(valueToMatch, sldsValue) {
|
|
62
27
|
if (!valueToMatch || !sldsValue) {
|
|
63
28
|
return false;
|
|
64
29
|
}
|
|
65
|
-
return valueToMatch.unit == sldsValue.unit && valueToMatch.
|
|
30
|
+
return valueToMatch.unit == sldsValue.unit && valueToMatch.value === sldsValue.value;
|
|
31
|
+
}
|
|
32
|
+
function isKeywordValue(parsedValue) {
|
|
33
|
+
return parsedValue !== null && typeof parsedValue.value === "string";
|
|
66
34
|
}
|
|
67
35
|
function getStylingHooksForDensityValue(parsedValue, supportedStylinghooks, cssProperty) {
|
|
68
36
|
if (!parsedValue) return [];
|
|
69
|
-
const alternateValue = toAlternateUnitValue(parsedValue.number, parsedValue.unit);
|
|
70
37
|
const matchedHooks = [];
|
|
38
|
+
if (isKeywordValue(parsedValue)) {
|
|
39
|
+
const keywordLower = parsedValue.value.toLowerCase();
|
|
40
|
+
for (const [sldsValue, hooks] of Object.entries(supportedStylinghooks)) {
|
|
41
|
+
if (sldsValue.toLowerCase() === keywordLower) {
|
|
42
|
+
hooks.filter((hook) => hook.properties.includes(cssProperty)).forEach((hook) => matchedHooks.push(hook.name));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return matchedHooks;
|
|
46
|
+
}
|
|
47
|
+
const alternateValue = typeof parsedValue.value === "number" ? (0, import_value_utils.toAlternateUnitValue)(parsedValue.value, parsedValue.unit) : null;
|
|
71
48
|
for (const [sldsValue, hooks] of Object.entries(supportedStylinghooks)) {
|
|
72
|
-
const parsedSldsValue = parseUnitValue(sldsValue);
|
|
49
|
+
const parsedSldsValue = (0, import_value_utils.parseUnitValue)(sldsValue);
|
|
73
50
|
if (isValueMatch(parsedValue, parsedSldsValue) || alternateValue && isValueMatch(alternateValue, parsedSldsValue)) {
|
|
74
51
|
hooks.filter((hook) => hook.properties.includes(cssProperty)).forEach((hook) => matchedHooks.push(hook.name));
|
|
75
52
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/styling-hook-utils.ts"
|
|
4
|
-
"sourcesContent": ["import type { ValueToStylingHookEntry, ValueToStylingHooksMapping } from '@salesforce-ux/sds-metadata/next';\nimport { ParsedUnitValue, parseUnitValue, toAlternateUnitValue } from './value-utils';\n\nfunction isValueMatch(valueToMatch: ParsedUnitValue, sldsValue: ParsedUnitValue): boolean {\n if (!valueToMatch || !sldsValue) {\n return false;\n }\n return valueToMatch.unit == sldsValue.unit && valueToMatch.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
3
|
+
"sources": ["../../src/utils/styling-hook-utils.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ValueToStylingHookEntry, ValueToStylingHooksMapping } from '@salesforce-ux/sds-metadata/next';\nimport { ParsedUnitValue, parseUnitValue, toAlternateUnitValue } from './value-utils';\n\nfunction isValueMatch(valueToMatch: ParsedUnitValue, sldsValue: ParsedUnitValue): boolean {\n if (!valueToMatch || !sldsValue) {\n return false;\n }\n return valueToMatch.unit == sldsValue.unit && valueToMatch.value === sldsValue.value;\n}\n\n/**\n * Check if a parsed value is a keyword (string) rather than a numeric value\n */\nfunction isKeywordValue(parsedValue: ParsedUnitValue): parsedValue is { value: string; unit: null } {\n return parsedValue !== null && typeof parsedValue.value === 'string';\n}\n\n/**\n * Get styling hooks for a density value using structured data from CSS AST\n * Eliminates regex parsing by accepting pre-parsed dimension data\n */\nexport function getStylingHooksForDensityValue(\n parsedValue: ParsedUnitValue,\n supportedStylinghooks: ValueToStylingHooksMapping,\n cssProperty: string\n): string[] {\n if (!parsedValue) return [];\n \n const matchedHooks: string[] = [];\n\n // Handle keyword values (e.g., 'bold', 'normal') with direct string match\n if (isKeywordValue(parsedValue)) {\n const keywordLower = parsedValue.value.toLowerCase();\n for (const [sldsValue, hooks] of Object.entries(supportedStylinghooks)) {\n if (sldsValue.toLowerCase() === keywordLower) {\n hooks\n .filter((hook: ValueToStylingHookEntry) => hook.properties.includes(cssProperty))\n .forEach((hook) => matchedHooks.push(hook.name));\n }\n }\n return matchedHooks;\n }\n\n // Handle numeric values with unit conversion\n const alternateValue = typeof parsedValue.value === 'number' \n ? toAlternateUnitValue(parsedValue.value, parsedValue.unit)\n : null;\n\n for (const [sldsValue, hooks] of Object.entries(supportedStylinghooks)) {\n const parsedSldsValue = parseUnitValue(sldsValue);\n if (isValueMatch(parsedValue, parsedSldsValue) || (alternateValue && isValueMatch(alternateValue, parsedSldsValue))) {\n hooks\n .filter((hook: ValueToStylingHookEntry) => hook.properties.includes(cssProperty))\n .forEach((hook) => matchedHooks.push(hook.name));\n }\n }\n return matchedHooks;\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAsE;AAEtE,SAAS,aAAa,cAA+B,WAAqC;AACxF,MAAI,CAAC,gBAAgB,CAAC,WAAW;AAC/B,WAAO;AAAA,EACT;AACA,SAAO,aAAa,QAAQ,UAAU,QAAQ,aAAa,UAAU,UAAU;AACjF;AAKA,SAAS,eAAe,aAA4E;AAClG,SAAO,gBAAgB,QAAQ,OAAO,YAAY,UAAU;AAC9D;AAMO,SAAS,+BACd,aACA,uBACA,aACU;AACV,MAAI,CAAC,YAAa,QAAO,CAAC;AAE1B,QAAM,eAAyB,CAAC;AAGhC,MAAI,eAAe,WAAW,GAAG;AAC/B,UAAM,eAAe,YAAY,MAAM,YAAY;AACnD,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,qBAAqB,GAAG;AACtE,UAAI,UAAU,YAAY,MAAM,cAAc;AAC5C,cACG,OAAO,CAAC,SAAkC,KAAK,WAAW,SAAS,WAAW,CAAC,EAC/E,QAAQ,CAAC,SAAS,aAAa,KAAK,KAAK,IAAI,CAAC;AAAA,MACnD;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAGA,QAAM,iBAAiB,OAAO,YAAY,UAAU,eAChD,yCAAqB,YAAY,OAAO,YAAY,IAAI,IACxD;AAEJ,aAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,qBAAqB,GAAG;AACtE,UAAM,sBAAkB,mCAAe,SAAS;AAChD,QAAI,aAAa,aAAa,eAAe,KAAM,kBAAkB,aAAa,gBAAgB,eAAe,GAAI;AACnH,YACG,OAAO,CAAC,SAAkC,KAAK,WAAW,SAAS,WAAW,CAAC,EAC/E,QAAQ,CAAC,SAAS,aAAa,KAAK,KAAK,IAAI,CAAC;AAAA,IACnD;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,7 +35,7 @@ export declare function isGlobalValue(value: string): boolean;
|
|
|
35
35
|
export declare const ALLOWED_UNITS: string[];
|
|
36
36
|
export type ParsedUnitValue = {
|
|
37
37
|
unit: 'px' | 'rem' | '%' | 'em' | 'ch' | null;
|
|
38
|
-
|
|
38
|
+
value: number | string;
|
|
39
39
|
} | null;
|
|
40
|
-
export declare function parseUnitValue(
|
|
40
|
+
export declare function parseUnitValue(valueStr: string): ParsedUnitValue;
|
|
41
41
|
export declare function toAlternateUnitValue(numberVal: number, unitType: 'px' | 'rem' | '%' | 'em' | 'ch' | null): ParsedUnitValue;
|
|
@@ -29,16 +29,16 @@ function isGlobalValue(value) {
|
|
|
29
29
|
return value === "initial" || value === "inherit" || value === "unset" || value === "revert" || value === "revert-layer";
|
|
30
30
|
}
|
|
31
31
|
var ALLOWED_UNITS = ["px", "em", "rem", "%", "ch"];
|
|
32
|
-
function parseUnitValue(
|
|
33
|
-
if (!
|
|
32
|
+
function parseUnitValue(valueStr) {
|
|
33
|
+
if (!valueStr) return null;
|
|
34
34
|
const unitsPattern = ALLOWED_UNITS.join("|");
|
|
35
35
|
const regex = new RegExp(`^(-?\\d*\\.?\\d+)(${unitsPattern})?$`);
|
|
36
|
-
const match =
|
|
36
|
+
const match = valueStr.match(regex);
|
|
37
37
|
if (!match) return null;
|
|
38
|
-
const
|
|
38
|
+
const numValue = parseFloat(match[1]);
|
|
39
39
|
const unit = match[2] ? match[2] : null;
|
|
40
|
-
if (isNaN(
|
|
41
|
-
return {
|
|
40
|
+
if (isNaN(numValue)) return null;
|
|
41
|
+
return { value: numValue, unit };
|
|
42
42
|
}
|
|
43
43
|
function toAlternateUnitValue(numberVal, unitType) {
|
|
44
44
|
if (unitType === "px") {
|
|
@@ -46,7 +46,7 @@ function toAlternateUnitValue(numberVal, unitType) {
|
|
|
46
46
|
if (!isNaN(floatValue)) {
|
|
47
47
|
return {
|
|
48
48
|
unit: "rem",
|
|
49
|
-
|
|
49
|
+
value: parseFloat(floatValue.toFixed(4))
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
} else if (unitType === "rem") {
|
|
@@ -54,7 +54,7 @@ function toAlternateUnitValue(numberVal, unitType) {
|
|
|
54
54
|
if (!isNaN(intValue)) {
|
|
55
55
|
return {
|
|
56
56
|
unit: "px",
|
|
57
|
-
|
|
57
|
+
value: intValue
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/value-utils.ts"],
|
|
4
|
-
"sourcesContent": ["// Simplified value parsing\n\n/**\n * Checks if a value is a CSS global value.\n *\n * CSS global values are special keywords that can be used for any CSS property and have a universal meaning:\n * - initial: Resets the property to its initial value as defined by the CSS specification.\n * - inherit: Inherits the value from the parent element.\n * - unset: Acts as inherit if the property is inheritable, otherwise acts as initial.\n * - revert: Rolls back the property to the value established by the user-agent or user styles.\n * - revert-layer: Rolls back the property to the value established by the previous cascade layer.\n *\n * All CSS properties accept these global values, including but not limited to:\n * - color\n * - background\n * - font-size\n * - margin\n * - padding\n * - border\n * - display\n * - position\n * - z-index\n * - and many more\n *\n * These values are part of the CSS standard and are not considered violations, even if a rule would otherwise flag a value as invalid or non-design-token. They are always allowed for any property.\n *\n * @param value The CSS value to check.\n * @returns True if the value is a CSS global value, false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/unset\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/revert\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/revert-layer\n */\nexport function isGlobalValue(value: string): boolean {\n return value === 'initial' || value === 'inherit' || value === 'unset' || value === 'revert' || value === 'revert-layer';\n }\n\n// Configurable list of allowed CSS units\nexport const ALLOWED_UNITS = ['px', 'em', 'rem', '%', 'ch'];\n\nexport type ParsedUnitValue = {\n unit: 'px' | 'rem' | '%' | 'em' | 'ch' | null;\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCO,SAAS,cAAc,OAAwB;AAClD,SAAO,UAAU,aAAa,UAAU,aAAa,UAAU,WAAW,UAAU,YAAY,UAAU;AAC5G;AAGK,IAAM,gBAAgB,CAAC,MAAM,MAAM,OAAO,KAAK,IAAI;AAOnD,SAAS,eAAe,
|
|
4
|
+
"sourcesContent": ["// Simplified value parsing\n\n/**\n * Checks if a value is a CSS global value.\n *\n * CSS global values are special keywords that can be used for any CSS property and have a universal meaning:\n * - initial: Resets the property to its initial value as defined by the CSS specification.\n * - inherit: Inherits the value from the parent element.\n * - unset: Acts as inherit if the property is inheritable, otherwise acts as initial.\n * - revert: Rolls back the property to the value established by the user-agent or user styles.\n * - revert-layer: Rolls back the property to the value established by the previous cascade layer.\n *\n * All CSS properties accept these global values, including but not limited to:\n * - color\n * - background\n * - font-size\n * - margin\n * - padding\n * - border\n * - display\n * - position\n * - z-index\n * - and many more\n *\n * These values are part of the CSS standard and are not considered violations, even if a rule would otherwise flag a value as invalid or non-design-token. They are always allowed for any property.\n *\n * @param value The CSS value to check.\n * @returns True if the value is a CSS global value, false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/unset\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/revert\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/revert-layer\n */\nexport function isGlobalValue(value: string): boolean {\n return value === 'initial' || value === 'inherit' || value === 'unset' || value === 'revert' || value === 'revert-layer';\n }\n\n// Configurable list of allowed CSS units\nexport const ALLOWED_UNITS = ['px', 'em', 'rem', '%', 'ch'];\n\nexport type ParsedUnitValue = {\n unit: 'px' | 'rem' | '%' | 'em' | 'ch' | null;\n value: number | string; // string for keyword values like 'bold', 'normal'\n} | null;\n\nexport function parseUnitValue(valueStr: string): ParsedUnitValue {\n if (!valueStr) return null;\n \n // Create regex pattern from allowed units\n const unitsPattern = ALLOWED_UNITS.join('|');\n const regex = new RegExp(`^(-?\\\\d*\\\\.?\\\\d+)(${unitsPattern})?$`);\n const match = valueStr.match(regex);\n if (!match) return null;\n \n const numValue = parseFloat(match[1]);\n const unit = match[2] ? (match[2] as 'px' | 'rem' | '%' | 'em' | 'ch') : null; // Keep unitless values as null\n \n if (isNaN(numValue)) return null;\n \n return { value: numValue, unit };\n}\n\nexport function toAlternateUnitValue(numberVal: number, unitType: 'px' | 'rem' | '%' | 'em' | 'ch' | null): ParsedUnitValue {\n if (unitType === 'px') {\n let floatValue = parseFloat(`${numberVal / 16}`);\n if (!isNaN(floatValue)) {\n return {\n unit: 'rem',\n value: parseFloat(floatValue.toFixed(4))\n }\n }\n } else if (unitType === 'rem') {\n const intValue = parseInt(`${numberVal * 16}`);\n if (!isNaN(intValue)) {\n return {\n unit: 'px',\n value: intValue\n }\n }\n }\n // For other units (%, em, ch) and unitless values, no alternate unit conversion available\n // These units are context-dependent and don't have standard conversion ratios\n return null;\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCO,SAAS,cAAc,OAAwB;AAClD,SAAO,UAAU,aAAa,UAAU,aAAa,UAAU,WAAW,UAAU,YAAY,UAAU;AAC5G;AAGK,IAAM,gBAAgB,CAAC,MAAM,MAAM,OAAO,KAAK,IAAI;AAOnD,SAAS,eAAe,UAAmC;AAChE,MAAI,CAAC,SAAU,QAAO;AAGtB,QAAM,eAAe,cAAc,KAAK,GAAG;AAC3C,QAAM,QAAQ,IAAI,OAAO,qBAAqB,YAAY,KAAK;AAC/D,QAAM,QAAQ,SAAS,MAAM,KAAK;AAClC,MAAI,CAAC,MAAO,QAAO;AAEnB,QAAM,WAAW,WAAW,MAAM,CAAC,CAAC;AACpC,QAAM,OAAO,MAAM,CAAC,IAAK,MAAM,CAAC,IAAyC;AAEzE,MAAI,MAAM,QAAQ,EAAG,QAAO;AAE5B,SAAO,EAAE,OAAO,UAAU,KAAK;AACjC;AAEO,SAAS,qBAAqB,WAAmB,UAAoE;AACxH,MAAI,aAAa,MAAM;AACrB,QAAI,aAAa,WAAW,GAAG,YAAY,EAAE,EAAE;AAC/C,QAAI,CAAC,MAAM,UAAU,GAAG;AACtB,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,WAAW,WAAW,QAAQ,CAAC,CAAC;AAAA,MACzC;AAAA,IACF;AAAA,EACF,WAAW,aAAa,OAAO;AAC7B,UAAM,WAAW,SAAS,GAAG,YAAY,EAAE,EAAE;AAC7C,QAAI,CAAC,MAAM,QAAQ,GAAG;AACpB,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAGA,SAAO;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce-ux/eslint-plugin-slds",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9-internal",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./build/index.d.ts",
|
|
8
|
-
"
|
|
9
|
-
"require": "./build/index.js"
|
|
8
|
+
"default": "./build/index.js"
|
|
10
9
|
},
|
|
11
|
-
"./config":
|
|
12
|
-
|
|
13
|
-
"require": "./eslint.config.mjs"
|
|
14
|
-
},
|
|
15
|
-
"./rule-messages.yml": "./src/config/rule-messages.yml"
|
|
10
|
+
"./config": "./eslint.config.mjs",
|
|
11
|
+
"./rule-messages": "./build/config/rule-messages.js"
|
|
16
12
|
},
|
|
17
13
|
"files": [
|
|
18
14
|
"build/**",
|
|
19
15
|
"README.md",
|
|
20
16
|
"RULES.md",
|
|
21
|
-
"eslint.config.mjs"
|
|
22
|
-
"src/config/rule-messages.yml"
|
|
17
|
+
"eslint.config.mjs"
|
|
23
18
|
],
|
|
24
19
|
"engines": {
|
|
25
20
|
"node": ">=18.18.0"
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# ESLint Rule Messages - Complete Configuration
|
|
2
|
-
# This file contains all rule metadata: descriptions, documentation URLs, user-facing messages etc.
|
|
3
|
-
|
|
4
|
-
# =============================================================================
|
|
5
|
-
# CSS Rules (ESLint v9 with @eslint/css)
|
|
6
|
-
# =============================================================================
|
|
7
|
-
|
|
8
|
-
no-slds-class-overrides:
|
|
9
|
-
description: "Create new custom CSS classes instead of overriding SLDS selectors"
|
|
10
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-class-overrides"
|
|
11
|
-
type: "problem"
|
|
12
|
-
messages:
|
|
13
|
-
sldsClassOverride: "Overriding .{{className}} isn't supported. To differentiate SLDS and custom classes, create a CSS class in your namespace. Examples: myapp-input, myapp-button."
|
|
14
|
-
|
|
15
|
-
no-deprecated-slds-classes:
|
|
16
|
-
description: "Please replace the deprecated classes with a modern equivalent"
|
|
17
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-slds-classes"
|
|
18
|
-
type: "problem"
|
|
19
|
-
messages:
|
|
20
|
-
deprecatedClass: "The class {{className}} is deprecated and not available in SLDS2. Please update to a supported class."
|
|
21
|
-
|
|
22
|
-
no-deprecated-tokens-slds1:
|
|
23
|
-
description: "Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com."
|
|
24
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-tokens-slds1"
|
|
25
|
-
type: "problem"
|
|
26
|
-
messages:
|
|
27
|
-
deprecatedToken: "Consider removing {{oldValue}} or replacing it with {{newValue}}. Set the fallback to {{oldValue}}. For more info, see Styling Hooks on lightningdesignsystem.com."
|
|
28
|
-
noReplacement: "Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com."
|
|
29
|
-
|
|
30
|
-
enforce-sds-to-slds-hooks:
|
|
31
|
-
description: "Convert your existing --sds styling hooks to --slds styling hooks. See lightningdesignsystem.com for more info."
|
|
32
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-sds-to-slds-hooks"
|
|
33
|
-
type: "problem"
|
|
34
|
-
messages:
|
|
35
|
-
replaceSdsWithSlds: "Replace {{oldValue}} with {{suggestedMatch}} styling hook."
|
|
36
|
-
|
|
37
|
-
# =============================================================================
|
|
38
|
-
# HTML/Component Rules (ESLint v8 & v9)
|
|
39
|
-
# =============================================================================
|
|
40
|
-
|
|
41
|
-
enforce-bem-usage:
|
|
42
|
-
description: "Replace BEM double-dash syntax in class names with single underscore syntax"
|
|
43
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-bem-usage"
|
|
44
|
-
type: "problem"
|
|
45
|
-
messages:
|
|
46
|
-
bemDoubleDash: "{{actual}} has been retired. Update it to the new name {{newValue}}."
|
|
47
|
-
fixBemNaming: "Update to correct BEM naming convention"
|
|
48
|
-
|
|
49
|
-
modal-close-button-issue:
|
|
50
|
-
description: "Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint"
|
|
51
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#modal-close-button-issue"
|
|
52
|
-
type: "problem"
|
|
53
|
-
messages:
|
|
54
|
-
modalCloseButtonIssue: "Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint."
|
|
55
|
-
removeClass: "Remove the slds-button_icon-inverse class from the modal close button in components that use the SLDS modal blueprint."
|
|
56
|
-
changeVariant: "Change the variant attribute value from bare-inverse to bare in <lightning-button-icon> or <lightning-icon>."
|
|
57
|
-
removeVariant: "Remove the variant attribute from the <lightning-icon> component inside the <button> element."
|
|
58
|
-
ensureButtonClasses: "Add or move slds-button and slds-button_icon to the class attribute of the <button> element or <lightning-button-icon> component."
|
|
59
|
-
ensureSizeAttribute: "To size icons properly, set the size attribute to large in the <lightning-icon> and <lightning-button-icon> components."
|
|
60
|
-
|
|
61
|
-
no-deprecated-classes-slds2:
|
|
62
|
-
description: "Replace classes that aren't available with SLDS 2 classes"
|
|
63
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-classes-slds2"
|
|
64
|
-
type: "problem"
|
|
65
|
-
messages:
|
|
66
|
-
deprecatedClass: "The class {{className}} isn't available in SLDS 2. Update it to a class supported in SLDS 2. See lightningdesignsystem.com for more information."
|
|
67
|
-
updateToModernClass: "Replace deprecated class with modern equivalent"
|
|
68
|
-
checkDocumentation: "See lightningdesignsystem.com for SLDS 2 class alternatives"
|
|
69
|
-
|
|
70
|
-
lwc-token-to-slds-hook:
|
|
71
|
-
description: "Replace the deprecated --lwc tokens with the latest --slds tokens. See lightningdesignsystem.com for more info."
|
|
72
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#lwc-token-to-slds-hook"
|
|
73
|
-
type: "problem"
|
|
74
|
-
messages:
|
|
75
|
-
errorWithReplacement: "The '{{oldValue}}' design token is deprecated. Replace it with '{{newValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com."
|
|
76
|
-
errorWithStyleHooks: "The '{{oldValue}}' design token is deprecated. Replace it with the SLDS 2 '{{newValue}}' styling hook and set the fallback to '{{oldValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com."
|
|
77
|
-
errorWithNoRecommendation: "The '{{oldValue}}' design token is deprecated. For more info, see the New Global Styling Hook Guidance on lightningdesignsystem.com."
|
|
78
|
-
|
|
79
|
-
no-sldshook-fallback-for-lwctoken:
|
|
80
|
-
description: "Avoid using --slds styling hooks as fallback values for --lwc tokens."
|
|
81
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-sldshook-fallback-for-lwctoken"
|
|
82
|
-
type: "problem"
|
|
83
|
-
messages:
|
|
84
|
-
unsupportedFallback: "Remove the {{sldsToken}} styling hook that is used as a fallback value for {{lwcToken}}."
|
|
85
|
-
|
|
86
|
-
no-unsupported-hooks-slds2:
|
|
87
|
-
description: "Identifies styling hooks that aren't present in SLDS 2. They must be replaced with styling hooks that have a similar effect, or they must be removed."
|
|
88
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-unsupported-hooks-slds2"
|
|
89
|
-
type: "problem"
|
|
90
|
-
messages:
|
|
91
|
-
deprecated: "The {{token}} styling hook isn't present in SLDS 2 and there's no equivalent replacement. Remove it or replace it with a styling hook with a similar effect."
|
|
92
|
-
|
|
93
|
-
no-slds-var-without-fallback:
|
|
94
|
-
description: "Add fallback values to SLDS styling hooks. The fallback values are used in Salesforce environments where styling hooks are unavailable."
|
|
95
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-var-without-fallback"
|
|
96
|
-
type: "problem"
|
|
97
|
-
messages:
|
|
98
|
-
varWithoutFallback: "Your code uses the {{cssVar}} styling hook without a fallback value. Styling hooks are unavailable in some Salesforce environments. To render your component correctly in all environments, add this fallback value: var({{cssVar}}, {{recommendation}}). To make this fallback value brand-aware, use a branded design token instead of a static value. See Design Tokens on v1.lightningdesignsystem.com."
|
|
99
|
-
|
|
100
|
-
no-slds-namespace-for-custom-hooks:
|
|
101
|
-
description: "To differentiate custom styling hooks from SLDS styling hooks, create custom styling hooks in your namespace."
|
|
102
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-namespace-for-custom-hooks"
|
|
103
|
-
type: "problem"
|
|
104
|
-
messages:
|
|
105
|
-
customHookNamespace: "Using the --slds namespace for {{token}} isn't supported. Create the custom styling hook in your namespace. Example: --myapp-{{tokenWithoutNamespace}}"
|
|
106
|
-
|
|
107
|
-
no-slds-private-var:
|
|
108
|
-
description: "Some SLDS styling hooks are private and reserved only for internal Salesforce use. Private SLDS styling hooks have prefixes --_slds- and --slds-s-. For more information, look up private CSS in lightningdesignsystem.com."
|
|
109
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-private-var"
|
|
110
|
-
type: "problem"
|
|
111
|
-
messages:
|
|
112
|
-
privateVar: "This styling hook is reserved for internal Salesforce use. Remove the --_slds- or –slds-s private variable within selector {{prop}}. For more information, look up private CSS in lightningdesignsystem.com."
|
|
113
|
-
|
|
114
|
-
enforce-component-hook-naming-convention:
|
|
115
|
-
description: "Replace component styling hooks that use a deprecated naming convention."
|
|
116
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-component-hook-naming-convention"
|
|
117
|
-
type: "problem"
|
|
118
|
-
messages:
|
|
119
|
-
replace: "Replace the deprecated {{oldValue}} component styling hook with {{suggestedMatch}}."
|
|
120
|
-
|
|
121
|
-
no-hardcoded-values-slds1:
|
|
122
|
-
description: "Replace static values with SLDS 1 design tokens. For more information, look up design tokens on lightningdesignsystem.com."
|
|
123
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-value"
|
|
124
|
-
type: "suggestion"
|
|
125
|
-
messages:
|
|
126
|
-
hardcodedValue: "Replace the {{oldValue}} static value with an SLDS 1 styling hook: {{newValue}}."
|
|
127
|
-
noReplacement: "There's no replacement styling hook for the {{oldValue}} static value. Remove the static value."
|
|
128
|
-
|
|
129
|
-
no-hardcoded-values-slds2:
|
|
130
|
-
description: "Replace static values with SLDS 2 styling hooks. For more information, look up design tokens on lightningdesignsystem.com."
|
|
131
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-values-slds2"
|
|
132
|
-
type: "suggestion"
|
|
133
|
-
messages:
|
|
134
|
-
hardcodedValue: "Consider replacing the {{oldValue}} static value with an SLDS 2 styling hook that has a similar value: {{newValue}}."
|
|
135
|
-
noReplacement: "There's no replacement styling hook for the {{oldValue}} static value. Remove the static value."
|
|
136
|
-
|
|
137
|
-
reduce-annotations:
|
|
138
|
-
description: "Remove your annotations and update your code."
|
|
139
|
-
url: "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#reduce-annotations"
|
|
140
|
-
type: "problem"
|
|
141
|
-
messages:
|
|
142
|
-
removeAnnotation: "Remove this annotation and update the code to SLDS best practices. For help, file an issue at https://github.com/salesforce-ux/slds-linter/"
|
|
143
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|