Skip to content

Commit

Permalink
Adopt stylelint and apply initial rules (jupyterlab#11944)
Browse files Browse the repository at this point in the history
* add stylelint, sort setup.cfg deps

* enable fixing

* revert setup.cfg changes

* comment no-eol-whitespace to show a trivial fail

* add stylelint:check to ci

* enable stylelint cache

* use stylelint to fix no-eol-whitespace

* [stylelint] fix block-no-empty, ignore nbconvert-css

* [stylelint] declaration-block-no-duplicate-properties

* [stylelint] declaration-block-no-shorthand-property-overrides

* [stylelint] no-duplicate-selectors

* revert toolbar padding change

* normalize formatting with stylelint(-config)-prettier

* explicitly add recommended

* [stylelint] no-invalid-position-at-import-rule

* resolve, dedupe yarn.lock
  • Loading branch information
bollwyvl authored Feb 3, 2022
1 parent 4f6e415 commit 2c2d83f
Show file tree
Hide file tree
Showing 24 changed files with 551 additions and 718 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# project files
coverage/
.eslintcache
.stylelintcache

dev_mode/listings
dev_mode/schemas
Expand Down
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages/nbconvert-css/style/index.css
50 changes: 50 additions & 0 deletions .stylelintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
$schema: https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/stylelintrc.json

extends:
- stylelint-config-recommended
- stylelint-config-standard
- stylelint-prettier/recommended

rules:
# TODO: fix all of these rules violated in stylelint-config-recommended
no-descending-specificity: null
# TODO: evaluate these rules violated in stylelint-config-standard
alpha-value-notation: null
at-rule-empty-line-before: null
at-rule-no-vendor-prefix: null
block-closing-brace-space-before: null
block-opening-brace-space-after: null
color-function-notation: null
color-hex-length: null
comment-empty-line-before: null
comment-whitespace-inside: null
custom-property-empty-line-before: null
custom-property-pattern: null
declaration-block-no-redundant-longhand-properties: null
declaration-block-semicolon-newline-after: null
declaration-block-single-line-max-declarations: null
declaration-block-trailing-semicolon: null
declaration-colon-newline-after: null
declaration-empty-line-before: null
function-url-quotes: null
indentation: null
keyframes-name-pattern: null
length-zero-no-unit: null
max-empty-lines: null
max-line-length: null
number-leading-zero: null
number-max-precision: null
property-no-vendor-prefix: null
rule-empty-line-before: null
selector-class-pattern: null
selector-combinator-space-before: null
selector-descendant-combinator-no-non-space: null
selector-id-pattern: null
selector-list-comma-newline-after: null
selector-no-vendor-prefix: null
selector-pseudo-element-colon-notation: null
shorthand-property-no-redundant-values: null
string-quotes: null
value-keyword-case: null
value-list-comma-newline-after: null
value-no-vendor-prefix: null
2 changes: 1 addition & 1 deletion docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ main img.jp-screenshot {
margin-bottom: 24px;
}

/*
/*
* The div.jp-youtube-video styling is done to get the YouTube video to size dynamically
* to 100% of the content width.
*/
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
"lighthouse:compare": "node testutils/lib/compare-lighthouse.js",
"lighthouse:throttling:start": "comcast --latency=40 --target-bw=30000 --packet-loss=0.2%",
"lighthouse:throttling:stop": "comcast --stop",
"lint": "jlpm && jlpm run prettier && jlpm run eslint",
"lint:check": "jlpm run prettier:check && jlpm run eslint:check",
"lint": "jlpm && jlpm prettier && jlpm eslint && jlpm stylelint",
"lint:check": "jlpm prettier:check && jlpm eslint:check && jlpm stylelint:check",
"patch:release": "node buildutils/lib/patch-release.js",
"prepare:python-release": "node buildutils/lib/prepare-python-release.js",
"prepublish:check": "node buildutils/lib/prepublish-check.js",
Expand All @@ -87,6 +87,8 @@
"remove:dependency": "node buildutils/lib/remove-dependency.js",
"remove:package": "node buildutils/lib/remove-package.js",
"remove:sibling": "node buildutils/lib/remove-package.js",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"{packages/*,galata}/style/**/*.css\" \"{examples/*,docs/**}/*.css\"",
"test": "lerna run test --scope \"@jupyterlab/*\" --concurrency 1 --stream",
"test:all": "lerna run test --scope \"@jupyterlab/*\" --concurrency 1 --stream --no-bail",
"test:examples": "python examples/test_examples.py",
Expand Down Expand Up @@ -122,6 +124,11 @@
"lint-staged": "^10.2.13",
"prettier": "~2.1.1",
"shell-quote": "^1.7.2",
"stylelint": "^14.3.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^6.0.0",
"stylelint-config-standard": "~24.0.0",
"stylelint-prettier": "^2.0.0",
"typedoc": "~0.22.10",
"yarn": "1.22.17"
}
Expand Down
84 changes: 1 addition & 83 deletions packages/application/style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,90 +3,8 @@
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

:root {
--jp-private-menu-panel-height: 27px;
}

.lm-Widget.lm-mod-hidden {
display: none !important;
}

body {
font-family: var(--jp-ui-font-family);
background: var(--jp-layout-color3);
margin: 0;
padding: 0;
overflow: hidden;
}

.jp-LabShell {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}

.jp-LabShell.jp-mod-devMode {
border-top: 4px solid red;
}

#jp-main-dock-panel {
padding: 5px;
}

#jp-main-dock-panel[data-mode='single-document'] {
padding: 0;
}

