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

Add stylelint-polaris/media-queries-allowed-list plugin #6438

Merged
merged 12 commits into from
Jun 30, 2022

Conversation

aaronccasanova
Copy link
Member

@aaronccasanova aaronccasanova commented Jun 29, 2022

WHAT is this pull request doing?

This PR introduces a new stylelint-polaris/media-queries-allowed-list plugin to ensure @media rules only use the new Polaris breakpoints aliases and other support media types.

e.g. stylelint **/*.scss

Screen Shot 2022-06-28 at 5 02 04 PM

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}

🎩 checklist

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.

Looking at the screenshot, I see the output as errors and I think these should be warnings. We want to encourage consistency and push towards the Polaris values. Once there is a high level of adoption these can become errors. I might be reading this wrong though!

@aaronccasanova
Copy link
Member Author

I see the output as errors and I think these should be warnings.

@alex-page Good call! I set the internal config to warn on main and will revert it back on the next-breakpoints branch.

stylelint-polaris/index.js Outdated Show resolved Hide resolved
stylelint-polaris/index.js Outdated Show resolved Hide resolved
Copy link
Contributor

@gui-santos gui-santos left a comment

Choose a reason for hiding this comment

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

🌮

Copy link
Member

@lgriffee lgriffee left a comment

Choose a reason for hiding this comment

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

🚢✨🎉

@aaronccasanova
Copy link
Member Author

Added a last minute update to the allowedScssInterpolations config to check against the inner expression. This avoids redundancy by not requiring authors to defined #{} to each match pattern e.g.
From allowedScssInterpolations: ['#{$my-expression}', '#{1 + 1}']
To allowedScssInterpolations: ['$my-expression', '1 + 1']

@aaronccasanova aaronccasanova merged commit 3c31370 into main Jun 30, 2022
@aaronccasanova aaronccasanova deleted the media-queries-allowed-list branch June 30, 2022 20:06
@github-actions github-actions bot mentioned this pull request Jun 30, 2022
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.

None yet

6 participants