-
Notifications
You must be signed in to change notification settings - Fork 53
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
chore: introduce CSS Modules #1265
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"clean": "rimraf --glob '{e2e-projects/*/{.next,.svelte-kit},packages/*/{.next,.svelte-kit,build,coverage,dist,out,package.tgz,storybook-static},playwright/{playwright-report,test-results}}'", | ||
"clean": "rimraf --glob '{e2e-projects/*/{.next,.svelte-kit},packages/*/{.next,.svelte-kit,build,coverage,dist,out,package.tgz,src/**/*.module.css.d.ts,storybook-static},playwright/{playwright-report,test-results}}'", | ||
"dev": "concurrently --prefix-colors auto \"yarn:dev:*\"", | ||
"dev:manager": "yarn workspace @slicemachine/manager dev", | ||
"dev:start-slicemachine": "yarn workspace start-slicemachine dev", | ||
|
@@ -20,6 +20,7 @@ | |
"build-essential": "yarn workspace @slicemachine/plugin-kit build && yarn workspace @slicemachine/manager build", | ||
"audit": "yarn workspaces foreach --parallel --verbose run audit", | ||
"lint": "yarn workspaces foreach --verbose run lint", | ||
"stylelint": "yarn workspaces foreach --verbose run stylelint", | ||
"lint-staged": "lint-staged", | ||
"prettier:fix": "prettier --write .", | ||
"prettier:check": "prettier --check .", | ||
|
@@ -65,6 +66,10 @@ | |
"**/packages/slice-machine/**/*.@(js|jsx|ts|tsx|)": [ | ||
"prettier --write --ignore-unknown", | ||
"yarn workspace slice-machine-ui lint:precommit" | ||
], | ||
"**/packages/slice-machine/**/*.module.css": [ | ||
"prettier --write --ignore-unknown", | ||
"yarn workspace slice-machine-ui stylelint:precommit" | ||
] | ||
}, | ||
"resolutions": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/src/**/*.module.css.d.ts | ||
/storybook-static | ||
!/.storybook | ||
build | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ yarn-error.log* | |
.vercel | ||
|
||
# typescript | ||
/src/**/*.module.css.d.ts | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.root { | ||
background-color: var(--grey2); | ||
border-color: var(--grey6); | ||
/* stylelint-disable-next-line declaration-property-value-allowed-list -- The component has a border radius of 3 px in Figma. */ | ||
border-radius: 3px; | ||
border-style: solid; | ||
border-width: 1px; | ||
color: var(--grey11); | ||
padding-inline: 4px; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { cssTheme } = require("@prismicio/editor-ui"); | ||
|
||
module.exports = { | ||
defaultSeverity: "warning", | ||
reportNeedlessDisables: true, | ||
reportInvalidScopeDisables: true, | ||
reportDescriptionlessDisables: true, | ||
rules: { | ||
"declaration-property-value-allowed-list": cssTheme, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this line ensure we follow the theme tokens? Like colors, spacing, sizing, etc.? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly 🙂 It works fine, but I miss the TypeScript auto completion. |
||
}, | ||
extends: ["stylelint-config-recommended", "stylelint-config-css-modules"], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,13 @@ | |
"description": "E2E tests for Slice Machine", | ||
"author": "Prismic <[email protected]> (https://prismic.io)", | ||
"scripts": { | ||
"audit": "echo \"No audit for playwright\" && true", | ||
"depcheck": "depcheck --config=.depcheckrc", | ||
"lint": "eslint --max-warnings 0 --ext .js,.ts .", | ||
"test:e2e:install": "playwright install --with-deps chromium", | ||
"test:e2e:report": "playwright show-report", | ||
"test:e2e": "playwright test", | ||
"types": "tsc --noEmit", | ||
"test:e2e:merge-reports": "playwright merge-reports", | ||
"unit": "echo \"No unit tests for playwright\" && true" | ||
"test:e2e:merge-reports": "playwright merge-reports" | ||
}, | ||
"devDependencies": { | ||
"@msgpack/msgpack": "2.8.0", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there was a discussion a while ago about removing pre-commit hooks considering we do these checks in CI. Is that still planned? If yes, I wonder if we should not add new pre-commit hooks.
(I prefer no pre-commit hooks since it slows the commit process down, but I don't have a full understanding of the history.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most team members, if not all, are okay to remove all our pre-commit hooks. However, I don't think it was listed somewhere so I've just created a Linear issue in our backlog: DT-1906. In the meantime, I think consistency has value and as TypeScript files are linted before committing, I think it's okay to do the same for CSS Modules.