Skip to content

Commit

Permalink
fix(lint): reverse stylelint media query notation rule & add comments…
Browse files Browse the repository at this point in the history
… to config (#3790)
  • Loading branch information
adghayes authored Aug 4, 2023
1 parent e54cda7 commit 855a4b1
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 36 deletions.
12 changes: 6 additions & 6 deletions apps/admin/frontend/src/__snapshots__/app.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ exports[`L&A (logic and accuracy) flow 1`] = `
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down Expand Up @@ -1336,15 +1336,15 @@ exports[`L&A (logic and accuracy) flow 2`] = `
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down Expand Up @@ -2670,15 +2670,15 @@ exports[`L&A (logic and accuracy) flow 3`] = `
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down
6 changes: 3 additions & 3 deletions apps/central-scan/frontend/src/components/button_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const ButtonBar = styled('nav')<Props>`
flex: 1;
margin: 0.25rem;
@media (width >= 480px) {
@media (min-width: 480px) {
flex: ${({ separatePrimaryButton }) =>
separatePrimaryButton ? '0' : undefined};
}
Expand All @@ -33,7 +33,7 @@ export const ButtonBar = styled('nav')<Props>`
& > *:first-child {
order: ${({ naturalOrder = false }) => (naturalOrder ? undefined : '2')};
@media (width >= 480px) {
@media (min-width: 480px) {
margin-right: ${({ naturalOrder = false, separatePrimaryButton }) =>
separatePrimaryButton && naturalOrder ? 'auto' : undefined};
margin-left: ${({ naturalOrder = false, separatePrimaryButton }) =>
Expand All @@ -42,7 +42,7 @@ export const ButtonBar = styled('nav')<Props>`
}
& > *:only-child {
@media (width >= 480px) {
@media (min-width: 480px) {
flex: ${({ centerOnlyChild = true }) => (centerOnlyChild ? 0 : 1)};
margin: ${({ centerOnlyChild = true }) =>
centerOnlyChild ? 'auto' : undefined};
Expand Down
2 changes: 1 addition & 1 deletion apps/central-scan/frontend/src/components/prose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Prose = styled('div')<Props>`
text-align: ${({ textCenter }) => (textCenter ? 'center' : undefined)};
line-height: 1.2;
@media (width >= 480px) {
@media (min-width: 480px) {
line-height: 1.3;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ exports[`Single Seat Contest 1`] = `
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand All @@ -595,15 +595,15 @@ exports[`Single Seat Contest 1`] = `
}
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ exports[`Single Seat Contest 1`] = `
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand All @@ -595,15 +595,15 @@ exports[`Single Seat Contest 1`] = `
}
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,15 @@ exports[`Single Seat Contest with Write In 1`] = `
}
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ exports[`Single Seat Contest 1`] = `
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand All @@ -507,15 +507,15 @@ exports[`Single Seat Contest 1`] = `
}
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ exports[`Single Seat Contest 1`] = `
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand All @@ -507,15 +507,15 @@ exports[`Single Seat Contest 1`] = `
}
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,15 @@ exports[`Single Seat Contest with Write In 1`] = `
}
}
@media (width >= 480px) {
@media (min-width:480px) {
}
@media print {
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down
2 changes: 1 addition & 1 deletion libs/ui/src/__snapshots__/button_bar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports[`renders ButtonBar 1`] = `
}
@media (width >= 480px) {
@media (min-width:480px) {
.c0 > *:only-child {
-webkit-box-flex: initial;
-webkit-flex-grow: initial;
Expand Down
8 changes: 4 additions & 4 deletions libs/ui/src/__snapshots__/modal.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`Modal can configure a wider max width 1`] = `
padding: 0.5rem 0.75rem;
}
@media (width >= 480px) {
@media (min-width:480px) {
.c0 {
position: static;
border-radius: 0.5rem;
Expand All @@ -51,7 +51,7 @@ exports[`Modal can configure a wider max width 1`] = `
}
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down Expand Up @@ -122,7 +122,7 @@ exports[`Modal can configure fullscreen 1`] = `
overflow: auto;
}
@media (width >= 480px) {
@media (min-width:480px) {
.c0 {
position: static;
border-radius: 0;
Expand All @@ -137,7 +137,7 @@ exports[`Modal can configure fullscreen 1`] = `
}
}
@media (width >= 480px) {
@media (min-width:480px) {
}
Expand Down
2 changes: 1 addition & 1 deletion libs/ui/src/button_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ButtonBar = styled('div')`
}
& > *:only-child {
@media (width >= 480px) {
@media (min-width: 480px) {
flex-grow: initial;
margin: auto;
min-width: 33.333%;
Expand Down
4 changes: 2 additions & 2 deletions libs/ui/src/button_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import styled from 'styled-components';
export const ButtonList = styled.p`
column-gap: 1rem;
@media (width >= 1024px) {
@media (min-width: 1024px) {
columns: 2;
}
@media (width >= 1440px) {
@media (min-width: 1440px) {
columns: 3;
}
Expand Down
4 changes: 2 additions & 2 deletions libs/ui/src/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ReactModalContent = styled('div')<ReactModalContentInterface>`
font-size: ${({ themeDeprecated }) => themeDeprecated?.fontSize};
-webkit-overflow-scrolling: touch;
@media (width >= 480px) {
@media (min-width: 480px) {
position: static;
border-radius: ${({ fullscreen }) => (fullscreen ? '0' : '0.5rem')};
max-width: ${({ fullscreen, modalWidth = ModalWidth.Standard }) =>
Expand All @@ -62,7 +62,7 @@ const ReactModalOverlay = styled('div')<ReactModalOverlayInterface>`
z-index: 999; /* Should be above all default UI */
background: ${(p) => rgba(p.theme.colors.foreground, 0.9)};
@media (width >= 480px) {
@media (min-width: 480px) {
padding: ${({ fullscreen }) => (fullscreen ? '0' : '0.5rem')};
}
Expand Down
12 changes: 12 additions & 0 deletions stylelint.shared.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
// Configuration for our CSS linting with stylelint
module.exports = {
extends: ['stylelint-config-standard'],
customSyntax: 'postcss-styled-syntax',
rules: {
// We use color functions (e.g. rgb) in nested JS that, being JS, need comma-separated
// parameters. "Modern" notation in CSS is space-separated parameters. "Legacy"
// notation enforces comma-separated parameters.
'color-function-notation': 'legacy',
// Usually this rule is smart enough to ignore nested JS variable names, but
// sometimes it de-capitalizes them, so it's unsafe for auto-fix.
'value-keyword-case': [
'lower',
{
disableFix: true,
camelCaseSvgKeywords: true,
},
],
// Modern "context" notation for media queries is:
// @media (width >= 600px)
// Chromium supports this only after version 104, so we enforce the older
// "prefix" notation:
// @media (min-width: 600px)
'media-feature-range-notation': 'prefix',
},
};

0 comments on commit 855a4b1

Please sign in to comment.