about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-06-23 18:43:30 -0700
committerkibigo! <marrus-sh@users.noreply.github.com>2017-06-23 18:43:30 -0700
commit414dfb39551f7d35c704823b4bae7a0df293bf16 (patch)
treea88aca4f3ac74e824752e3cb5912dfeaefdaa946 /app/javascript
parent67adbcc60cee7915f8e59256a0eaf6d42a03a559 (diff)
ESLint improvements for Profile Metadata
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/features/account/components/header.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js
index b728c66e2..f929f1162 100644
--- a/app/javascript/mastodon/features/account/components/header.js
+++ b/app/javascript/mastodon/features/account/components/header.js
@@ -41,27 +41,27 @@ const messages = defineMessages({
                                            @kibi@glitch.social <3
 */
 
-const NEW_LINE    = /(?:^|\r?\n|<br\s*\/?>)/g
+const NEW_LINE    = /(?:^|\r?\n|<br\s*\/?>)/g;
 const YAML_OPENER = /---/;
 const YAML_CLOSER = /(?:---|\.\.\.)/;
 const YAML_STRING = /(?:"(?:[^"\n]){1,32}"|'(?:[^'\n]){1,32}'|(?:[^'":\n]){1,32})/g;
-const YAML_LINE = new RegExp("\\s*" + YAML_STRING.source + "\\s*:\\s*" + YAML_STRING.source + "\\s*", "g");
-const BIO_REGEX = new RegExp(NEW_LINE.source + "*" + YAML_OPENER.source + NEW_LINE.source + "+(?:" + YAML_LINE.source + NEW_LINE.source + "+){0,4}" + YAML_CLOSER.source + NEW_LINE.source + "*");
+const YAML_LINE = new RegExp('\\s*' + YAML_STRING.source + '\\s*:\\s*' + YAML_STRING.source + '\\s*', 'g');
+const BIO_REGEX = new RegExp(NEW_LINE.source + '*' + YAML_OPENER.source + NEW_LINE.source + '+(?:' + YAML_LINE.source + NEW_LINE.source + '+){0,4}' + YAML_CLOSER.source + NEW_LINE.source + '*');
 
 const processBio = (data) => {
-  let props = {text: data, metadata: []};
+  let props = { text: data, metadata: [] };
   let yaml = data.match(BIO_REGEX);
   if (!yaml) return props;
   else yaml = yaml[0];
   let start = props.text.indexOf(yaml);
   let end = start + yaml.length;
   props.text = props.text.substr(0, start) + props.text.substr(end);
-  yaml = yaml.replace(NEW_LINE, "\n");
+  yaml = yaml.replace(NEW_LINE, '\n');
   let metadata = (yaml ? yaml.match(YAML_LINE) : []) || [];
   for (let i = 0; i < metadata.length; i++) {
     let result = metadata[i].match(YAML_STRING);
-    if (result[0][0] === '"' || result[0][0] === "'") result[0] = result[0].substr(1, result[0].length - 2);
-    if (result[1][0] === '"' || result[1][0] === "'") result[0] = result[1].substr(1, result[1].length - 2);
+    if (result[0][0] === '"' || result[0][0] === '\'') result[0] = result[0].substr(1, result[0].length - 2);
+    if (result[1][0] === '"' || result[1][0] === '\'') result[0] = result[1].substr(1, result[1].length - 2);
     props.metadata.push(result);
   }
   return props;
@@ -184,7 +184,7 @@ export default class Header extends ImmutablePureComponent {
 
             <span className='account__header__display-name' dangerouslySetInnerHTML={displayNameHTML} />
             <span className='account__header__username'>@{account.get('acct')} {lockedIcon}</span>
-            <div className='account__header__content' dangerouslySetInnerHTML={{__html: emojify(text)}} />
+            <div className='account__header__content' dangerouslySetInnerHTML={{ __html: emojify(text) }} />
 
             {info}
             {actionBtn}
@@ -199,11 +199,11 @@ export default class Header extends ImmutablePureComponent {
                 data.push(
                   <div
                     className='account__metadata-item'
-                    title={metadata[i][0] + ":" + metadata[i][1]}
+                    title={metadata[i][0] + ':' + metadata[i][1]}
                     key={i}
                   >
-                    <span dangerouslySetInnerHTML={{__html: emojify(metadata[i][0])}} />
-                    <strong dangerouslySetInnerHTML={{__html: emojify(metadata[i][1])}} />
+                    <span dangerouslySetInnerHTML={{ __html: emojify(metadata[i][0]) }} />
+                    <strong dangerouslySetInnerHTML={{ __html: emojify(metadata[i][1]) }} />
                   </div>
                 );
               }