Skip to content

Commit

Permalink
Add style lint to site (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebiVPS authored Jul 10, 2024
1 parent 7039c85 commit 826c269
Show file tree
Hide file tree
Showing 9 changed files with 694 additions and 64 deletions.
1 change: 1 addition & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
"site/src/**/*.{ts,tsx,js,jsx,json,css,md}": () => "npm --prefix site run lint:eslint",
"site/**/*.{ts,tsx}": () => "npm --prefix site run lint:tsc",
"site/**/*.{js,json,md,yml,yaml}": () => "npm --prefix site run lint:prettier",
"site/src/**/*.{ts,tsx,css}": () => "npm --prefix site run lint:style",
"create-app/src/**/*.{ts,tsx,js,jsx,json,css,scss,md}": () => "npm --prefix create-app run lint:eslint",
"create-app/**/*.{ts,tsx}": () => "npm --prefix create-app run lint:tsc",
"create-app/**/*.{js,json,md,yml,yaml}": () => "npm --prefix create-app run lint:prettier",
Expand Down
7 changes: 7 additions & 0 deletions site/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "stylelint-config-standard",
"customSyntax": "postcss-styled-syntax",
"rules": {
"declaration-empty-line-before": null
}
}
719 changes: 670 additions & 49 deletions site/package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
"gql:watch": "graphql-codegen --watch",
"clear:preBuild": "rimraf preBuild/build",
"prelint": "npm run intl:compile && run-p gql:types generate-block-types",
"lint": "run-p lint:eslint lint:tsc",
"lint": "run-p lint:eslint lint:tsc lint:style",
"lint:eslint": "eslint --max-warnings 0 --config ./.eslintrc.cli.js --ext .ts,.tsx,.js,.jsx,.json,.md src/ package.json",
"lint:prettier": "npx prettier --check './**/*.{js,json,md,yml,yaml}'",
"lint:tsc": "tsc --project .",
"lint:tscPreBuild": "tsc --project tsconfig.preBuild.json",
"lint:style": "npx stylelint '**/*.{ts,tsx,css}'",
"generate-block-types": "comet generate-block-types",
"generate-block-types:watch": "chokidar -s \"**/block-meta.json\" -c \"npm run generate-block-types\"",
"intl:extract": "formatjs extract \"src/**/*.ts*\" --ignore **/*.d.ts --out-file lang-extracted/en.json --format simple",
Expand Down Expand Up @@ -66,8 +67,11 @@
"dotenv-cli": "^7.0.0",
"eslint": "^8.0.0",
"npm-run-all": "^4.1.5",
"postcss-styled-syntax": "^0.6.4",
"prettier": "^2.0.0",
"rimraf": "^3.0.0",
"stylelint": "^16.6.1",
"stylelint-config-standard": "^36.0.0",
"tsconfig-paths": "^3.0.0",
"typescript": "~5.1.0"
}
Expand Down
3 changes: 1 addition & 2 deletions site/src/common/blocks/CallToActionListBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export const PageContentCallToActionListBlock = (props: CallToActionListBlockPro

const Root = styled.div`
display: flex;
flex-wrap: wrap;
flex-direction: row;
flex-flow: row wrap;
gap: ${({ theme }) => theme.spacing.S300};
${({ theme }) => theme.breakpoints.sm.mediaQuery} {
Expand Down
4 changes: 2 additions & 2 deletions site/src/common/blocks/RichTextBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ const Root = styled.div<{ $disableLastBottomSpacing?: boolean }>`
const Text = styled(Typography)`
white-space: pre-line;
// Show empty lines as spacing between paragraphs
&:empty:not(:first-child:last-child):before {
/* Show empty lines as spacing between paragraphs */
&:empty:not(:first-child:last-child)::before {
white-space: pre;
content: " ";
}
Expand Down
12 changes: 4 additions & 8 deletions site/src/documents/pages/blocks/ColumnsBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ const Column = styled.div<{ $layout: string }>`
$layout === "4-16-4" &&
css`
grid-column: 5 / -5;
}
`};
`};
${({ $layout }) =>
$layout === "9-9" &&
css`
Expand All @@ -75,8 +74,7 @@ const Column = styled.div<{ $layout: string }>`
&:nth-child(even) {
grid-column: 14 / 23;
}
}
`};
`};
${({ $layout }) =>
$layout === "12-6" &&
css`
Expand All @@ -85,8 +83,7 @@ const Column = styled.div<{ $layout: string }>`
&:nth-child(even) {
grid-column: 17 / 23;
}
}
`};
`};
${({ $layout }) =>
$layout === "6-12" &&
css`
Expand All @@ -95,7 +92,6 @@ const Column = styled.div<{ $layout: string }>`
&:nth-child(even) {
grid-column: 11 / 23;
}
}
`};
`};
}
`;
4 changes: 3 additions & 1 deletion site/src/layout/GlobalStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ export const GlobalStyle = createGlobalStyle`
html {
/* Prevent font size adjustments after orientation changes in mobile devices */
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}
body {
margin: 0;
/* Improve text rendering with font-smoothing */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
Expand Down Expand Up @@ -68,6 +69,7 @@ export const GlobalStyle = createGlobalStyle`
}
/* Create a root stacking context: https://www.joshwcomeau.com/css/custom-css-reset/#eight-root-stacking-context-9 */
/* stylelint-disable selector-id-pattern */
#root,
#__next {
isolation: isolate;
Expand Down
2 changes: 1 addition & 1 deletion site/src/layout/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const SubLevelNavigation = styled.ol`
list-style-type: none;
padding: 5px;
background-color: white;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 4px rgb(0 0 0 / 10%);
`;

const TopLevelLinkContainer = styled.li`
Expand Down

0 comments on commit 826c269

Please sign in to comment.