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: Correctly detect the use of style attribute.

Priyank Patelec2ab1eb8dc7
diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py
index 8f6a8798f59..4c9a970e6a0 100644
--- a/tools/linter_lib/custom_check.py
+++ b/tools/linter_lib/custom_check.py
@@ -202,14 +202,12 @@ js_rules = RuleList(
},
{
"pattern": "style ?=",
+ "exclude_pattern": r"(const |\S)style ?=",
"description": "Avoid using the `style=` attribute; we prefer styling in CSS files",
"exclude": {
"frontend_tests/node_tests/copy_and_paste.js",
- "frontend_tests/node_tests/upload.js",
- "static/js/upload.js",
- "static/js/stream_color.js",
},
- "good_lines": ["#my-style {color: blue;}"],
+ "good_lines": ["#my-style {color: blue;}", "const style =", 'some_style = "test"'],
"bad_lines": ['<p style="color: blue;">Foo</p>', 'style = "color: blue;"'],
},
{