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

webui: setup lint for style files #4941

Merged
merged 2 commits into from
Jul 21, 2023
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
38 changes: 38 additions & 0 deletions ui/webui/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"extends": "stylelint-config-standard-scss",
"rules": {
"declaration-colon-newline-after": null,
"selector-list-comma-newline-after": null,

"at-rule-empty-line-before": null,
"declaration-colon-space-before": null,
"declaration-empty-line-before": null,
"custom-property-empty-line-before": null,
"comment-empty-line-before": null,
"scss/double-slash-comment-empty-line-before": null,
"scss/dollar-variable-colon-space-after": null,

"custom-property-pattern": null,
"declaration-block-no-duplicate-properties": null,
"declaration-block-no-redundant-longhand-properties": null,
"declaration-block-no-shorthand-property-overrides": null,
"declaration-block-single-line-max-declarations": null,
"font-family-no-duplicate-names": null,
"function-url-quotes": null,
"indentation": null,
"keyframes-name-pattern": null,
"max-line-length": null,
"no-descending-specificity": null,
"no-duplicate-selectors": null,
"scss/at-extend-no-missing-placeholder": null,
"scss/at-import-partial-extension": null,
"scss/at-mixin-pattern": null,
"scss/comment-no-empty": null,
"scss/dollar-variable-pattern": null,
"scss/double-slash-comment-whitespace-inside": null,
"scss/no-global-function-names": null,
"scss/operator-no-unspaced": null,
"selector-class-pattern": null,
"selector-id-pattern": null
KKoukiou marked this conversation as resolved.
Show resolved Hide resolved
}
}
2 changes: 2 additions & 0 deletions ui/webui/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { cleanPlugin } from './pkg/lib/esbuild-cleanup-plugin.js';
import { cockpitPoEsbuildPlugin } from './pkg/lib/cockpit-po-plugin.js';
import { cockpitRsyncEsbuildPlugin } from './pkg/lib/cockpit-rsync-plugin.js';
import { eslintPlugin } from './pkg/lib/esbuild-eslint-plugin.js';
import { stylelintPlugin } from './pkg/lib/esbuild-stylelint-plugin.js';
import { replace } from 'esbuild-plugin-replace';
import { sassPlugin } from 'esbuild-sass-plugin';

Expand Down Expand Up @@ -70,6 +71,7 @@ const context = await esbuild.context({
cleanPlugin(),
...lint
? [
stylelintPlugin({ filter: new RegExp(cwd + '/src/.*\\.(css?|scss?)$') }),
eslintPlugin({ filter: new RegExp(cwd + '\/src\/.*\.(jsx?|js?)$') })
]
KKoukiou marked this conversation as resolved.
Show resolved Hide resolved
: [],
Expand Down
9 changes: 7 additions & 2 deletions ui/webui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"watch": "ESBUILD_WATCH=true ./build.js",
"build": "./build.js",
"eslint": "eslint --ext .js --ext .jsx src/",
"eslint:fix": "eslint --fix --ext .js --ext .jsx src/"
"eslint:fix": "eslint --fix --ext .js --ext .jsx src/",
"stylelint": "stylelint 'src/**/*{.css,scss}'",
"stylelint:fix": "stylelint --fix 'src/**/*{.css,scss}'"
KKoukiou marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"chrome-remote-interface": "^0.32.0",
Expand All @@ -35,7 +37,10 @@
"qunit": "^2.19.0",
"sass": "^1.59.3",
"sizzle": "^2.3.6",
"stdio": "^2.1.1"
"stdio": "^2.1.1",
"stylelint": "^14.9.1",
"stylelint-config-standard-scss": "^5.0.0",
"stylelint-formatter-pretty": "^3.1.1"
},
"dependencies": {
"@patternfly/patternfly": "4.224.2",
Expand Down
4 changes: 3 additions & 1 deletion ui/webui/src/components/HeaderKebab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
display: none;
}

/* Make the close button more obvious, since we hide the side graphic*/
/* Make the close button more obvious, since we hide the side graphic */
.pf-c-about-modal-box__close .pf-c-button.pf-m-plain {
--pf-c-about-modal-box__close--c-button--BackgroundColor: var(--pf-global--BackgroundColor--dark-200);
position: absolute;
}

.pf-c-about-modal-box__close .pf-c-button.pf-m-plain:hover {
--pf-c-about-modal-box__close--c-button--BackgroundColor: var(--pf-global--BackgroundColor--dark-400);
}
Expand All @@ -30,6 +31,7 @@
.title {
font-size: var(--pf-c-title--m-3xl--FontSize);
}

.subtitle {
font-size: var(--pf-c-title--m-xl--FontSize);
}
Expand Down
2 changes: 2 additions & 0 deletions ui/webui/src/components/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ html:not(.index-page) body {
#installation-wizard .pf-c-wizard__main {
display: flex;
}

#installation-wizard .pf-c-wizard__main-body {
flex: 1 1 auto;
}
Expand All @@ -23,6 +24,7 @@ html:not(.index-page) body {
.ct-table .pf-c-table__expandable-row-content {
display: flex;
}

.ct-table .ct-table {
flex: 75% 0 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.pf-c-empty-state__content {
width: 100%
width: 100%;
}

.installation-progress-status {
&-success .pf-c-empty-state__icon {
color: var(--pf-global--success-color--100);
Expand Down
2 changes: 1 addition & 1 deletion ui/webui/src/components/storage/DiskEncryption.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Span disk encryption password fields to take slightly more width than the default
#disk-encryption-encrypt-devices ~.pf-c-check__body {
#disk-encryption-encrypt-devices ~ .pf-c-check__body {
width: min(60ch, 100%);
}