mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 11:03:54 +00:00
lint: Correctly detect the use of style attribute.
We add a exclude pattern that makes sure we don't catch two edge cases: a variable declaration `const style =` and setting a variable ending in style such as `require_cmd_style =`. We don't add and exclude pattern for let declaration because it will catch lines that modify it later in the code. (Removed other files from exclude list that no longer needed to be excluded from this lint rule.)
This commit is contained in:
committed by
Tim Abbott
parent
43da43701b
commit
ec2ab1eb8d
@@ -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;"'],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user