Skip to content
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

[stylelint-polaris][v5] Final rule categorization #7828

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

chloerice
Copy link
Member

@chloerice chloerice commented Dec 1, 2022

WHY are these changes being introduced?

To unblock the release of v5 and enabling the linter in @shopify/polaris after running the disable comments codemod.

WHAT is this pull request doing?

This PR fixes:

  • Miscategorization of a few legacy at-rules grouped into function-disallowed-list instead of stylelint-polaris/at-rule-disallowed-list
  • Categories not mapping to token groups:
    • Changed typography to font
    • Added z-index category
    • Changed mediaQueries to breakpoints
    • Changed legacySass to legacy (as it encompasses legacy Sass API stuff and legacy CSS custom properties)

'z-index': {
'declaration-property-value-allowed-list': [
{
'z-index': [/--p-z-\b([1-9]|1[0-2])\b/],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update this to iterate through the zIndex tokens. e.g.

import {createVar, tokens} from '@shopify/polaris-tokens'
// ...
{
  'z-index': Object.keys(tokens.zIndex).map(createVar)
}

},
mediaQueries: {
breakpoints: {
Copy link
Member

@aaronccasanova aaronccasanova Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mediaQueries may be more appropriate as this category can lint more than Polaris breakpoints e.g. media types, media features, media conditions/operators, etc. Thoughts?

Copy link
Member Author

@chloerice chloerice Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaronccasanova What do you think about re-categorizing the non-breakpoint related options in the breakpoints category media-query-allowed-list over to conventions? It seems like that would be a better fit so the coverage site can map the results related to breakpoints to the breakpoints token coverage.

@@ -367,7 +383,8 @@ const stylelintPolarisCoverageOptions = {
],
},
},
legacySass: {
legacy: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@alex-page alex-page left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @aaronccasanova gave some great feedback.

@@ -71,7 +73,7 @@ const stylelintPolarisCoverageOptions = {
/--p-duration-1-5-0/,
],
},
typography: {
font: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

font aligns with our token group but I'm not sure it describes the full scope of what we're able to lint regarding typography. That said, I'm not attached to typography as a category so feel free to proceed with this update!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree! I'm gonna leave it as typography, as I also wonder how me might want to iterate on or add to this category to account for the new Text component folks should be leaning on primarily going forward 🤔

@@ -162,7 +164,6 @@ const stylelintPolarisCoverageOptions = {
'grid-template-rows',
'grid-template-columns',
'grid-area',
'display',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are position and display removed? It looks like the replacements don't cover the same scope. I thought having these set to warnings gives us insight on potential/future layout components.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I've removed those changes as they were incomplete explorations of addressing some of the things we need to iron out in #7827 💯

@chloerice chloerice merged commit 1986808 into stylelint-polaris-v5 Dec 2, 2022
@chloerice chloerice deleted the final-categorization branch December 2, 2022 00:13
sophschneider pushed a commit that referenced this pull request Dec 2, 2022
### WHY are these changes being introduced?
To unblock the release of v5 and enabling the linter in
`@shopify/polaris` after running the disable comments codemod.

### WHAT is this pull request doing?

This PR fixes:
- Miscategorization of a few legacy at-rules grouped into
`function-disallowed-list` instead of
`stylelint-polaris/at-rule-disallowed-list`
- Categories not mapping to token groups:
  - ~Changed typography to font~
  - Added z-index category
  - Changed mediaQueries to breakpoints
- Changed legacySass to legacy (as it encompasses legacy Sass API stuff
and legacy CSS custom properties)
sophschneider pushed a commit that referenced this pull request Dec 2, 2022
### WHY are these changes being introduced?
To unblock the release of v5 and enabling the linter in
`@shopify/polaris` after running the disable comments codemod.

### WHAT is this pull request doing?

This PR fixes:
- Miscategorization of a few legacy at-rules grouped into
`function-disallowed-list` instead of
`stylelint-polaris/at-rule-disallowed-list`
- Categories not mapping to token groups:
  - ~Changed typography to font~
  - Added z-index category
  - Changed mediaQueries to breakpoints
- Changed legacySass to legacy (as it encompasses legacy Sass API stuff
and legacy CSS custom properties)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants