mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
eslint: Fix unicorn/no-lonely-if.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v24.0.0/docs/rules/no-lonely-if.md Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
6acbcec39d
commit
2f80415756
@@ -19,13 +19,15 @@ exports.smart_insert = function (textarea, syntax) {
|
||||
const before_str = textarea.val().slice(0, pos);
|
||||
const after_str = textarea.val().slice(pos);
|
||||
|
||||
if (pos > 0) {
|
||||
if (
|
||||
pos > 0 &&
|
||||
// If there isn't space either at the end of the content
|
||||
// before the insert or (unlikely) at the start of the syntax,
|
||||
// add one.
|
||||
if (!is_space(before_str.slice(-1)) && !is_space(syntax[0])) {
|
||||
syntax = " " + syntax;
|
||||
}
|
||||
!is_space(before_str.slice(-1)) &&
|
||||
!is_space(syntax[0])
|
||||
) {
|
||||
syntax = " " + syntax;
|
||||
}
|
||||
|
||||
// If there isn't whitespace either at the end of the syntax or the
|
||||
|
||||
Reference in New Issue
Block a user