From 230f9524be53f59a90800895fbd73cc458a7aadf Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 11 Dec 2017 15:05:58 +0100 Subject: [PATCH] new less linter rules and compliance --- .lesshintrc | 16 ++++++++-------- customize.dist/src/less2/404.less | 2 +- customize.dist/src/less2/include/alertify.less | 4 ++-- customize.dist/src/less2/include/app-print.less | 2 +- customize.dist/src/less2/include/dropdown.less | 2 +- .../src/less2/include/icon-colors.less | 4 ++-- customize.dist/src/less2/include/limit-bar.less | 2 +- customize.dist/src/less2/include/toolbar.less | 10 +++++----- customize.dist/src/less2/main.less | 2 +- customize.dist/src/less2/pages/page-about.less | 2 +- customize.dist/src/less2/pages/page-contact.less | 4 ++-- customize.dist/src/less2/pages/page-index.less | 2 +- package.json | 2 ++ 13 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.lesshintrc b/.lesshintrc index 59f15cf5a..693029bf1 100644 --- a/.lesshintrc +++ b/.lesshintrc @@ -13,29 +13,29 @@ "decimalZero": { "enabled": false }, // disallow .5em "borderZero": { "enabled": false }, // disallow border: none; "selectorNaming": { "enabled": false }, // this would be crap because classes are what they are. - - // These rules should be discussed, if they're crap then they should be moved up. "zeroUnit": { "enabled": false }, - "spaceAroundComma": { "enabled": false }, "singleLinePerProperty": { "enabled": false }, "_singleLinePerProperty": { "enabled": true, "allowSingleLineRules": true }, + "spaceAroundComma": { "enabled": false }, "importantRule": { "enabled": false }, + "universalSelector": { "enabled": false }, "idSelector": { "enabled": false }, "singleLinePerSelector": { "enabled": false }, - "spaceAfterPropertyColon": { "enabled": false }, "spaceBetweenParens": { "enabled": false }, - "universalSelector": { "enabled": false }, "maxCharPerLine": { "enabled": false }, // using lesshint flags can cause long lines - "colorVariables": { "enabled": false }, // require all colors to be stored as variables first... "comment": { "enabled": false }, // ban multi-line comments ? + + // These rules should be discussed, if they're crap then they should be moved up. + "colorVariables": { "enabled": false }, // require all colors to be stored as variables first... "variableValue": { "enabled": false }, // any attribute types which should always be variables ? color? - "finalNewline": { "enabled": true }, // require an emprty line at the end of the file (enabled for now) - "spaceBeforeBrace": { "enabled": false },//{ "enabled": true, "style": "one_space" }, + "spaceBeforeBrace": { "enabled": true },//{ "enabled": true, "style": "one_space" }, // Turn everything else on + "spaceAfterPropertyColon": { "enabled": true }, + "finalNewline": { "enabled": true }, // require an empty line at the end of the file (enabled for now) "attributeQuotes": { "enabled": true }, "depthLevel": { "depth": 1 // TODO(cjd) This is obviously not triggering, even with 1 diff --git a/customize.dist/src/less2/404.less b/customize.dist/src/less2/404.less index ca1c3503e..33a852cd0 100644 --- a/customize.dist/src/less2/404.less +++ b/customize.dist/src/less2/404.less @@ -22,7 +22,7 @@ html.cp-app-print { .app-print_main(); } -body.cp-readonly .cp-hidden-if-readonly { display:none !important; } +body.cp-readonly .cp-hidden-if-readonly { display: none !important; } body.cp-app-drive { @import "../../../drive/app-drive.less"; } body.cp-app-pad { @import "../../../pad/app-pad.less"; } diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less index d683e2cd9..a75a0bb07 100644 --- a/customize.dist/src/less2/include/alertify.less +++ b/customize.dist/src/less2/include/alertify.less @@ -28,7 +28,7 @@ // These show only once .alertify-logs { - z-index:10000; // alertify logs + z-index: 10000; // alertify logs @media print { visibility: hidden; } @@ -222,7 +222,7 @@ border: 1px dotted @alertify-base; } &::-moz-focus-inner { - border:0; + border: 0; } } diff --git a/customize.dist/src/less2/include/app-print.less b/customize.dist/src/less2/include/app-print.less index d25110056..957170044 100644 --- a/customize.dist/src/less2/include/app-print.less +++ b/customize.dist/src/less2/include/app-print.less @@ -4,7 +4,7 @@ height: auto; max-height: none; overflow: visible; - display:block; + display: block; @page { margin: 0; size: landscape; diff --git a/customize.dist/src/less2/include/dropdown.less b/customize.dist/src/less2/include/dropdown.less index 49d6ef74f..3cf32537e 100644 --- a/customize.dist/src/less2/include/dropdown.less +++ b/customize.dist/src/less2/include/dropdown.less @@ -13,7 +13,7 @@ } button { - .fa-caret-down{ + .fa-caret-down { margin-right: 0px; margin-left: 5px; } diff --git a/customize.dist/src/less2/include/icon-colors.less b/customize.dist/src/less2/include/icon-colors.less index a71059950..b787fee1c 100644 --- a/customize.dist/src/less2/include/icon-colors.less +++ b/customize.dist/src/less2/include/icon-colors.less @@ -12,7 +12,7 @@ .cp-icon-color-settings { color: @colortheme_settings-bg; } .cp-icon-color-profile { color: @colortheme_settings-bg; } .cp-icon-color-default { color: @colortheme_default-bg; } - .cp-icon-color-todo { color:@colortheme_todo-bg; } + .cp-icon-color-todo { color: @colortheme_todo-bg; } .cp-border-color-pad { border-color: @colortheme_pad-bg !important; } .cp-border-color-code { border-color: @colortheme_code-bg !important; } @@ -25,6 +25,6 @@ .cp-border-color-settings { border-color: @colortheme_settings-bg !important; } .cp-border-color-profile { border-color: @colortheme_settings-bg !important; } .cp-border-color-default { border-color: @colortheme_default-bg !important; } - .cp-border-color-todo { border-color:@colortheme_todo-bg !important; } + .cp-border-color-todo { border-color: @colortheme_todo-bg !important; } } diff --git a/customize.dist/src/less2/include/limit-bar.less b/customize.dist/src/less2/include/limit-bar.less index 373d59e66..7faf2d916 100644 --- a/customize.dist/src/less2/include/limit-bar.less +++ b/customize.dist/src/less2/include/limit-bar.less @@ -27,7 +27,7 @@ background: blue; position: absolute; left: 0; - z-index:1; // .usage + z-index: 1; // .usage &.cp-limit-usage-normal { background: @colortheme_green; } diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index ce93bb07e..79e52f550 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -86,7 +86,7 @@ white-space: normal; line-height: auto; } - text-align:baseline; + text-align: baseline; .cp-toolbar-userlist-viewer { font-style: italic; padding: 5px; @@ -310,7 +310,7 @@ } &.cp-toolbar-notitle { - .cp-toolbar-top-fillerĀ { + .cp-toolbar-top-filler { flex: 1; } } @@ -319,7 +319,7 @@ @media screen and (max-width: @browser_media-medium-screen) { flex-wrap: wrap; height: auto; - .cp-toolbar-top-fillerĀ { + .cp-toolbar-top-filler { flex: 1; } .cp-toolbar-title { @@ -744,13 +744,13 @@ .cp-toolbar-drawer-content { box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2); position: absolute; - right:0px; + right: 0px; margin-top: @toolbar_line-height; min-width: 50px; background: @colortheme_dropdown-bg; display: flex; flex-flow: column; - z-index:10000; //Z cp-toolbar-drawer-content + z-index: 10000; //Z cp-toolbar-drawer-content color: black; .fa { font-size: 17px; diff --git a/customize.dist/src/less2/main.less b/customize.dist/src/less2/main.less index 88f6f1f60..a2e0e89bd 100644 --- a/customize.dist/src/less2/main.less +++ b/customize.dist/src/less2/main.less @@ -22,7 +22,7 @@ html.cp-app-print { .app-print_main(); } -body.cp-readonly .cp-hidden-if-readonly { display:none !important; } +body.cp-readonly .cp-hidden-if-readonly { display: none !important; } body.cp-app-drive { @import "../../../drive/app-drive.less"; } body.cp-app-pad { @import "../../../pad/app-pad.less"; } diff --git a/customize.dist/src/less2/pages/page-about.less b/customize.dist/src/less2/pages/page-about.less index 2ce8ae540..83354abd7 100644 --- a/customize.dist/src/less2/pages/page-about.less +++ b/customize.dist/src/less2/pages/page-about.less @@ -44,7 +44,7 @@ } } } - .cp-bio-avatar-right { + .cp-bio-avatar-right { padding-right: 15px; padding-left: 0; @media (max-width: 991px) { diff --git a/customize.dist/src/less2/pages/page-contact.less b/customize.dist/src/less2/pages/page-contact.less index 19bbd57a2..4d2f9ad0e 100644 --- a/customize.dist/src/less2/pages/page-contact.less +++ b/customize.dist/src/less2/pages/page-contact.less @@ -12,7 +12,7 @@ } .cp-container { background: #fff; - .cp-iconCont{ + .cp-iconCont { h4 { margin-top: 1.5em; margin-bottom: 1.5em; @@ -31,7 +31,7 @@ @media (max-width: 1200px) and (min-width: 769px) { min-height: 139px; } - @media (max-width: 768px) and (min-width: 576px){ + @media (max-width: 768px) and (min-width: 576px) { min-height: 164px; } @media (max-width: 496px) { diff --git a/customize.dist/src/less2/pages/page-index.less b/customize.dist/src/less2/pages/page-index.less index f338850f5..55671f913 100644 --- a/customize.dist/src/less2/pages/page-index.less +++ b/customize.dist/src/less2/pages/page-index.less @@ -99,7 +99,7 @@ a:hover { display: flex; align-items: stretch; margin: 25px 0; - background:rgba(255,255,255,0.6); + background: rgba(255,255,255,0.6); color: black; transition: all .1s ease-in-out; box-sizing: border-box; diff --git a/package.json b/package.json index fd9205157..e48d11b72 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "dev": "DEV=1 node server.js", "fresh": "FRESH=1 node server.js", "lint": "jshint --config .jshintrc --exclude-path .jshintignore . && ./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/", + "lint:js": "jshint --config .jshintrc --exclude-path .jshintignore .", + "lint:less": "./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/", "flow": "./node_modules/.bin/flow", "test": "node TestSelenium.js", "template": "cd customize.dist/src && for page in ../index.html ../privacy.html ../terms.html ../about.html ../contact.html ../what-is-cryptpad.html ../../www/login/index.html ../../www/register/index.html ../../www/settings/index.html ../../www/user/index.html;do echo $page; cp template.html $page; done;"