Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

lint: Migrate all custom CSS rules to stylelint.

Anders Kaseorg9f2cd66a4d9a
diff --git a/stylelint.config.js b/stylelint.config.js
index 87ad25659ae..5db04a336b0 100644
--- a/stylelint.config.js
+++ b/stylelint.config.js
@@ -26,5 +26,20 @@ module.exports = {
// Limit language features
"color-no-hex": true,
"color-named": "never",
+ "declaration-property-value-blacklist": {
+ // thin/medium/thick is under-specified, please use pixels
+ "/^(border(-top|-right|-bottom|-left)?|outline)(-width)?$/": [
+ /\b(thin|medium|thick)\b/,
+ ],
+ },
+ "function-blacklist": [
+ // We use hsl(a) instead of rgb(a)
+ "rgb",
+ "rgba",
+ ],
+
+ // Zulip CSS should have no dependencies on external resources
+ "function-url-no-scheme-relative": true,
+ "function-url-scheme-whitelist": [],
},
};
diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py
index 8092e4390c6..5fa6fb3e54f 100644
--- a/tools/linter_lib/custom_check.py
+++ b/tools/linter_lib/custom_check.py
@@ -418,26 +418,6 @@ bash_rules = RuleList(
css_rules = RuleList(
langs=['css', 'scss'],
rules=[
- {'pattern': r'^(?:(?!/\*).)*https?://',
- 'description': "Zulip CSS should have no dependencies on external resources",
- 'good_lines': ['background: url(/static/images/landing-page/pycon.jpg);'],
- 'bad_lines': ['background: url(https://example.com/image.png);']},
- {'pattern': ' thin[ ;]',
- 'description': "thin CSS attribute is under-specified, please use 1px.",
- 'good_lines': ["border-width: 1px;"],
- 'bad_lines': ["border-width: thin;", "border-width: thin solid black;"]},
- {'pattern': ' medium[ ;]',
- 'description': "medium CSS attribute is under-specified, please use pixels.",
- 'good_lines': ["border-width: 3px;"],
- 'bad_lines': ["border-width: medium;", "border: medium solid black;"]},
- {'pattern': ' thick[ ;]',
- 'description': "thick CSS attribute is under-specified, please use pixels.",
- 'good_lines': ["border-width: 5px;"],
- 'bad_lines': ["border-width: thick;", "border: thick solid black;"]},
- {'pattern': r'rgba?\(',
- 'description': 'Use of rgb(a) format is banned, Please use hsl(a) instead',
- 'good_lines': ['hsl(0, 0%, 0%)', 'hsla(0, 0%, 100%, 0.1)'],
- 'bad_lines': ['rgb(0, 0, 0)', 'rgba(255, 255, 255, 0.1)']},
*whitespace_rules,
],
)