From 024aa741a7ff0cddc384a7fb5132cac20788fdf1 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Fri, 8 Dec 2017 19:12:34 +0100 Subject: [PATCH] Added all of the filters to the lesshint rc (all explicitly enabled or disabled) and made empty line at end of file compliant --- .lesshintrc | 75 +++++++++++++------ .../src/less2/include/colortheme-all.less | 2 +- .../less2/pages/page-what-is-cryptpad.less | 2 +- 3 files changed, 54 insertions(+), 25 deletions(-) diff --git a/.lesshintrc b/.lesshintrc index cb8f17574..59f15cf5a 100644 --- a/.lesshintrc +++ b/.lesshintrc @@ -2,30 +2,59 @@ "fileExtensions": [".less"], // These rules are almost certainly crap and will not catch bugs (Caleb) - "finalNewline": false, - "newlineAfterBlock": false, - "spaceAroundOperator": false, - "hexLength": false, - "hexNotation": false, - "propertyOrdering": false, - "stringQuotes": false, - "importPath": false, - "qualifyingElement": false, - "decimalZero": false, - "borderZero": false, + "newlineAfterBlock": { "enabled": false }, // not just a newline but an entire empty line after each block + "spaceAroundOperator": { "enabled": false }, // disallow calc(10px+10px); + "hexLength": { "enabled": false }, // require long hex color codes or require short where possible + "hexNotation": { "enabled": false }, // require hex lowercase + "propertyOrdering": { "enabled": false }, // require attributes to be in alphabetical order D: + "stringQuotes": { "enabled": false }, // force quoting of strings with ' or " (silly) + "importPath": { "enabled": false }, // require imports to not have .less, ridiculous + "qualifyingElement": { "enabled": false }, // disallow div.xxx and require .xxx + "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": false, - "spaceAroundComma": false, - "singleLinePerProperty": false, - "importantRule": false, - "idSelector": false, - "singleLinePerSelector": false, - "spaceAfterPropertyColon": false, - "spaceBetweenParens": false, - "spaceBeforeBrace": false, - "universalSelector": false, + "zeroUnit": { "enabled": false }, + "spaceAroundComma": { "enabled": false }, + "singleLinePerProperty": { "enabled": false }, + "_singleLinePerProperty": { + "enabled": true, + "allowSingleLineRules": true + }, + "importantRule": { "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 ? + "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" }, - // These rules are really good rules to have around IMO (Caleb) but they're not being honored. - "maxCharPerLine": false + // Turn everything else on + "attributeQuotes": { "enabled": true }, + "depthLevel": { + "depth": 1 // TODO(cjd) This is obviously not triggering, even with 1 + }, + "duplicateProperty": { "enabled": true }, + "emptyRule": { "enabled": true }, + "hexValidation": { "enabled": true }, // disallow actual garbage color hex codes (e.g. #ab) + "propertyUnits": { + "valid": ["rem", "vw", "em", "px"], // These units are allowed for all properties + "invalid": ["pt"], // The 'pt' unit is not allowed under any circumstances + "properties": { + //"line-height": [] // No units are allowed for line-height + } + }, + "spaceAfterPropertyName": { "enabled": true, "style": "no_space" }, + "spaceAfterPropertyValue": { "enabled": true, "style": "no_space" }, + "spaceAroundBang": { "enabled": true, "style": "before" }, + "trailingSemicolon": { "enabled": true }, + "trailingWhitespace": { "enabled": true }, + "urlFormat": { "enabled": true, "style": "relative" }, + "urlQuotes": { "enabled": true } } diff --git a/customize.dist/src/less2/include/colortheme-all.less b/customize.dist/src/less2/include/colortheme-all.less index 0495ff076..4544da76e 100644 --- a/customize.dist/src/less2/include/colortheme-all.less +++ b/customize.dist/src/less2/include/colortheme-all.less @@ -3,4 +3,4 @@ // override whatever colors you want. When you update, the new colors will be // added ok because the original file is pulled in first. @import (once) "/customize.dist/src/less2/include/colortheme.less"; -@import (once) "/customize/src/less2/include/colortheme.less"; \ No newline at end of file +@import (once) "/customize/src/less2/include/colortheme.less"; diff --git a/customize.dist/src/less2/pages/page-what-is-cryptpad.less b/customize.dist/src/less2/pages/page-what-is-cryptpad.less index 134c1d6a5..0e02ce41a 100644 --- a/customize.dist/src/less2/pages/page-what-is-cryptpad.less +++ b/customize.dist/src/less2/pages/page-what-is-cryptpad.less @@ -40,4 +40,4 @@ display: block; margin: 0 auto; } -} \ No newline at end of file +}