Просмотр исходного кода

fix non-autofixable biome errors

Futa Arai 6 месяцев назад
Родитель
Сommit
e6e35f074c

+ 4 - 1
apps/app/src/services/renderer/remark-plugins/attachment.ts

@@ -19,7 +19,10 @@ const rewriteNode = (node: Link) => {
       ? node.children[0].value
       : '';
 
-  const data = node.data ?? (node.data = {});
+  if (node.data == null) {
+    node.data = {};
+  }
+  const data = node.data;
   data.hName = 'attachment';
   data.hProperties = {
     attachmentId,

+ 4 - 1
apps/app/src/services/renderer/remark-plugins/codeblock.ts

@@ -8,7 +8,10 @@ const SUPPORTED_CODE = ['inline'];
 export const remarkPlugin: Plugin = () => {
   return (tree) => {
     visit(tree, 'inlineCode', (node: InlineCode) => {
-      const data = node.data || (node.data = {});
+      if (node.data == null) {
+        node.data = {};
+      }
+      const data = node.data;
       data.hProperties = { inline: 'true' }; // set 'true' explicitly because the empty string is evaluated as false for `if (inline) { ... }`
     });
   };

+ 8 - 2
apps/app/src/services/renderer/remark-plugins/echo-directive.ts

@@ -21,7 +21,10 @@ export const remarkPlugin: Plugin = () => {
     visit(tree, 'textDirective', (node: TextDirective) => {
       const tagName = 'span';
 
-      const data = node.data ?? (node.data = {});
+      if (node.data == null) {
+        node.data = {};
+      }
+      const data = node.data;
       data.hName = tagName;
       data.hProperties = h(tagName, node.attributes ?? {}).properties;
       data.hChildren = echoDirective(node);
@@ -30,7 +33,10 @@ export const remarkPlugin: Plugin = () => {
     visit(tree, 'leafDirective', (node: LeafDirective) => {
       const tagName = 'div';
 
-      const data = node.data ?? (node.data = {});
+      if (node.data == null) {
+        node.data = {};
+      }
+      const data = node.data;
       data.hName = tagName;
       data.hProperties = h(tagName, node.attributes ?? {}).properties;
       data.hChildren = echoDirective(node);