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

[core] Add CSS lint in the CI #469

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jobs:
- run:
name: Eslint
command: yarn eslint:ci
- run:
name: Stylelint
command: yarn stylelint
- run:
name: Lint JSON
command: yarn jsonlint
Expand Down
25 changes: 17 additions & 8 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
// const baseline = require('@material-ui/monorepo/.stylelintrc');
Copy link
Member

Choose a reason for hiding this comment

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

Need #456 first in order to apply the change


// module.exports = {
// ...baseline,
// }

module.exports = {
"extends": [
"stylelint-config-recommended",
"stylelint-config-styled-components"
],
"processors": [
"stylelint-processor-styled-components"
]
}
processors: ['stylelint-processor-styled-components'],
extends: 'stylelint-config-standard',
rules: {
'value-no-vendor-prefix': true,
'property-no-vendor-prefix': true,
'no-empty-source': null,
'no-missing-end-of-source-newline': null,
'declaration-colon-newline-after': null,
'value-keyword-case': null,
},
};
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"demo:build": "yarn workspace demo-app build",
"demo:export": "yarn workspace demo-app export",
"deduplicate": "node scripts/deduplicate.js",
"stylelint": "stylelint '**/*.js' '**/*.ts' '**/*.tsx'",
"prettier": "yarn babel-node -i '/node_modules/(?!@material-ui)/' ./scripts/prettier.js --branch master",
"test": "lerna run test --parallel",
"test:coverage": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc mocha 'packages/**/*.test.tsx' --exclude '**/node_modules/**' && nyc report -r lcovonly",
Expand Down Expand Up @@ -101,10 +102,8 @@
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.28.0",
"sinon": "^9.0.2",
"stylelint": "^13.3.3",
"stylelint-config-recommended": "^3.0.0",
"stylelint": "^13.7.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"ts-jest": "^25.2.0",
"typescript": "^3.9.6",
Expand Down
3 changes: 1 addition & 2 deletions packages/demo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"build": "./node_modules/.bin/webpack -p --config ./webpack.prod.js",
"start": "./node_modules/.bin/webpack-dev-server --config webpack.dev.js",
"export": "mv dist ../../docs/export/demo",
"lint": "../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../.stylelintrc.js"
"lint": "../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../.eslintrc.js"
},
"setupFiles": [
"<rootDir>/src/setupTests.js"
Expand Down
1 change: 1 addition & 0 deletions packages/demo-app/src/app/app-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const DemoAppBarStyled = styled(AppBar)`
white-space: nowrap;
letter-spacing: 0.3rem;
}

.product-title {
margin-left: 10px;
color: ${(p) => p.theme.colors.xColor};
Expand Down
10 changes: 9 additions & 1 deletion packages/demo-app/src/app/app-intro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ const Splash = styled.div`
padding-bottom: 0 !important;
align-items: center !important;
}

.logo {
width: 120px;
height: 120px;
flex-shrink: 0;
margin-bottom: 16px;
}

@media (min-width: 960px) {
.splash-container {
text-align: left;
Expand All @@ -38,18 +40,21 @@ const Splash = styled.div`
padding-bottom: 128px;
max-width: 960px;
}

.logo {
width: 195px;
height: 175px;
margin-right: 64px;
}
}

@media (min-width: 600px) {
.splash-container {
padding-left: 24px;
padding-right: 24px;
}
}

.title {
flex-grow: 1;
font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
Expand All @@ -68,7 +73,7 @@ const Splash = styled.div`
font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
font-weight: 400;
line-height: 1.334;
letter-spacing: 0em;
letter-spacing: 0;
}

.product-title {
Expand All @@ -77,6 +82,7 @@ const Splash = styled.div`
font-weight: 500;
text-shadow: -2px 1px 4px #929292;
}

.product-title-logo {
color: ${(p) => p.theme.colors.secondApp};
position: absolute;
Expand All @@ -89,9 +95,11 @@ const Splash = styled.div`
display: none;
text-shadow: -2px 1px 4px ${(p) => p.theme.colors.xShadowColor};
}

.logo-container {
position: relative;
}

.main-action-button {
margin-top: 32px;
border: 1px solid rgba(25, 118, 210, 0.5);
Expand Down
12 changes: 12 additions & 0 deletions packages/demo-app/src/app/demos/grid/components/main-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ export const MainContainer = styled.div`
background-color: ${(p) => p.theme.colors.app} !important;
color: ${(p) => p.theme.colors.secondApp} !important;
}

.ag-theme-balham .ag-header {
background-color: ${(p) => p.theme.colors.grid.headerBackground} !important;
color: ${(p) => p.theme.colors.grid.headerTitle} !important;
}

.ag-theme-balham .ag-root {
border: none !important;
}

.grid-root {
&.material-grid {
.columns-container {
Expand All @@ -27,23 +30,29 @@ export const MainContainer = styled.div`
border-right-color: ${(p) => p.theme.colors.grid.headerBorderRight};
}
}

