-
Notifications
You must be signed in to change notification settings - Fork 87
Fix SLDS Linter Errors for SLDS2 #491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: support-slds-2
Are you sure you want to change the base?
Conversation
reg-suit detected visual differences. Check this report, and review them. 🔴🔴 🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵 What do the circles mean?The number of circles represent the number of changed images.🔴 : Changed items, ⚪ : New items, ⚫ : Deleted items, and 🔵 Passed items How can I change the check status?If reviewers approve this PR, the reg context status will be green automatically. |
1d3dc30
to
0098345
Compare
ce9e951
to
276c09a
Compare
see also: https://v1.lightningdesignsystem.com/release-notes/ > .slds-button_icon-bare is no longer needed. Please use .slds-button_icon instead.
This reverts commit 276c09a.
92501b8
to
11b4bdb
Compare
@@ -246,7 +246,7 @@ const DatepickerDate: FC<DatepickerDateProps> = (props) => { | |||
const isToday = date.value === today; | |||
const isAdjacentMonth = date.month !== cal.month; | |||
const dateClassName = classnames({ | |||
'slds-disabled-text': !enabled, | |||
'slds-color__text_gray-6': !enabled && !isAdjacentMonth, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be shown in disabled even if it is in adjacent month. As the adjacent-month class assumes the day is clickable, it should not be shown as clickable if the day is not enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stomita
IMO, slds-color__text_gray-6
would keep affording that date elements having it are disabled, because it has grayed style.
In addition, slds-disabled-text
is listed as deprecated class in the spec.
https://v1.lightningdesignsystem.com/components/datepickers/#CSS-Class-Overview
To me, it'd be better to avoid using deprecated slds-disabled-text
and use slds-color__text_gray-6
that keeps disabled affordance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msmx-mnakagawa
In the storybook min/max story example, it uses slds-day_adjacent-month
for out of range (= disabled) days. (Not sure that is proper way considering the meaning, though).
https://sds-site-docs-1fea39e7763a.herokuapp.com/index.html?path=/story/components-datepicker--min-max
src/scripts/Icon.tsx
Outdated
[`slds-icon-text-${textColor ?? 'default'}`]: | ||
/^(default|success|warning|error|light)$/.test(textColor ?? '') && | ||
!iconColor, | ||
'slds-m-left_x-small': align === 'right', | ||
'slds-m-right_x-small': align === 'left', | ||
'slds-var-m-left_x-small': align === 'right', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to change them to var-
classes ? Do you think it should change value in comfy/compact mode ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as #491 (comment).
@@ -277,7 +281,8 @@ export const Icon = createFC<IconProps, { ICONS: typeof ICONS }>( | |||
containerClassName_, | |||
'slds-icon_container', | |||
container === 'circle' ? 'slds-icon_container_circle' : null, | |||
category === 'utility' | |||
category === 'utility' && | |||
!UTILITY_ICONS_DEPRECATED_FOR_CONTAINER_CLASSNAME.includes(icon) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe the reason of why the deprecated icon list is introduced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stomita
Sorry for my lack of explanation...
After installing @salesforce-ux/eslint-plugin-slds
into our local environment, we can see the list of deprecated classnames at node_modules/@salesforce-ux/sds-metadata/generated/deprecatedClasses.json
.
The repository itself seems existed, but we need authorization to view it.
https://github.com/salesforce-ux-emu/design-systems-metadata
Therefore, I put the list I got to the summary of this PR.
The list contains classnames I avoided using here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msmx-mnakagawa Is it necessary to be managed by the list ? The icon string can be an arbitrary one, both the deprecated and totally invalid, so changing the behavior for deprecated class names is out of the point (always the valid icon notation will work properly).
stories/Icon.stories.tsx
Outdated
@@ -100,13 +100,13 @@ export const Sizes: StoryObj<StoryProps> = { | |||
}) => ( | |||
<div> | |||
<Icon icon='standard:case' size='xx-small' onClick={xxsmall_onClick} /> | |||
<span className='slds-p-right_small' /> | |||
<span className='slds-var-p-right_small' /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The var-
class name should be introduced carefully that is not changing the layout in comfy/compact mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reverts commit 8cd9535.
@@ -246,7 +246,7 @@ const DatepickerDate: FC<DatepickerDateProps> = (props) => { | |||
const isToday = date.value === today; | |||
const isAdjacentMonth = date.month !== cal.month; | |||
const dateClassName = classnames({ | |||
'slds-disabled-text': !enabled, | |||
'slds-color__text_gray-6': !enabled && !isAdjacentMonth, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msmx-mnakagawa
In the storybook min/max story example, it uses slds-day_adjacent-month
for out of range (= disabled) days. (Not sure that is proper way considering the meaning, though).
https://sds-site-docs-1fea39e7763a.herokuapp.com/index.html?path=/story/components-datepicker--min-max
@@ -277,7 +281,8 @@ export const Icon = createFC<IconProps, { ICONS: typeof ICONS }>( | |||
containerClassName_, | |||
'slds-icon_container', | |||
container === 'circle' ? 'slds-icon_container_circle' : null, | |||
category === 'utility' | |||
category === 'utility' && | |||
!UTILITY_ICONS_DEPRECATED_FOR_CONTAINER_CLASSNAME.includes(icon) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msmx-mnakagawa Is it necessary to be managed by the list ? The icon string can be an arbitrary one, both the deprecated and totally invalid, so changing the behavior for deprecated class names is out of the point (always the valid icon notation will work properly).
What I did
.slds-icon-utility-close
.slds-icon-utility-error
.slds-icon-utility-warning
icon-bare
type.slds-disabled-text
with.slds-color__text_gray-6
.slds-icon_medium
How I detected Linter errors
*.html
files*.html
files in VSCode and confirm whether VSCode shows linter errorsClassnames I did NOT change despite Linter errors
The followings are also reported as lint errors.
However, I kept them as is intentionally, because they are documented as the current markup examples.
In addition, particularly about
.slds-form_…
classnames, we allow to use them as exceptions..slds-is-required
.slds-dropdown_top
.slds-dropdown__list
.slds-form_compound
.slds-form_inline
.slds-listbox__option-text
.slds-listbox__option-meta_entity
.slds-alert_success
.slds-page-header__icon
Reference
Deprecated classname list