 Issue 29541680:
  Issue 5109 - Create stylelintrc for websites and ui modules  (Closed) 
  Base URL: https://hg.adblockplus.org/codingtools
    
  
    Issue 29541680:
  Issue 5109 - Create stylelintrc for websites and ui modules  (Closed) 
  Base URL: https://hg.adblockplus.org/codingtools| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 1 /* | 1 /* | 
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH | 
| 4 * | 4 * | 
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify | 
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as | 
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. | 
| 8 * | 8 * | 
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, | 
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. | 
| 13 * | 13 * | 
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License | 
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 
| 16 */ | 16 */ | 
| 17 | 17 | 
| 18 "use strict" | 18 "use strict"; | 
| 19 | 19 | 
| 20 module.exports = { | 20 module.exports = { | 
| 21 "extends": "stylelint-config-recommended", | 21 extends: "stylelint-config-recommended", | 
| 22 "rules": { | 22 rules: { | 
| 23 // Opening braces go on their own line | |
| 24 "block-opening-brace-newline-before": "always-multi-line", | |
| 25 "block-opening-brace-newline-after": "always-multi-line", | |
| 26 "block-closing-brace-newline-before": "always-multi-line", | |
| 27 "block-closing-brace-newline-after": "always", | |
| 28 "block-closing-brace-empty-line-before": "never", | |
| 23 | 29 | 
| 24 // Opening braces go on their own line | 30 // Use a space between the last selector and the declaration block | 
| 25 "block-closing-brace-empty-line-before": "never", | 31 "block-opening-brace-space-before": "always-single-line", | 
| 26 "block-closing-brace-newline-after": "always", | |
| 27 "block-closing-brace-newline-before": "always-multi-line", | |
| 28 "block-closing-brace-space-after": "always-single-line", | 32 "block-closing-brace-space-after": "always-single-line", | 
| 29 "block-closing-brace-space-before": "always-single-line", | 33 | 
| 
Thomas Greiner
2017/09/13 18:12:52
Which part of the coding style does this rule refe
 
ire
2017/09/14 08:33:00
We link to the Google HTML/CSS Style guide, which
 
Thomas Greiner
2017/09/14 10:52:15
This rule is not about the opening but the closing
 
ire
2017/09/15 08:54:11
Under 4.2.5 Declaration Block Separation, it says:
 
Thomas Greiner
2017/09/15 16:58:29
There seems to be a misunderstanding - sorry about
 
ire
2017/09/18 07:36:20
Ah right! Yes seems I was mixing the two up. 
Two
 
Thomas Greiner
2017/11/14 13:18:30
I can't find any mentions of it being prohibited i
 
ire
2017/11/15 06:38:32
Okay. I will remove two rules:
"block-opening-brac
 
ire
2017/11/15 06:38:32
Done.
 | |
| 30 "block-opening-brace-newline-after": "always-multi-line", | 34 // Use a space after a property name’s colon | 
| 31 "block-opening-brace-newline-before": "always-multi-line", | 35 "declaration-colon-space-after": "always", | 
| 
Thomas Greiner
2017/09/13 18:12:52
Allowing single-line rules here sounds incompatibl
 
ire
2017/09/14 08:33:00
I think I assumed that single-line rules were okay
 
Thomas Greiner
2017/09/14 10:52:15
It's the "Opening braces go on their own line" gui
 
ire
2017/09/15 08:54:11
Stylelint will consider that a single line (I beli
 
Thomas Greiner
2017/09/15 16:58:29
True, seems like it.
 | |
| 32 "block-opening-brace-space-after": "always-single-line", | 36 | 
| 33 "block-opening-brace-space-before": "always-single-line", | 37 // Selectors and declarations should be on their own line | 
| 38 "selector-list-comma-newline-after": "always", | |
| 39 "declaration-block-semicolon-newline-after": "always-multi-line", | |
| 40 | |
| 41 // Separate rules by an empty line | |
| 42 "rule-empty-line-before": ["always", { | |
| 43 "ignore": ["after-comment", "first-nested"] | |
| 44 }], | |
| 34 | 45 | 
| 35 // Use double over single quotation marks | 46 // Use double over single quotation marks | 
| 36 "string-quotes": "double", | 47 "string-quotes": "double", | 
| 37 | 48 | 
| 38 // CSS color values should be specified in hexadecimal where possible | 49 // CSS color values should be specified in hexadecimal where possible | 
| 
ire
2017/09/11 09:26:38
I couldn't find stylelint rules for these. Not sur
 
Thomas Greiner
2017/09/13 18:12:52
It's more of a guideline than a strict rule. Some
 
ire
2017/09/14 08:33:00
Okay thanks. Done.
 | |
| 50 "color-named": "never", | |
| 39 | 51 | 
| 40 // CSS shorthand properties usage is optional | 52 // Use short hexadecimal notation where possible | 
| 41 | 53 "color-hex-length": "short", | 
| 42 // CSS rule declaration order should follow the WordPress CSS Coding Standar ds | |
| 
ire
2017/09/11 09:26:38
The declaration order is no longer part of styleli
 
Thomas Greiner
2017/09/13 18:12:52
Given that this rule can be quite confusing for so
 
ire
2017/09/14 08:33:00
Okay. I think we should add it in a separate commi
 
Thomas Greiner
2017/09/14 10:52:15
I totally agree.
 
ire
2017/09/15 08:54:12
Great. Created the issue here https://issues.adblo
 
Thomas Greiner
2017/09/15 16:58:29
Awesome, thanks.
 | |
| 43 | |
| 44 // CSS number values should specify units where possible | |
| 45 "unit-no-unknown": true, | |
| 
Thomas Greiner
2017/09/13 18:12:52
This is not what "should specify units where possi
 
ire
2017/09/14 08:33:00
Seems I misunderstood the "unit-no-unknown" rule :
 
Thomas Greiner
2017/09/14 10:52:15
I included this in https://issues.adblockplus.org/
 
ire
2017/09/15 08:54:11
Acknowledged.
 | |
| 46 | 54 | 
| 47 // Don't omit the optional leading 0 for decimal numbers | 55 // Don't omit the optional leading 0 for decimal numbers | 
| 48 "number-leading-zero": "always", | 56 "number-leading-zero": "always", | 
| 49 "number-no-trailing-zeros": true, | 57 "number-no-trailing-zeros": true, | 
| 50 | 58 | 
| 51 // Indent by 2 spaces | 59 // Two spaces per logic level | 
| 52 "indentation": 2, | 60 "indentation": 2, | 
| 
ire
2017/09/11 09:26:38
This isn't actually documented in https://adblockp
 
Thomas Greiner
2017/09/13 18:12:52
Under "General" we link to https://developer.mozil
 
ire
2017/09/14 08:33:00
Acknowledged.
 | |
| 53 | 61 | 
| 54 }, | 62 // Line length should be 80 characters or less | 
| 55 } | 63 "max-line-length": 80, | 
| 64 | |
| 65 // Avoid qualifying ID and class names with type selectors | |
| 66 "selector-no-qualifying-type": [true, { | |
| 67 "ignore": ["attribute"] | |
| 68 }] | |
| 69 } | |
| 70 }; | |
| LEFT | RIGHT |