Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
lint: Update lint rules for FormatJS migration.
Anders Kaseorga5511b3fbb44
diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.pyindex 0d4a59c10d7..40a8c6aa9e9 100644--- a/tools/linter_lib/custom_check.py+++ b/tools/linter_lib/custom_check.py@@ -120,26 +120,13 @@ js_rules = RuleList("description": 'Avoid using "msgid" as a variable name; use "message_id" instead.',},{- "pattern": r"i18n\.t\([^)]+[^,\{\)]$",- "description": "i18n string should not be a multiline string",- },- {- "pattern": r"""i18n\.t\(['"].+?['"]\s*\+""",- "description": "Do not concatenate arguments within i18n.t()",- },- {- "pattern": r"""i18n\.t\([a-zA-Z]""",- "exclude": {"static/js/templates.js"},- "description": "Do not pass a variable into i18n.t; it will not be exported to Transifex for translation.",- },- {- "pattern": r"i18n\.t\(.+\).*\+",+ "pattern": r"\$t\(.+\).*\+","description": "Do not concatenate i18n strings",},- {"pattern": r"\+.*i18n\.t\(.+\)", "description": "Do not concatenate i18n strings"},+ {"pattern": r"\+.*\$t\(.+\)", "description": "Do not concatenate i18n strings"},{"pattern": "[.]html[(]",- "exclude_pattern": r"""\.html\(("|'|render_|html|message\.content|util\.clean_user_content_links|i18n\.t|rendered_|$|\)|error_html|widget_elem|\$error|\$\("<p>"\))""",+ "exclude_pattern": r"""\.html\(("|'|render_|html|message\.content|util\.clean_user_content_links|rendered_|$|\)|error_html|widget_elem|\$error|\$\("<p>"\))""","exclude": {"static/js/portico","static/js/lightbox.js",@@ -157,13 +144,13 @@ js_rules = RuleList({"pattern": "^[ ]*//[A-Za-z0-9]", "description": "Missing space after // in comment"},{"pattern": r"""[.]text\(["'][a-zA-Z]""",- "description": "Strings passed to $().text should be wrapped in i18n.t() for internationalization",+ "description": "Strings passed to $().text should be wrapped in $t() for internationalization","exclude": {"frontend_tests/node_tests/"},},{"pattern": r"""compose_error\(["']""",- "description": "Argument to compose_error should be a literal string enclosed "- "by i18n.t()",+ "description": "Argument to compose_error should be a literal string translated "+ "by $t_html()",},{"pattern": r"ui.report_success\(",@@ -171,8 +158,8 @@ js_rules = RuleList(},{"pattern": r"""report.success\(["']""",- "description": "Argument to ui_report.success should be a literal string enclosed "- "by i18n.t()",+ "description": "Argument to ui_report.success should be a literal string translated "+ "by $t_html()",},{"pattern": r"ui.report_error\(",@@ -180,15 +167,15 @@ js_rules = RuleList(},{"pattern": r"""report.error\(["'][^'"]""",- "description": "Argument to ui_report.error should be a literal string enclosed "- "by i18n.t()",+ "description": "Argument to ui_report.error should be a literal string translated "+ "by $t_html()","good_lines": ['ui_report.error("")', 'ui_report.error(_("text"))'],"bad_lines": ['ui_report.error("test")'],},{"pattern": r"""report.client_error\(["'][^'"]""",- "description": "Argument to ui_report.client_error should be a literal string enclosed "- "by i18n.t()",+ "description": "Argument to ui_report.client_error should be a literal string translated "+ "by $t_html()","good_lines": ['ui_report.client_error("")', 'ui_report.client_error(_("text"))'],"bad_lines": ['ui_report.client_error("test")'],},