.window {
.material-row {
color: ${(p) => p.theme.colors.grid.rowColor};

&.odd {
background-color: ${(p) => p.theme.colors.grid.oddRowBackground};
}

&.even {
background-color: ${(p) => p.theme.colors.grid.evenRowBackground};
}

.material-cell {
border-right: none;
border-bottom-color: #bdc3c773;
}

&:hover {
background-color: ${(p) => p.theme.colors.grid.rowHoverBackground};
color: ${(p) => p.theme.colors.grid.rowHoverColor};
}

&.selected {
background-color: ${(p) => p.theme.colors.grid.rowSelectedBackground};
color: ${(p) => p.theme.colors.grid.rowSelectedColor};
Expand All @@ -52,6 +61,7 @@ export const MainContainer = styled.div`
}
}
}

.splitter-panel {
background-color: #cecece4f !important;
color: rgb(53, 54, 58);
Expand All @@ -60,10 +70,12 @@ export const MainContainer = styled.div`
.ag-header {
border-top: 1px solid ${(p) => p.theme.colors.app} !important;
}

.grid-title .grid-logo.mui {
margin: 5px;
}
}

.splitter-handler-wrapper {
border-right: 2px solid #2c2e2f !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const StyledPanels = styled.div`
padding: 20px;
background-color: ${(props) => props.theme.colors.panelBackground};
color: ${(props) => props.theme.colors.text};

.panel-title {
background-color: ${(props) => props.theme.colors.panelTitleBg};
color: ${(props) => props.theme.colors.panelTitle};
Expand All @@ -22,6 +23,7 @@ export const StyledPanels = styled.div`
font-size: 12px;
}
}

.input-text {
margin: 5px;
width: 100px;
Expand All @@ -33,6 +35,7 @@ export const StyledPanels = styled.div`
input {
color: ${(p) => p.theme.colors.text};
}

.MuiFormLabel-root {
color: ${(p) => p.theme.colors.label};

Expand All @@ -41,19 +44,22 @@ export const StyledPanels = styled.div`
}
}
}

.apply-btn {
margin-left: 15px;
margin-top: 5px;
}

.switch {
display: none;
color: ${(p) => p.theme.colors.text};
font-size: 12px;

& label: {
& label {
font-size: 12px;
}
}

.action-button-bar {
padding: 10px;
align-items: center;
Expand Down
3 changes: 1 addition & 2 deletions packages/grid/data-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
],
"scripts": {
"precommit": "npm run lint",
"lint": "eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../../.stylelintrc.js",
"lint": "eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js",
"typescript": "tsc -p tsconfig.json",
"build": "cd ../ && rollup --config rollup.data-grid.config.js"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/grid/x-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
],
"scripts": {
"precommit": "npm run lint",
"lint": "../../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../../.stylelintrc.js",
"lint": "../../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js",
"typescript": "tsc -p tsconfig.json",
"build": "cd ../ && rollup --config rollup.x-grid.config.js"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
"start": "start-storybook -p 6006 --ci",
"build": "build-storybook -o dist/ -s storybook --quiet",
"export": "mv dist ../../docs/export/storybook",
"lint": "../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ./.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../.stylelintrc.js",
"lint": "../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ./.eslintrc.js",
"test": "jest -c integration/setup/jest.config.js --detectOpenHandles --force-exit --runInBand",
"test:ci": "start-server-and-test start http://localhost:6006 test"
}
Expand Down
3 changes: 1 addition & 2 deletions packages/x-grid-data-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"precommit": "npm run lint",
"build": "rollup -c",
"start": "rollup -cw",
"lint": "../../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../../.stylelintrc.js"
"lint": "../../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js"
},
"dependencies": {
"@types/chance": "^1.1.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/x-license/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"precommit": "npm run lint",
"build": "rollup -c",
"start": "rollup -cw",
"lint": "../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../.stylelintrc.js",
"lint": "../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../.eslintrc.js",
"test": "../../node_modules/.bin/jest --config jest.config.js"
},
"setupFiles": [
Expand Down
13 changes: 4 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20349,11 +20349,6 @@ stylelint-config-standard@^20.0.0:
dependencies:
stylelint-config-recommended "^3.0.0"

stylelint-config-styled-components@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/stylelint-config-styled-components/-/stylelint-config-styled-components-0.1.1.tgz#b408388d7c687833ab4be4c4e6522d97d2827ede"
integrity sha512-z5Xz/9GmvxO6e/DLzBMwkB85zHxEEjN6K7Cj80Bi+o/9vR9eS3GX3E9VuMnX9WLFYulqbqLtTapGGY28JBiy9Q==

stylelint-processor-styled-components@^1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/stylelint-processor-styled-components/-/stylelint-processor-styled-components-1.10.0.tgz#8082fc68779476aac411d3afffac0bc833d77a29"
Expand All @@ -20364,10 +20359,10 @@ stylelint-processor-styled-components@^1.10.0:
micromatch "^4.0.2"
postcss "^7.0.26"

stylelint@^13.3.3:
version "13.7.1"
resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.7.1.tgz#bee97ee78d778a3f1dbe3f7397b76414973e263e"
integrity sha512-qzqazcyRxrSRdmFuO0/SZOJ+LyCxYy0pwcvaOBBnl8/2VfHSMrtNIE+AnyJoyq6uKb+mt+hlgmVrvVi6G6XHfQ==
stylelint@^13.7.2:
version "13.7.2"
resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.7.2.tgz#6f3c58eea4077680ed0ceb0d064b22b100970486"
integrity sha512-mmieorkfmO+ZA6CNDu1ic9qpt4tFvH2QUB7vqXgrMVHe5ENU69q7YDq0YUg/UHLuCsZOWhUAvcMcLzLDIERzSg==
dependencies:
"@stylelint/postcss-css-in-js" "^0.37.2"
"@stylelint/postcss-markdown" "^0.36.1"
Expand Down