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

Update primer/spacing for CSS properties #400

Merged
merged 26 commits into from May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3fae093
Update primer/spacing for CSS properties
jonrohan Apr 18, 2024
75ff456
Adjust the rest of the test for new plugin
jonrohan Apr 18, 2024
fefd866
Make lint fixes
jonrohan Apr 18, 2024
c7752ec
Writing a tsx test case
jonrohan Apr 18, 2024
9a97aee
Fix no-override test by not using default config
jonrohan Apr 18, 2024
5bf6915
Switch to cjs
jonrohan Apr 18, 2024
2125c55
Fix good example code
jonrohan Apr 18, 2024
434f9d4
Add fix for names like border-top
jonrohan Apr 18, 2024
c1fa714
Merge branch 'main' into update_primer_spacing
jonrohan Apr 18, 2024
ccfd8d6
Fix error end column
jonrohan Apr 18, 2024
f7c0c4f
Final fix
jonrohan Apr 18, 2024
eceed99
Add ability to replace +-1 space sizes
jonrohan Apr 18, 2024
0427327
Merge branch 'main' into update_primer_spacing
jonrohan Apr 22, 2024
71bb992
Merge branch 'main' into update_primer_spacing
jonrohan Apr 22, 2024
e575565
Merge branch 'main' into update_primer_spacing
jonrohan Apr 22, 2024
a71d8c0
Remove semicolons
jonrohan Apr 22, 2024
0b9edc1
Create seven-apples-rhyme.md
jonrohan Apr 22, 2024
ff48ffd
Merge branch 'main' into update_primer_spacing
jonrohan Apr 22, 2024
22c68ad
Ignore js files
jonrohan Apr 24, 2024
52941ee
Enable spacing in css modules
jonrohan May 7, 2024
ed3f64c
Enable spacing in tsx files
jonrohan May 7, 2024
dea9dd0
Ignore themeGet
jonrohan May 7, 2024
bfcdce8
Merge branch 'main' into update_primer_spacing
jonrohan May 7, 2024
d93b4cc
Updating primitives
jonrohan May 7, 2024
4675803
Using createRequire
jonrohan May 8, 2024
8a59ac3
Use 7.17.1
jonrohan May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-apples-rhyme.md
@@ -0,0 +1,5 @@
---
"@primer/stylelint-config": minor
---

Update primer/spacing for CSS properties
2 changes: 1 addition & 1 deletion .stylelintrc.json
@@ -1 +1 @@
{ "extends": ["./dist/index.cjs"], "cache": false }
{ "extends": ["./dist/index.cjs"], "ignoreFiles": ["**/*.js", "**/*.cjs", "**/*.ts", "**/*.mjs"], "cache": false }
8 changes: 8 additions & 0 deletions __tests__/__fixtures__/good/example.module.css
Expand Up @@ -20,13 +20,16 @@
}

.gradient-left {
/* stylelint-disable-next-line primer/spacing */
top: var(--offset);
/* stylelint-disable-next-line primer/spacing */
left: var(--offset);
/* stylelint-disable-next-line primer/colors */
background: radial-gradient(30% 70% at 50% 50%, rgb(130 80 223 / 0.2) 0%, rgb(130 80 223 / 0) 100%);
}

.gradient-right {
/* stylelint-disable-next-line primer/spacing */
right: var(--offset);
/* stylelint-disable-next-line primer/colors */
background: radial-gradient(30% 70% at 50% 50%, rgb(9 107 222 / 0.3) 0%, rgb(9 107 222 / 0) 100%);
Expand All @@ -38,13 +41,16 @@
}

.header-background {
/* stylelint-disable-next-line primer/spacing */
top: -220px;
/* stylelint-disable-next-line primer/spacing */
right: -110px;
height: 580px;
}

.header-copilot {
top: -35%;
/* stylelint-disable-next-line primer/spacing */
right: 100px;
height: 146px;
}
Expand All @@ -55,6 +61,7 @@
}

.negative-margin {
/* stylelint-disable-next-line primer/spacing */
margin: -0.5rem;
}

Expand Down Expand Up @@ -119,6 +126,7 @@
place-items: center;
width: var(--container-size);
height: var(--container-size);
/* stylelint-disable-next-line primer/spacing */
padding: var(--space-xsmall);
}

Expand Down
10 changes: 5 additions & 5 deletions __tests__/__fixtures__/good/example.scss
Expand Up @@ -5,7 +5,7 @@
min-width: 180px;
padding: 0;
margin: 0;
margin-top: $spacer-4;
margin-top: var(--base-size-16);
list-style: none;
cursor: pointer;
background: var(--overlay-bgColor);
Expand All @@ -15,7 +15,7 @@

.li {
display: block;
padding: $spacer-1 $spacer-2;
padding: var(--base-size-4) var(--base-size-8);
font-weight: $font-weight-semibold;
border-bottom: $border-width $border-style var(--borderColor-muted);

Expand Down Expand Up @@ -78,12 +78,12 @@
.responsive-page {
@media (max-width: $width-sm) {
.sugest-container {
right: $spacer-2 !important;
left: $spacer-2 !important;
right: var(--base-size-8) !important;
left: var(--base-size-8) !important;
}

.sugest .li {
padding: $spacer-2 $spacer-3;
padding: var(--base-size-8) var(--base-size-12);
}
}
}
9 changes: 6 additions & 3 deletions __tests__/__fixtures__/good/example.tsx
Expand Up @@ -9,8 +9,9 @@ import {TOAST_ANIMATION_LENGTH, type ToastItem, ToastType} from './types'
type IToastCloseButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>

const StyledButton = styled.button`
padding: 8px;
margin: 8px 10px 8px 0px;
padding: var(--base-size-8);
/* stylelint-disable-next-line primer/spacing */
margin: var(--base-size-8) 10px var(--base-size-8) 0px;
border-radius: 3px;
color: ${themeGet('colors.fg.onEmphasis')};
border: 0;
Expand Down Expand Up @@ -87,8 +88,10 @@ export const StyledToast = styled.div`
box-sizing: border-box;
overflow: hidden;
max-width: 400px;
/* stylelint-disable-next-line primer/spacing */
bottom: 66px;
left: 12px;z-index:99;
left: var(--base-size-12);
z-index:99;

animation: ${toastEnter} ${TOAST_ANIMATION_LENGTH}ms cubic-bezier(0.25, 1, 0.5, 1);

Expand Down
3 changes: 2 additions & 1 deletion __tests__/index.js
Expand Up @@ -34,9 +34,10 @@ describe('stylelint-config', () => {
}
`).then(data => {
expect(data).toHaveErrored()
expect(data).toHaveWarningsLength(2)
expect(data).toHaveWarningsLength(3)
expect(data).toHaveWarnings([
'Expected "top" to come before "width" (order/properties-order)',
"Please use a primer size variable instead of '.2em'. Consult the primer docs for a suitable replacement. https://primer.style/foundations/primitives/size (primer/spacing)",
'Unexpected value "initial" for property "max-width" (declaration-property-value-disallowed-list)',
])
})
Expand Down