#jp-main-dock-panel[data-mode='single-document'] .jp-MainAreaWidget {
border: none;
}

#jp-top-panel {
border-bottom: var(--jp-border-width) solid var(--jp-border-color0);
background: var(--jp-layout-color1);
display: flex;
min-height: var(--jp-private-menubar-height);
overflow: visible;
}

#jp-menu-panel {
min-height: var(--jp-private-menu-panel-height);
background: var(--jp-layout-color1);
}

#jp-down-stack {
border-bottom: var(--jp-border-width) solid var(--jp-border-color1);
}

.jp-LabShell[data-shell-mode='single-document'] #jp-top-panel {
border-bottom: none;
}

.jp-LabShell[data-shell-mode='single-document'] #jp-menu-panel {
padding-left: calc(
var(--jp-private-sidebar-tab-width) + var(--jp-border-width)
);
border-bottom: var(--jp-border-width) solid var(--jp-border-color0);
/* Adjust min-height so open menus show up in the right place */
min-height: calc(
var(--jp-private-menu-panel-height) + var(--jp-border-width)
);
}

#jp-bottom-panel {
background: var(--jp-layout-color1);
display: flex;
}

#jp-single-document-mode {
margin: 0px 8px;
display: flex;
align-items: center;
}

/* Sibling imports */
@import './core.css';
@import './datagrid.css';
@import './dockpanel.css';
@import './menus.css';
Expand Down
87 changes: 87 additions & 0 deletions packages/application/style/core.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*-----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

:root {
--jp-private-menu-panel-height: 27px;
}

.lm-Widget.lm-mod-hidden {
display: none !important;
}

body {
font-family: var(--jp-ui-font-family);
background: var(--jp-layout-color3);
margin: 0;
padding: 0;
overflow: hidden;
}

.jp-LabShell {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}

.jp-LabShell.jp-mod-devMode {
border-top: 4px solid red;
}

#jp-main-dock-panel {
padding: 5px;
}

#jp-main-dock-panel[data-mode='single-document'] {
padding: 0;
}

#jp-main-dock-panel[data-mode='single-document'] .jp-MainAreaWidget {
border: none;
}

#jp-top-panel {
border-bottom: var(--jp-border-width) solid var(--jp-border-color0);
background: var(--jp-layout-color1);
display: flex;
min-height: var(--jp-private-menubar-height);
overflow: visible;
}

#jp-menu-panel {
min-height: var(--jp-private-menu-panel-height);
background: var(--jp-layout-color1);
}

#jp-down-stack {
border-bottom: var(--jp-border-width) solid var(--jp-border-color1);
}

.jp-LabShell[data-shell-mode='single-document'] #jp-top-panel {
border-bottom: none;
}

.jp-LabShell[data-shell-mode='single-document'] #jp-menu-panel {
padding-left: calc(
var(--jp-private-sidebar-tab-width) + var(--jp-border-width)
);
border-bottom: var(--jp-border-width) solid var(--jp-border-color0);
/* Adjust min-height so open menus show up in the right place */
min-height: calc(
var(--jp-private-menu-panel-height) + var(--jp-border-width)
);
}

#jp-bottom-panel {
background: var(--jp-layout-color1);
display: flex;
}

#jp-single-document-mode {
margin: 0px 8px;
display: flex;
align-items: center;
}
4 changes: 0 additions & 4 deletions packages/apputils/style/commandpalette.css
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@
fill: var(--jp-layout-color0);
}

.lm-CommandPalette-item.lm-mod-active .lm-CommandPalette-itemLabel > mark {
color: var(--jp-ui-inverse-font-color0);
}

.lm-CommandPalette-item.lm-mod-active:hover:not(.lm-mod-disabled) {
color: var(--jp-ui-inverse-font-color1);
background: var(--jp-brand-color1);
Expand Down
4 changes: 0 additions & 4 deletions packages/cells/style/inputarea.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
display: table-cell;
overflow: hidden;
vertical-align: top;
}

.jp-InputArea-editor {
/* This is the non-active, default styling */
border: var(--jp-border-width) solid var(--jp-cell-editor-border-color);
border-radius: 0px;
Expand All @@ -40,7 +37,6 @@
line-height: var(--jp-code-line-height);
font-size: var(--jp-code-font-size);
border: var(--jp-border-width) solid transparent;
opacity: var(--jp-cell-prompt-opacity);
/* Right align prompt text, don't wrap to handle large prompt numbers */
text-align: right;
white-space: nowrap;
Expand Down
2 changes: 1 addition & 1 deletion packages/cells/style/widget.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
display: flex;
}

/* showHiddenCellsButton (only show if jp-mod-showHiddenCellsButton is set, which
/* showHiddenCellsButton (only show if jp-mod-showHiddenCellsButton is set, which
is a consequence of the showHiddenCellsButton option in Notebook Settings)*/
.jp-Notebook.jp-mod-showHiddenCellsButton .jp-showHiddenCellsButton {
margin-left: calc(var(--jp-cell-prompt-width) + 2 * var(--jp-code-padding));
Expand Down
4 changes: 2 additions & 2 deletions packages/console/style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
}

/* This rule is for styling cell run by another activity in this console */
.jp-CodeConsole-content .jp-Cell.jp-CodeConsole-foreignCell {
}
/* .jp-CodeConsole-content .jp-Cell.jp-CodeConsole-foreignCell {
} */

.jp-CodeConsole-content .jp-InputArea-editor.jp-InputArea-editor {
background: transparent;
Expand Down
Loading

0 comments on commit 2c2d83f

Please sign in to comment.